Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Crypto Class
Message
 
 
To
04/03/2010 09:28:16
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01452254
Message ID:
01452483
Views:
56
Many Many thanks for all your help

>>Awesome, Borislav
>>
>>Been messing about with this for so long, got a bit stir crazy, I forgot to set my fields to binary.
>>
>>Last question, if I wanted to use a character field (binary of course), would this still work? Not a big fan of memo fields to be honest, they tend to go wronfg often & and seem to suffer bloat
>
>Check this:
>
>CLEAR
>CREATE CURSOR crsTest (Name C(200) NOCPTRANS, nAME2 C(200) nocptrans)
>oCrypto = Newobject("_cryptapi", HOME()+[FFC\_crypt.vcx])
>#DEFINE NOCSP_Lines_of_code "The required Crypto Service Provider is not installed or not functioning properly on this system. Some or all of these samples may not work."
>
>IF !OCrypto.GetIsInstalled()
>   MESSAGEBOX(NOCSP_Lines_of_code)
>   RETURN .F.
>ENDIF
>
>LOCAL lcEncryptedStream,lcPassword,lcKey
>lcEncryptedStream = ''
>lcDecryptedStream = ''
>
>lcPassWord = "Christine"
>lcKey      = "Secret Password"
>IF ocrypto.EncryptSessionStreamString(lcPassWord, lcKey, @lcEncryptedStream)
>
>ELSE
>   IF ocrypto._cryptapi.GetDoubleEncryptError()
>      MESSAGEBOX("Sorry, you cannot double-encrypt this text.")
>   ELSE
>      MESSAGEBOX("Error: "+MESSAGE())
>   ENDIF
>   RETURN
>ENDIF
>
>?lcEncryptedStream
>APPEND BLANK
>REPLACE name WITH STRCONV(lcEncryptedStream,15), nAME2 WITH lcPassWord
>lcfield=STRCONV(ALLTRIM(name),16)
>mresult=ocrypto.DecryptSessionStreamString(lcfield, lcKey, @lcDecryptedStream)
>?lcDecryptedStream
>brow
>
>
>But check how I store them in the field: I use STRCONV(..., 15) to Store them in the table and when I need to get them back I use STRCONV(....,16)
Rob
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform