Previous Next

ENCRYPT function
Converts source data into a particular format, and returns a MEMPTR containing the encrypted data (a binary byte stream).
Note:
Syntax 
 
ENCRYPT ( data-to-encrypt [ , encrypt-key [ , iv-value [ , algorithm ] ] ] )
data-to-encrypt
The source data to encrypt. The value may be of type CHARACTER, LONGCHAR, RAW, or MEMPTR.
encrypt-key
An optional RAW expression that evaluates to the name of the encryption key (a binary value) to use in encrypting the specified data. If you specify the Unknown value (?), the current value of the SYMMETRIC-ENCRYPTION-KEY attribute is used. If the value of the SYMMETRIC-ENCRYPTION-KEY attribute is also the Unknown value (?), the AVM generates a run-time error.
You can generate this encryption key, based on the PKCS#5/RFC 2898 standard, by using either the GENERATE-PBE-KEY function or the GENERATE-RANDOM-KEY function.
Note:
The AVM compares the size of the specified encryption key to the key size specified by the cryptographic algorithm. If the key sizes are inconsistent, the AVM generates a run-time error.
You are responsible for generating, storing, and transporting this value.
iv-value
An optional RAW expression that evaluates to an initialization vector value to use with the specified encryption key in the encryption operation. Using an initialization vector value increases the strength of the specified encryption key (that is, it makes the key more unpredictable). If you specify the Unknown value (?), the current value of the SYMMETRIC-ENCRYPTION-IV attribute is used.
algorithm
An optional CHARACTER expression that evaluates to the name of the symmetric cryptographic algorithm to use in encrypting the specified data instance. If you specify the Unknown value (?), the current value of the SYMMETRIC-ENCRYPTION-ALGORITHM attribute is used.
For a list the supported cryptographic algorithms, see the SYMMETRIC-SUPPORT attribute reference entry.
See also 
DECRYPT function, SECURITY-POLICY system handle

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.