The Encrypt Data (OPM, QC3ENCDT; ILE, Qc3EncryptData) API
protects data privacy by scrambling clear data into an unintelligible form. To
recover the clear data from the encrypted data, use the
Decrypt Data (OPM, QC3DECDT; ILE, Qc3DecryptData) API.
- Clear data
- INPUT; CHAR(*)
The data to encrypt.
The format of the clear data is specified in the clear data format name
parameter
- Length of clear data
- INPUT; BINARY(4)
For clear data format DATA0100, this is the length of the data to encrypt.
For restrictions on the length of clear data, refer to the clear data length
field below.
For clear data format DATA0200, this is the number of entries in the array.
- Clear data format name
- INPUT; CHAR(8)
The format of the clear data parameter.
The possible format names follow.
- DATA0100
- The clear data parameter contains the data to encrypt.
- DATA0200
- The clear data parameter contains an array of pointers and lengths to the
data to encrypt.
See Clear Data Formats for a description of this
format.
- Algorithm description
- INPUT; CHAR(*)
The algorithm and associated parameters for encrypting the data.
The format of the algorithm description is specified in the algorithm
description format name parameter.
- Algorithm description format name
- INPUT; CHAR(8)
The format of the algorithm description.
The possible format names follow.
- ALGD0100
- The token for an algorithm context. This format must be used when
performing the encrypt operation over multiple calls. After the last call (when
the final operation flag is on), the context will reset to its initial state
and can be used in another API. To create an algorithm context, use
the Create Algorithm Context (OPM, QC3CRTAX; ILE,
Qc3CreateAlgorithmContext) API.
- ALGD0200
- Parameters for a block cipher algorithm (DES, Triple DES, AES, and
RC2).
- ALGD0300
- Parameters for a stream cipher algorithm (RC4-compatible).
- ALGD0400
- Parameters for a public key algorithm (RSA).
See Algorithm Description Formats for a description of
these formats.
- Key description
- INPUT; CHAR(*)
The key to use for encrypting the data.
The format of the key description is specified in the key description format
name parameter.
If the encrypt operation extends over multiple calls (see ALGD0100 description above), only the key description from the first call will be used. Therefore, on subsequent calls, you may set the pointer to this parameter to NULL.
- Key description format name
- INPUT; CHAR(8)
The format of the key description.
If the pointer to the key description parameter is NULL, this parameter will be ignored.
The possible format names follow.
- KEYD0100
- Key context token. This format identifies a key context. A key context is
used to store a key value so it need not be recreated or retrieved every time it
is used. To create a key context, use the
Create Key Context (OPM, QC3CRTKX;
ILE, Qc3CreateKeyContext) API.
- KEYD0200
- Key parameters.
![Start of change](delta.gif)
- KEYD0400
- Key store label. This format identifies a key from key store.
For more information on cryptographic services key store, refer to the
Cryptographic Services Key Store article.
- KEYD0500
- PKCS5 passphrase. This format derives a key using RSA Data Security,
Inc. Public-Key Cryptography Standard (PKCS) #5.
- KEYD0600
- PEM certificate. This format uses the PKA key in an ASCII encoded
PEM based certificate.
- KEYD0700
- Certificate label. This format uses the public PKA key identified by a
label into system certificate key store (*SYSTEM).
- KEYD0800
- Distinguished name. This format uses the public PKA key identified by a
distinguished name for a certificate in system certificate key store
(*SYSTEM).
- KEYD0900
- Application identifier. This format uses the private PKA key identified by
an application identifier. The application identifier must be assigned to a
valid certificate label in system certificate key store (*SYSTEM).
![End of change](deltaend.gif)
See Key Description Formats for a description of these
formats.
- Cryptographic service provider
- INPUT; CHAR(1)
The cryptographic service provider (CSP) that will perform the encryption
operation.
0 |
Any CSP.
The system will choose an appropriate CSP to perform the encryption
operation. |
1 |
Software CSP.
The system will perform the encryption operation using software. If the
requested algorithm is not available in software, an error is returned. |
2 |
Hardware CSP.
The system will perform the encryption operation using cryptographic hardware.
If the requested algorithm is not available in hardware, an error is returned.
A specific cryptographic device can be specified using the cryptographic device
name parameter. If the cryptographic device is not specified, the system will
choose an appropriate one. |
- Cryptographic device name
- INPUT; CHAR(10)
The name of a cryptographic device description.
This parameter is valid when the cryptographic service provider parameter
specifies 2 (hardware CSP). Otherwise, this parameter must be blanks or the
pointer to this parameter set to NULL.
- Encrypted data
- OUTPUT; CHAR(*)
The area to store the encrypted data.
- Length of area provided for encrypted data
- INPUT; BINARY(4)
The length of the encrypted data parameter.
If the mode of operation is CFB 1-bit, this length must be specified in bits.
If the length of area provided for encrypted data is too small, an error will
be generated and no data will be returned in the encrypted data parameter.
-
Block ciphers |
The encrypted data parameter must be
greater than or equal to the length of clear data. If padding and performing
final processing, the encrypted data parameter must be large enough to include
the pad characters. For more information, refer to the pad option
description. |
Stream ciphers |
The encrypted data parameter must be
greater than or equal to the length of clear data. |
PKA ciphers |
The encrypted data parameter must be
greater than or equal to the key size. |
- Length of encrypted data returned
- OUTPUT; BINARY(4)
The length of encrypted data returned in the encrypted data parameter.
If the mode of operation is CFB 1-bit, this length will be returned in bits.
- Error code
- I/O; CHAR(*)
The structure in which to return error information.
For the format of the structure, see Error Code
Parameter.
Message ID |
Error Message Text |
CPF24B4 E |
Severe error while addressing parameter list. |
CPF3C1E E |
Required parameter &1 omitted. |
CPF3CF1 E |
Error code parameter not valid. |
CPF3CF2 E |
Error(s) occurred during running of &1
API. |
CPF9872 E |
Program or service program &1 in library &2 ended. Reason code &3. |
![Start of change](delta.gif) |
CPF9D99 E |
Error openning certificate store. |
CPF9D9A E |
Key is protected by a cryptographic coprocessor. |
CPF9D9B E |
Internal error occured retrieving key from system certificate store. |
CPF9D9C E |
Function is disallowed with specified key context. |
CPF9D9F E |
Not authorized to key store file. |
CPF9DA0 E |
Error occured opening key store file. |
CPF9DA1 E |
Key record not found. |
CPF9DA2 E |
Option 34 is not installed. |
CPF9DA3 E |
Not authorized to use APPIDs. |
CPF9DA4 E |
APPID is not valid. |
CPF9DA5 E |
Key store file not found. |
CPF9DA6 E |
The key store file is not available. |
CPF9DA7 E |
File is corrupt or not a valid key store file. |
CPF9DA8 D |
The application identifier length is not valid. |
CPF9DA9 D |
The format of the PEM certificate is not valid. |
CPF9DAA D |
A key requires translation. |
CPF9DAB E |
A key can not be decrypted. |
CPF9DB1 E |
The CCSID is not valid. |
CPF9DB3 E |
Qualified key store file name not valid. |
CPF9DB6 E |
Record label not valid. |
CPF9DB8 E |
Error occured retrieving key record from key store. |
CPF9DBA E |
Derived key length not valid. |
CPF9DBB E |
Iteration count not valid. |
CPF9DBC E |
Salt length not valid. |
CPF9DBD E |
Passphrase length not valid. |
CPF9DBE E |
PEM certificate length not valid. |
CPF9DBF E |
Certificate label length not valid. |
CPF9DC0 E |
Distinghished name length not valid. |
CPF9DC2 E |
Key-encrypting algorithm context not compatible with key-encrypting key context. |
CPF9DC3 E |
Unable to decrypt data or key. |
![End of change](deltaend.gif) |
CPF9DC6 E |
Algorithm not valid for encrypting or decrypting a key. |
CPF9DC8 E |
The input data parameter specifies a NULL pointer. |
CPF9DC9 E |
The total length of data in the input data array is not valid. |
CPF9DCE E |
A data length is not valid. |
CPF9DCF E |
A data pointer is not valid. |
CPF9DD0 E |
Clear data format name not valid. |
CPF9DD2 E |
Algorithm description format name not valid. |
CPF9DD3 E |
Key description format name not valid. |
CPF9DD4 E |
Length of clear data not valid. |
CPF9DD6 E |
Length of area provided for output data is too small. |
CPF9DD7 E |
The key-encrypting key context for the specified key is not valid or was previously destroyed. |
CPF9DD8 E |
The key-encrypting algorithm context for the specified key is not valid or was previously destroyed. |
CPF9DD9 E |
Effective key size not valid. |
CPF9DDA E |
Unexpected return code &1. |
CPF9DDB E |
The key string or Diffie-Hellman parameter string is not valid. |
CPF9DDD E |
The key string length is not valid. |
CPF9DDE E |
Cipher algorithm not valid. |
CPF9DDF E |
Block length not valid. |
CPF9DE0 E |
Hash algorithm not valid. |
CPF9DE1 E |
Initialization vector not valid. |
CPF9DE2 E |
MAC (message authentication code) length not valid. |
CPF9DE3 E |
Mode not valid. |
CPF9DE4 E |
Pad option not valid. |
CPF9DE5 E |
PKA (public key algorithm) block format not valid. |
CPF9DE6 E |
Public key algorithm not valid. |
CPF9DE7 E |
Key type not valid. |
CPF9DE9 E |
Key format not valid. |
CPF9DEC E |
Cryptographic service provider not valid. |
CPF9DED E |
Final operation flag not valid. |
CPF9DEE E |
Reserved field not null. |
CPF9DF0 E |
Operation, algorithm, or mode not available on the requested CSP (cryptographic service provider). |
CPF9DF1 E |
The algorithm context token does not reference a valid algorithm context. |
CPF9DF2 E |
The algorithm context is not found or was previously destroyed. |
CPF9DF3 E |
Algorithm in algorithm context not valid for requested operation. |
CPF9DF4 E |
The key context token does not reference a valid key context. |
CPF9DF5 E |
The key context is not found or was previously destroyed. |
CPF9DF7 E |
Algorithm context not compatible with key context. |
CPF9DF8 E |
Cryptographic device name not valid. |
CPF9DF9 E |
Cryptographic device not found. |
CPF9DFA E |
Multiple-block encryption not valid with the requested mode. |
CPF9DFB E |
Cryptographic service provider (CSP) conflicts with the key context CSP. |
CPF9DFD E |
Not authorized to device. |
CPF9DFE E |
Cryptographic device not available. |