Description
Gets a secure key value for use in the Encrypt function.
Returns
A string that contains the encryption key.
Category
Security functions, String functions
Function syntax
GenerateSecretKey(algorithm [,keysize]) |
See also
History
ColdFusion 8: Added the keysize parameter.
ColdFusion MX 7: Added this function.
Parameters
Parameter |
Description |
---|---|
algorithm |
The encryption algorithm for which to generate the key. ColdFusion installs a cryptography library with the following algorithms:
|
keysize |
Number of bits requested in the key for the specified algorithm.You can use this to request longer keys when allowed by the JDK. For example, the AES algorithm keys are limited to 128 bits unless the Java Unlimited Strength Jurisdiction Policy Files are installed. For more information, see http://java.sun.com/products/jce/index-14.html. |
Usage
You cannot use the GenerateSecretKey function to generate a key for the ColdFusion default encryption algorithm (CFMX_COMPAT) of the Encrypt and Decrypt functions.
ColdFusion uses the Java Cryptography Extension (JCE) and installs a Sun Java runtime that includes the Sun JCE default security provider. This provider includes the algorithms listed in the Parameters section. The JCE framework includes facilities for using other provider implementations; however, Adobe cannot provide technical support for third-party security providers.
Example
<cfscript> myAESKey=generateSecretKey(("AES"),128) writeOutput(myAESKey) // wepMrwBJxutMBSS8lBRykQ== </cfscript>