Tools for Web Developers

PerthWeb Developer : Products

TextCrypt : Examples

GENERATE KEYS

This sample code will generate a set of crypto keys:

     <cfx _pwtextcrypt action="generate"
                       key_length="512">

The returned variables would contain:

     PRIVATE_KEY:  <private key>
     PUBLIC_KEY:   <public key>

ENCRYPT

This will encrypt the supplied text string, using a 512bit key. The #public_key# variable should contain the previously generated public key:

     <cfx_pwtextcrypt action="encrypt"
                      text="Sample Text String"
                      crypt_key="#public_key#"
                      key_length="512">

This would return the following variables:

     RESULT:      OK
     CRYPT_VALUE: <encrypted text>

DECRYPT

This code will decrypt the text passed in the #cyphertext# variable, based on the 512 bit private key stored in the #private_key# variable.

     <cfx_pwtextcrypt action="decrypt"
                      text="#cyphertext#"
                      crypt_key="#private_key#"
                      key_length="512">

This would return the following variables:

     RESULT:      OK
     CRYPT_VALUE: <decrypted text>