Key Functions

Table 20.15 lists the crypto API key functions. CryptGenRandom is very useful for coming up with keys to be used with symmetric-key algorithms. Remember that you need to save your generated keys somewhere; saving is not done for you automatically. The proper way to save a key is to create an exportable version of it using CryptExportKey, then use CryptImportKey when you need to read it back from disk.

Table 20.15: Key Functions

Function Description
CryptDestroyKey Destroys a given key.
CryptExportKey Converts a key from the CSP into a key blob that can be safely shared or saved to disk.
CryptGenRandom Generates some random data. (Used for salt bits.)
CryptGetKeyParam Retrieves the parameters for a given key.
CryptGetUserKey Retrieves a handle to an exchange key or a signature key.
CryptImportKey Converts a key blob into a key usable by a CSP.
CryptSetKeyParam Sets the parameters for a key.

© 1998 SYBEX Inc. All rights reserved.