GENERATE-PBE-KEY function
- Last Updated: February 11, 2026
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
PBKDF2, then a PBKDF2 key
derivation algorithm approved by the National Institute of Standards and Technology (NIST)
is used instead.Syntax
|
- password
- The password (a binary value) to use in generating the encryption key.
This value may be of type CHARACTER, LONGCHAR, RAW, or MEMPTR. If the password contains
a CHARACTER or LONGCHAR value, the AVM converts it to UTF-8 (which maintains a
consistent value regardless of code page settings) before using it to generate the
encryption key. To avoid this automatic conversion, specify a RAW or MEMPTR value. If
you specify the Unknown value (
?), the result is the Unknown value (?). - salt
- An optional RAW expression that evaluates to the salt value (a random
series of bytes) to use in generating the encryption key. If you specify the Unknown
value (
?), the current value of theENCRYPTION-SALTattribute is used. If no salt value is specified in theENCRYPTION-SALTattribute, no salt value is used.The salt length is 8 bytes if
PBE-ALGORITHMisLegacyand up to 512 bytes ifPBE-ALGORITHMisPBKDF2.You can also use the
GENERATE-PBE-SALTorGENERATE-SALTfunctions to generate a salt value, which helps promote the uniqueness of the password key value.If specified, this salt value is combined with the password value and hashed some number of times to generate a password-based encryption key (using the algorithm specified by the
PBE-HASH-ALGORITHMattribute and the number of iterations specified by thePBE-KEY-ROUNDSattribute).Note: If FIPS mode is enabled,GENERATE-PBE-KEYrequires a 16 to 512-byte salt value, whether specified using the salt parameter, or set through theENCRYPTION-SALTattribute. ThePBE-ALGORITHMattribute must also be set toPBKDF2.
Notes
- You are responsible for generating, storing, and transporting these values.
- The size of the generated encryption key is determined by the
cryptographic algorithm specified by the
SYMMETRIC-ENCRYPTION-ALGORITHMattribute. - Before invoking this function, be sure to set the
PBE-HASH-ALGORITHMattribute to the name of the hash algorithm to use. - If you call this function multiple times with the same password string, hash algorithm, number of iterations, and salt value, the same binary key is generated each time.
- If
PBE-ALGORITHMis set toPBKDF2, the hashing algorithms specified inPBE-HASH-ALGORITHMandSYMMETRIC-ENCRYPTION-ALGORITHMmust be approved by the National Institute of Standards and Technology (NIST). - If FIPS mode is enabled and a non NIST-approved algorithm is set, the AVM generates a run-time error.
See also
GENERATE-PBE-SALT function, GENERATE-SALT function, GENERATE-RANDOM-KEY function, MESSAGE-DIGEST function, PBE-ALGORITHM attribute, PBE-HASH-ALGORITHM attribute, SECURITY-POLICY system handle, SYMMETRIC-ENCRYPTION-ALGORITHM attribute