GetKeyParam

(Engine-Level Function)

Description: The CryptGetKeyParam function retrieves data that governs the operations of a key. It is the VTScada analog of the CryptoAPI’s CryptGetKeyParam call.
Returns: Varies
Usage: Script Only.
Function Groups: Cryptography
Related to: DeriveKey | Decrypt | Encrypt | ExportKey | GenerateKey | GetCryptoProvider | ImportKey | SetKeyParam
Format: GetKeyParam(Key, Param [, Flags, Error])
Parameters:  
Key
Required. The handle to the key being queried.
Param

Required. A parameter specifying the query being made.

CAPI (Cryptography API) providers are specified using numeric identifiers. Values are defined in WinCrypt.h

CNG (Cryptography New Generation) algorithm providers are specified using text identifiers.

Flags
An optional parameter specifying the flags to be passed to CryptGetKeyParam. If omitted or invalid then the value 0 is used.
Error
An optional variable in which the error code for the function is returned. It may have the following values

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);
  ]
]