Import Key (QC3IMPKY, Qc3ImportKey) API


  Required Parameter Group:


 Service Program Name: QC3KYIMP

 Default Public Authority: *EXCLUDE

 Threadsafe: Yes

The Import Key (OPM, QC3IMPKY; ILE, Qc3ImportKey) API encrypts a key under the specified master key.


Authorities and Locks

None.


Required Parameter Group

Key string
INPUT; CHAR(*)

The key to be encrypted under a master key. This can be a symmetric key or a PKA private key.

Length of key string
INPUT; BINARY(4)

Length of the key string specified in the key string parameter.

Key form
INPUT; CHAR(1)

An indicator specifying if the key string parameter is in encrypted form.


Key-encrypting key context token
INPUT; CHAR(8)

The key context token specifying the key for decrypting the key string parameter. If the key string parameter is not encrypted (key form parameter is 0), this parameter must be set to blanks or the pointer to this parameter set to NULL.

Key-encrypting algorithm context token
INPUT; CHAR(8)

The algorithm context token specifying the algorithm for decrypting the key string parameter. If the key string parameter is not encrypted (key form parameter is 0), this parameter must be set to blanks or the pointer to this parameter set to NULL.

Master key ID
INPUT; BINARY(4)

The master key under which the specified key will be encrypted. For more information about master keys, refer to Cryptographic Services Master Keys. The master key IDs are


Disallowed function
INPUT; BINARY(4)

This parameter specifies the functions that cannot be used with this key. The values listed below can be added together to disallow multiple functions. For example, to disallow everything but MACing, set the value to hex 11. This value should be saved along with the encrypted key value because it will be required when the encrypted key value is used on an API.


Master key KVV
OUTPUT; CHAR(20)

The key verification value of the master key that was used to encrypt the key. This value should be saved along with the encrypted key value. When the encrypted key value is used on an API and the KVV is supplied, the API will be able to determine which version of the master key should be used to decrypt the key.

Imported key
OUTPUT; CHAR(*)

The area to store the imported key.

Length of area provided for imported key
INPUT; BINARY(4)

The length of the imported key parameter.
To ensure sufficient space, specify an area as large as the clear key string length plus space for padding. The key string will be encrypted using AES with a 32-byte block size. Therefore, the clear key string length will always be padded out to the next 32-byte boundary before encrypting.

Length of imported key returned
OUTPUT; BINARY(4)

The length of the imported key returned in the imported key parameter.
If the length of area provided for the imported key is too small, an error will be generated and no data will be returned in the imported key parameter.

Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter.


Error Messages




API introduced: V5R4

[ Back to top | Cryptographic Services APIs | APIs by category ]