GetKeyParam

Purpose:                    The CryptGetKeyParam function retrieves data that governs the operations of a key. It is the VTS analog of the CryptoAPI CryptGetKeyParam call.

Returns:                    Varies

Usage:                       Script

Format:                      GetKeyParam(Key, Param [, Flags, Error])

Parameters:             Key     { handle }  { required }  { no default }

                                              The handle to the key being queried.

                                    Param     { numeric }  { required }  { no default }

                                              A parameter specifying the query being made. Values are defined in WinCrypt.h

                                    Flags     { numeric }  { optional }  { default: 0 }

                                              An optional parameter specifying the flags to be passed to CryptGetKeyParam. If omitted or invalid then the value 0 is used.

                                    Error     { numeric }  { optional }  { 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 returned.

1

Key or Param parameters invalid.

x

Any other value is an error from CryptGetKeyParam.

 

Comments:               The parameter for the key is returned. If an error occurs, the return value is invalid.

                             The allowable values for Param vary with the key type.

Example:

[

  KeyG; 

  Constant KP_G = 12 { DSS/Diffie-Hellman G value }; 

]

Init [

If 1 Main; 

  [ 

    { Get the key parameter } 

    KeyG = GetKeyParam(Key1, KP_G); 

  ] 

]

See Also:

DeriveKey | Decrypt | Encrypt | ExportKey | GenerateKey | GetCryptoProvider | ImportKey | SetKeyParam