Crypt

 

 

Properties

cryptalgorithm=<string>

Selects the encryption algorithm for encrypting and decrypting. Possible values are: "pki", "aes", "rijndael", "blowfish", "blowfish2", "des", "3des", "rc2", "arc4", "twofish", "pbes1" and "pbes2". The "pki" encryption algorithm isn't a specific algorithm, but instead tells the component to encrypt/decrypt using public-key encryption with digital certificates. The other choices, rijndael, blowfish, and twofish, are symmetric encryption algorithms that do not involve digital certificates and public/private keys.

 

The original Chilkat implementation of Blowfish has a 4321 byte-swapping issue (the results are 4321 byte-swapped). The new implementation ("blowfish2") does not byte swap. This should be used for compatibility with other Blowfish software.

 

Password-based encryption (PBE) is selected by setting this property to "pbes1" or "pbes2". Password-based encryption is defined in the PKCS5 Password-Based Cryptography Standard at http://www.rsa.com/rsalabs/node.asp?id=2127. If PBE is used, the underlying encryption algorithm is specified by the PbesAlgorithm property.

encodingmode=<string>

Controls the encoding of binary data to a printable string for many methods. The valid modes are "Base64", "QP" (for quoted-printable), "URL" (for url-encoding), and "Hex".

 

Function

compressstringenc=<string>

Compresses a string and returns an encoded string of the compressed data. The string input argument is Unicode. The Charset property controls the conversion of the Unicode string to a multibyte string before compression is applied. For example, if Charset is set to "iso-8859-1", then the input string argument is first converted from Unicode (2 bytes per char) to iso-8859-1 (1 byte per char) before compressing according to the CompressionAlgorithm property ("BZIP2"). If the Charset property is set to "unicode", then no character encoding conversion will happen, and the full Unicode string is compressed.

 

Compressed data is typically binary data which is not a printable string. This method encodes the output compressed data to a printable string according to the EncodingMode property, which can be set to "Base64", "QP" (for quoted-printable), or "Hex".

 

return in variable "value"

 

example

declare=cypt=ue_api_chilkat=crypt
crypt=init
crypt=cryptalgorithm=none
crypt=encodingmode=base64
setvar=ls_var=Hello World
crypt=compressstringenc=<ls_var>
messagebox=<value>
destroy=crypt

 

inflatestringenc=<string>

The opposite of CompressStringENC. The Charset, EncodingMode, and CompressionAlgorithm properties should match what was used when compressing.

 

return in variable: value

encryptstring=<string>

Encrypts a string and returns the encrypted data as a byte array. The minimal set of properties that should be set before encrypting are: CryptAlgorithm, SecretKey, Charset. Other properties that control encryption are: CipherMode, PaddingScheme, KeyLength, IV. When decrypting, all property settings must match otherwise garbled data is returned. The Charset property controls the exact bytes that get encrypted. be.as work with Unicode strings, thus the input string is Unicode. If Unicode is to be encrypted (i.e. 2 bytes per character) then set the Charset property to "Unicode". To implicitly convert the string to another charset before the encryption is applied, set the Charset property to something else, such as "iso-8859-1", "Shift_JIS", "big5", "windows-1252", etc. The complete list of possible charsets is listed here: Crypt_Charset

 

return in variable: value

encryptstringenc

Encrypts a string and returns the encrypted data as an encoded (printable) string. The minimal set of properties that should be set before encrypting are: CryptAlgorithm, SecretKey, Charset, and EncodingMode. Other properties that control encryption are: CipherMode, PaddingScheme, KeyLength, IV. When decrypting (with DecryptStringENC), all property settings must match otherwise garbled data is returned. The Charset property controls the exact bytes that get encrypted. be.as work with Unicode strings, thus the input string is Unicode. If Unicode is to be encrypted (i.e. 2 bytes per character) then set the Charset property to "Unicode". To implicitly convert the string to another charset before the encryption is applied, set the Charset property to something else, such as "iso-8859-1", "Shift_JIS", "big5", "windows-1252", etc. The complete list of possible charsets is listed here: Crypt_Charset

 

The EncodingMode property controls the encoding of the string that is returned. It can be set to "Base64", "QP", or "Hex".

 

return in variable: value

 

example

declare=crypt=ue_api_chilkat=crypt
crypt=init
crypt=cryptalgorithm=none
crypt=encodingmode=base64
setvar=ls_var=Hello World
crypt=encryptstringenc=<ls_var>
messagebox=<value>
destroy=crypt

decryptstringenc=<string>

The reverse of EncryptStringENC.

 

Decrypts string-encoded encrypted data and returns the original string. The property settings used when encrypting the string must match the settings when decrypting. Specifically, the Charset, EncodingMode, CryptAlgorithm, CipherMode, PaddingScheme, KeyLength, IV, and SecretKey properties must match.

 

return in variable: value

 

example

declare=crypt=ue_api_chilkat=crypt
crypt=init
crypt=cryptalgorithm=none
crypt=encodingmode=base64
setvar=ls_var=Hello World
crypt=encryptstringenc=<ls_var>
setvar=ls_crypt=<value>
messagebox=Encripted: <ls_crypt>
crypt=decryptstringenc=<ls_crypt>
messagebox=Decripted: <value>
destroy=crypt

 

reencode=

 <fromstring>=<fromcode>=<tocode>

Provides a means for converting from one encoding to another (such as base64 to hex). This is helpful for programming environments where byte arrays are a real pain-in-the-***. The fromEncoding and toEncoding may be "base64", "hex", "quoted-printable" (or "qp"), or "url".

 

return in variable: value

cryptpassword=<password>[=<salt>]

This method creates a hash for the given password. If a salt is passed, it's used in the hash algorithm. If there was not salt passed, the method generates a random salt and save it to <ls_salt>.