PerthWeb Developer : Products
CardCrypt : Examples
GENERATE KEYS
This sample code will generate a set of crypto keys:
<cfx _pwcardcrypt action="generate"
key_length="512">
The returned variables would contain:
PRIVATE_KEY: <private key>
PUBLIC_KEY: <public key>
VALIDATE SINGLE CARD
This code will validate a single credit card number:
<cfx_pwcardcrypt action="validate"
card_number="4242424242424242"
card_expiry_m="10"
card_expiry_y="02"
card_type="visa">
The returned variable would contain:
RESULT: OK
VALIDATE MULTIPLE CARDS
This will validate 4 cards at once:
<cfx_pwcardcrypt action="validate"
card_number="4242,4242,4242,4242"
card_expiry_m="10,11,05,06"
card_expiry_y="05,04,03,01"
card_type="visa,visa,visa,visa">
The result would contain a delimited list of the return values:
RESULT: OK,OK,OK,CARD_EXPIRED
ENCRYPT SINGLE CARD
This will encrypt a single credit card number, using a 512bit key. The #public_key# variable should contain the previously generated public key:
<cfx_pwcardcrypt action="encrypt"
card_number="424242"
card_expiry_m="10"
card_expiry_y="05"
card_type="visa"
crypt_key="#public_key#"
key_length="512">
This would return the following variables:
RESULT: OK
CRYPT_VALUE: <encrypted text>
ENCRYPT MULTIPLE CARDS
This will encrypt 3 card numbers, using a 1024 bit key:
<cfx_pwcardcrypt action="encrypt"
card_number="424242,424242,123456"
card_expiry_m="10,11,05"
card_expiry_y="05,04,03"
card_type="visa,visa,visa"
crypt_key="#public_key#"
key_length="1024">
The result would contain a delimited list of the return values:
RESULT: OK,OK,INVALID_VISA_NUMBER
CRYPT_VALUE: <encrypted text>,<encrypted text>,INVALID_VISA_NUMBER
DECRYPT SINGLE CARD
The following code will decrypt a single credit card number, using a 512bit key:
<cfx_pwcardcrypt action="decrypt"
card_number="#encrypted_text#"
crypt_key="#private_key#"
key_length="512">
This would return the following variables:
RESULT: OK
CRYPT_VALUE: <decrypted text>
DECRYPT MULTIPLE CARDS
This code will decrypt 2 card numbers, using a 1024 bit key, and changing the delimiter to a pipe:
<cfx_pwcardcrypt action="decrypt"
card_number="#encrypted_text#|#encrypted_text#"
crypt_key="#private_key#"
key_length="1024"
delimiter="|">
The result would contain a delimited list of the return values:
RESULT: OK|OK
CRYPT_VALUE: <decrypted text>|<decrypted text>
VALIDATE & ENCRYPT SINGLE CARD
The following code will validate & encrypt a single credit card number, using a 512bit key:
<cfx_pwcardcrypt action="validate_encrypt"
card_number="4242424242424242"
card_expiry_m="10"
card_expiry_y="05"
card_type="visa"
crypt_key="#public_key#"
key_length="512">
This would return the following variables:
RESULT: OK
CRYPT_VALUE: <encrypted text>
VALIDATE & ENCRYPT MULTIPLE CARDS
This code will validate & encrypt 3 card numbers, using a 1024 bit key:
<cfx_pwcardcrypt action="validate_encrypt"
card_number="424242,424242,123456"
card_expiry_m="10,12,03"
card_expiry_y="04,01,05"
card_type="visa,visa,visa"
crypt_key="#public_key#"
key_length="1024">
The result would contain a delimited list of the return values:
RESULT: OK,CARD_EXPIRED,INVALID_VISA_NUMBER
CRYPT_VALUE: <encrypted text>,CARD_EXPIRED,INVALID_VISA_NUMBER


