Purpose: The SetKeyParam function customizes various aspects of a session key's operations. The values set by this function are not persisted to memory and can only be used with in a single session. It is the VTS analog of the CryptoAPI SetKeyParam call.
Returns: Nothing
Usage: Script
Format: SetKeyParam(Key, Param [, Value, Flags, Error])
Parameters: Key { Handle } { required } { no default: }
The handle to the key for which values are to be set.
Param { varies } { required } { no default: }
A parameter specifying the value to be set. Values are defined in WinCrypt.h
Value { varies } { optional } { default: 0 }
An optional parameter containing the value to which the keys parameter is to be set. If omitted or invalid then the value 0 is used.
Flags { numeric } { optional } { default: 0 }
An optional parameter specifying the flags to be passed to CryptSetKeyParam. If omitted or invalid then the value 0 is used.
Error { numeric } { required } { no default: }
An optional variable in which the error code for the function is returned. It has the following meaning:
|
Error |
Meaning |
|
0 |
Key parameter successfully set. |
|
1 |
Key or Param or Value parameters invalid. |
|
X |
Any other value is an error from CryptSetKeyParam. |
Comments: The allowable values for Param vary with the key type.
Example:
[
Constant KP_G = 12 { DSS/Diffie-Hellman G value };
]
Init [
If 1 Main;
[
{ Set the key parameter }
SetKeyParam(Key2, KP_G, KeyG);
]
]
See Also:
DeriveKey | Decrypt | Encrypt | ExportKey | GenerateKey | GetCryptoProvider | GetKeyParam | ImportKey