Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crypto - RC4
Message
From
01/03/2003 19:13:04
 
 
To
01/03/2003 14:26:50
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00759999
Message ID:
00760045
Views:
19
>Anyone knows how to make a key from a string.
>
>I have a key ( string ) which I want to use for a RC4 encryption. The problem I have is to set up a key (using CryptImportKey() I guess). Once I have set up the key I can call either CryptEncrypt() or CryptDecrypt().
>
>I am generating a small pdf file which I would like to protect from modifying
>
>Now I have a little program in vfp that does the RC4 encryption ( rc4(rc4Key, src) ). I would prefer to use the crypto functions instead since they will be much faster.


I'm not sure I understand your problem.
Does this help?
oCrypto = NEWOBJECT("_cryptapi",HOME() + "ffc\_crypt.vcx")
cEncryptedStream=SPACE(255)
oCrypto.EncryptSessionStreamString(cEncryptedString, cPassWord, @cEncryptedStream)
* now cEncryptedStream has your encrypted string.
If what you are looking for is to encrypt a whole pdf file, then you could use something like this:
oCrypto = NEWOBJECT("_cryptapi",HOME() + "ffc\_crypt.vcx")
oCrypto.encryptsessionstreamfile("temp\test.pdf",cPassWord,"test.pdf.enc")
* now you have a resulting, encrypted file (original is left untouched)
* this will reverse it:
oCrypto.decryptsessionstreamfile("test.pdf.enc",cPassWord,"test.pdf")
HTH


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform