Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to write code to call Cryptor
Message
De
10/06/2007 20:42:56
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
How to write code to call Cryptor
Divers
Thread ID:
01231867
Message ID:
01231867
Vues:
95
I use Cryptor to encrypt DBF files, which I now need to access from a .NET app.

The way Cryptor works is by intercepting access to the files you indicate, and by the applications you indicate, and encrypting or decryptting on the fly. The VFP code below lets Cryptor know about an encrypted file that will accessed via VfpOleDb. Notice that it does not tell Cryptor about VfpOleDb.dll at all, but rather about OleDb32.dll, which is used by VfpOleDb to do the actual work.

I am very new at this. How would you write equivalent code in VB.NET?

TIA,

Alex
CLOSE ALL
* Instantiate Cryptor and tell it to watch disk access by oledb32.dll
poCryptor = CreateObject("XitechCryptor.Cryptor")
poCryptor.WatchDLL("oledb32.dll")

* Register table plemp.dbf with Cryptor as encrypted
MyCryptor('plemp.dbf')

* Access plemp.dbf via vfpoledb
LOCAL oConn as "adodb.connection"
LOCAL oRS as "adodb.recordset"
oConn = CREATEOBJECT('adodb.connection')
oRS = CREATEOBJECT('adodb.recordset')
cConnStrng = "Provider=vfpoledb;Data Source=" + "z:\VPay950\Contab\sosa"    && plemp.dbf is a free table
oConn.Open(cConnStrng)
oRS = oConn.Execute("SELECT * FROM plemp")
?oRS.Fields("ccodemp").Value
oRS.Close()
oConn.Close()

FUNCTION MyCryptor
PARAMETER tcFile
lcPassword = 'password'
lnAlgorithmNumber = xxx
poCryptor.Register(tcFile,lcPassword,lnAlgorithmNumber)
RETURN
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform