I received this by private email. I am posting it here so everyone can see this.
"The Plan" was to,
1. Get the Credit Card info
2. ENCRYPT the data string when SAVING the Client Record
3. Save the Encrypted String in the Client DBF Record
4. Retrieve it by pressing the "Decrypt" button while editing
I tested this using your sample in \exp19\samples\encrypt
It works ONCE both in encrypting and decrypting. I skip to the next record and try the same function and I get the error "Internal data structure corrupted", in both functions, at 2nd to last line "dllExecuteCall(scCall, instr/cKey. @cOutput)". Attached most of the code, the DBF, and xpperror.log.
Encryption of Credit Card Numbers
Encryption of Credit Card Numbers
The eXpress train is coming - and it has more cars.
Re: Encryption of Credit Card Numbers
I figured out the problem. Make the below changes to \exp19\samples\encrypt\test.prg.
Code: Select all
Function Decrypt(inStr)
LOCAL cKey, cOutput := Space(512)
STATIC snDll, scCall
IF Empty(snDll)
snDll := DllLoad('DESDLL.DLL')
scCall := DllPrepareCall(snDll,DLL_STDCALL,'DESDecrypt')
// cKey := 'DonnaySoftware' <<< remove this
ENDIF
cKey := 'DonnaySoftware' // <<< put it here
DllExecuteCall(scCall,inStr,cKey,@cOutput)
RETURN Strtran(RTrim(cOutput),Chr(0),'')
* --------------
Function Encrypt(inStr)
LOCAL cKey, cOutput := Space(512)
STATIC snDll, scCall
IF Empty(snDll)
snDll:=DllLoad('DESDLL.DLL')
scCall:=DllPrepareCall(snDll,DLL_STDCALL,'DESEncrypt')
// cKey := 'DonnaySoftware' <<< remove this
ENDIF
cKey := 'DonnaySoftware' // <<< put it here
DllExecuteCall(scCall,inStr,cKey,@cOutput)
RETURN Left(RTrim(cOutput),Len(cOutput)-1)
The eXpress train is coming - and it has more cars.