AESKW key format for external keys
View the structure used to export an ECC or QSA private key when the ECC-AES1 or QSA-AES1 keyword is used with CSNDPKT. This key token is an external-only format and cannot be imported to CCA.
Offset (decimal) | Number of bytes | Field |
---|---|---|
Start of Associated Data section | ||
Sub-section: Header | ||
0 | 1 |
Primary Identifier: Value: X'53' (ASCII 'S') |
1 | 1 |
Version: Value: X'00' Version X‘00’ indicates AESKW wrapping method |
2 | 2 |
SL = structLen Value: dynamic, Length in bytes of the total structure (big endian). |
Sub-section: Key data | ||
4 | 1 | Algorithm type (algorithm for which the key can be used):
|
5 | 2 | Key type (general class of the key): Values in this field depend on the input token and the value at offset '0x4': Algorithm type. 1. ECC private key source token: Encoding:
Values :
2. QSA private key token: Encoding:
Values :
|
7 | 1 |
kuf_count: Key usage fields count: 0 - 4. Key-usage field information defines restrictions on
the use of the key. Notes:
Examples:
|
8 | 1 | Bit value meanings: Algorithm at offset 4; ECC (X’81’), QSA-CRYSTALS-Dilithium Round 2 (X'82'), QSA-CRYSTALS-Kyber Round 2 (X'83'), QSA-CRYSTALS-Dilithium Round 3 (X'84')
|
9 | 1 | Bit value meanings: Algorithm at offset 4; ECC (X’81’), QSA-CRYSTALS-Dilithium Round 2 (X'82'), QSA-CRYSTALS-Kyber Round 2 (X'83'), QSA-CRYSTALS-Dilithium Round 3 (X'84')
|
10 | 1 | This field is reserved and must be X'00' byte. |
11 | 1 | This field is reserved and must be X'00' byte. |
12 | 1 | This field is reserved and must be X'00' byte. |
13 | 1 | This field is reserved and must be X'00' byte. |
14 | 1 | This field is reserved and must be X'00' byte. |
15 | 1 | This field is reserved and must be X'00' byte. |
End of Associated Data section | ||
Start of AESKW wrapped payload | ||
16 | 6 |
Integrity Constant : byte array Value: X'A6A6A6A6A6A6' |
22 | 1 |
PbL: Zero Padding bit length, this padding is AFTER the key, at the end of the payload Value: dynamic, depends on KL and ADLen, see examples below |
23 | 1 |
ADLen: Associated Data byte length, in hex Value: X’10’ |
24 | 16 | Copy of Associated Data. The Associated Data is copied here after decryption. It must exactly match clear data as shown in the above Associated Data section of the AESKW key format structure. |
40 | KL | Keydata. Note: The size of the private key ‘p’ across all components is determined by the key
algorithm at offset 0x04 and the type field at offset 0x05.
Format of keydata
|
40 (con't) | KL |
|
KL+40 | PbL / 8 | Padding data: PbL count of 0b0 bits. |
End of AESKW wrapped payload | ||
KL+40+(PbL/8) | Final size (FS) = structLen Size of Keydata = KL = structLen – ((2 * 16) + 8 + (PbL / 8)) PbL (bits) = 64 – ((ADLen*8 + KL*8)mod64) = 64-((16*8 +KL*8)mod64) = 0 when (KL)mod8=0 FS = KL+40+(PbL/8) ECC: Actual KL values, Pbl values: 521 bit P521 : KL = 66 Bytes; PbL = 48 bits; FS = 112 bytes. This is the maximum for the largest exportable ECC key size. QSA CRYSTALS-Dilithium Round 2 (X’82’), Type (X'0605') KL = 3824; PbL = 0; FS = 3864 Bytes QSA CRYSTALS-Dilithium Round 2 (X'82'), Type (X'0807') KL = 5104; PbL = 0; FS = 5144 Bytes QSA CRYSTALS-Kyber Round 2 (X'83'), Type (X'0768') KL = 1216; PbL = 0; FS = 1256 Bytes QSA CRYSTALS-Kyber (X'83'), Type (X'1024') KL = 1600; PbL = 0; FS = 1640 Bytes QSA CRYSTALS-Dilithium Round 3 (X'84'), Type (X'0605') KL = 3968; PbL = 0; FS = 4008 Bytes QSA CRYSTALS-Dilithium Round 3 (X'84'), Type (X'0807') KL = 4832; PbL = 0; FS = 4872 Bytes QSA CRYSTALS-Kyber Round 3 (X'85'), Type (X'0768') KL = 1216; PbL = 0; FS = 1265 Bytes QSA CRYSTALS-Kyber Round 3 (X'85'), Type (X'1024') KL = 1600; PbL = 0; FS = 1640 Bytes |