Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Data Encryption DLL 1

Status
Not open for further replies.

prustie

Programmer
Aug 6, 2001
34
GB
Hi

I am trying to find an ACTIVEX component which will provide me with the means of Encrypting and Decrypting text strings.

I have downloaded a Demo which gives me the file CryptoCompress.DLL.

I can declare the DLL using DECLARE STRING Encrypt IN CryptoCompress.DLL but when I try to use the functions I get the message 'Entry Point Encrypt not found in DLL'.

According to the supplier the full syntax is

Encrypt( String PlainText, String Key, Variant *Encrypted, int *iRetVal).

How do I convert that into VFP?

Regards

Malcolm

 
Malcolm,
If you are using VFP 7.0, why not use the MS _crypt.vcx in the Foundation classes. There is sample code in the solution.app:
DO (_samples+"\solution\solution")

The Variant pointer in the VB declaration isn't straight forward to implement in VFP.

Rick
 
To answer your original question, I believe this is how you would need to implement the class:
[tt]
DECLARE INTEGER Encrypt IN CryptoCompress.DLL ;
String plaintext, string key,;
string @Encrypted, integer @iRetVal
[/tt]
Then you need to call it with parameters 3 and 4 passed by reference:
[tt]
Encrypted=""
iRetVal=0
Encrypt("This is a string",cKey,@Encrypted,@iRetVal)
?"Encrypted string: "+Encrypted
?"Return value from function: "
??iRetVal
[/tt]
I don't know the format of the Key, so I left cKey up to you to fill. I also don't know what the actual return value would be since the declaration doesn't say, so I assumed Integer (Declare Integer ...)

Hope that helps,

Ian
 

Hello, I am also getting the same error:
Please do the need full

PUBLIC objCrypt,lpoutput
objCrypt = CreateObject("CryptDemo.Crypt.1")
* DECLARE INTEGER EncryptData IN VisualSoftCrypt.DLL String plaintext, string key, string
@Encrypted, integer algorithm,integer inputformat,integer keyformat,integer outputformat,integer
mode,integer padding,integer endofstreaming,integer @iRetVal
lpoutput = SPACE(255) && REPLICATE( CHR(0), 50)
retvalue=objCrypt.EncryptData(strinput,strkey1,@lpoutput ,1,0,0,2,0,0,1)
lpoutput=SUBSTR(lpoutput , 1, 50)
MessageBox(lpoutput)
release objCrypt

As it is vc++ com dll declared as :
STDMETHODIMP CCrypt::EncryptData(VARIANT *vaPlainData, VARIANT *vaKey, VARIANT *vaCipherData,
caAlgID AlgID, cifInputFormat InputFormat, ckfKeyFormat KeyFormat, cofOutputFormat OutputFormat,
cmMode Mode, cpPadding Padding, BOOL EndOfStreaming, int *RetVal)

when declared the method using declare command.....the error was "Cannot load 32-bit DLL
CryptDemo.DLL
Pl tell how to use @ to get output parameter value, with CreateObject.
 
Hello, I am also getting the same error:
Please do the need full

PUBLIC objCrypt,lpoutput
objCrypt = CreateObject("CryptDemo.Crypt.1")
* DECLARE INTEGER EncryptData IN VisualSoftCrypt.DLL String plaintext, string key, string
@Encrypted, integer algorithm,integer inputformat,integer keyformat,integer outputformat,integer
mode,integer padding,integer endofstreaming,integer @iRetVal
lpoutput = SPACE(255) && REPLICATE( CHR(0), 50)
retvalue=objCrypt.EncryptData(strinput,strkey1,@lpoutput ,1,0,0,2,0,0,1)
lpoutput=SUBSTR(lpoutput , 1, 50)
MessageBox(lpoutput)
release objCrypt

As it is vc++ com dll declared as :
STDMETHODIMP CCrypt::EncryptData(VARIANT *vaPlainData, VARIANT *vaKey, VARIANT *vaCipherData,
caAlgID AlgID, cifInputFormat InputFormat, ckfKeyFormat KeyFormat, cofOutputFormat OutputFormat,
cmMode Mode, cpPadding Padding, BOOL EndOfStreaming, int *RetVal)

when declared the method using declare command.....the error was "Cannot load 32-bit DLL
CryptDemo.DLL
Pl tell how to use @ to get (variant as )output parameter value, with CreateObject.
Workin fine with string datatypes problem with only variant type.

--Please help as it is more urgent.
Thanks a lot.
gantimcp@yahoo.com
 
Another option: I found this site:


This guy has implented blowfish encryption algorithm under VFP clases. I've using it in a couple of proyects and it seems to work fine. Take away all the buzz of this biz and what do you get? 01000100101010...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top