Encryption of Credit Card Numbers

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Encryption of Credit Card Numbers

#1 Post by rdonnay »

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.
The eXpress train is coming - and it has more cars.

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Encryption of Credit Card Numbers

#2 Post by rdonnay »

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.

Post Reply