Creates a symmetric cryptographic key of the specified algorithm and size.
If the current CSP is the Microsoft Base Cryptographic Provider, Algorithm
can be set to one of the following values: calgRC2 (default) and calgRC4 for the RC2 and RC4 algorithms, respectively.
If the current CSP is the Microsoft Enhanced Cryptographic Provider, Algorithm
can also be set to one of the following values: calgDES, calg3DES and calg3DES2
for the DES, Triple DES, and Triple DES with 2 Keys algorithms,
respectively. If the current CSP is the "Microsoft Enhanced RSA and AES Cryptographic Provider (Prototype)" (XP)
or "Microsoft Enhanced RSA and AES Cryptographic Provider" (Windows 2003),
Algorithm can also be set to calgAES128, calgAES192 and calgAES256
for 128-bit, 192-bit and 256-bit AES keys, respectively (AspEncrypt 2.3+ is required for AES support).
If BitSize is set to 0 (default value) it means the
key size is the default one for the specified algorithm and current CSP.
Otherwise, it specifies the key size. For the list of algorithms
and their respective default and valid key sizes,
see Learn About Windows Cryptography.
Return Value: a CryptoKey object containing the newly created key.
Usage:
Set Key = Context.GenerateKey(calgRC4)
Related Task: Encrypt and Decrypt Files and Messages.