Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to write code to call Cryptor
Message
From
10/06/2007 20:42:56
 
 
To
All
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
How to write code to call Cryptor
Miscellaneous
Thread ID:
01231867
Message ID:
01231867
Views:
97
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
Next
Reply
Map
View

Click here to load this message in the networking platform