11.12.3.4.107. Function Se05x_API_PBKDF2¶
Defined in File se05x_APDU_apis.h
11.12.3.4.107.1. Function Documentation¶
-
smStatus_t
Se05x_API_PBKDF2
(pSe05xSession_t session_ctx, uint32_t objectID, const uint8_t *salt, size_t saltLen, uint16_t count, uint16_t requestedLen, uint8_t *derivedSessionKey, size_t *pderivedSessionKeyLen)¶ Se05x_API_HKDF_Extended
Only step 2 of the algorithm is executed, i.e. Expand only.
Using an IV as input parameter results in a FIPS compliant SP800-108 KDF in Feedback Mode where K[0] is the provided IV. This KDF is then using a 8-bit counter, AFTER_FIXED counter location.
Command to Applet
Field
Value
Description
CLA
0x80
INS
INS_CRYPTO
P1
P1_DEFAULT
See
SE05x_P1_t
P2
P2_HKDF_EXPAND_ONLY
See
SE05x_P2_t
Lc
#(Payload)
Payload
TLV[TAG_1]
4-byte HMACKey identifier (= PRK)
TLV[TAG_2]
1-byte DigestMode (except DIGEST_NO_HASH)
TLV[TAG_3]
Byte array (0-64 bytes) containing IV. [Optional] [Conditional: only when TLV[TAG_6] is absent.]
TLV[TAG_4]
Info: The context and information to apply (1 to 80 bytes). [Optional]
TLV[TAG_5]
2-byte requested length (L): 1 up to MAX_APDU_PAYLOAD_LENGTH
TLV[TAG_6]
4-byte HMACKey identifier containing IV. [Optional] [Conditional: only when TLV[TAG_3] is absent]
TLV[TAG_7]
4-byte HMACKey identifier to store output. [Optional]
Le
0x00
R-APDU Body
Value
Description
TLV[TAG_1]
HKDF output. [Conditional: only when the input does not contain TLV[TAG-7]]
R-APDU Trailer
SW
Description
SW_NO_ERROR
The HKDF is executed successfully.
/
- smStatus_t Se05x_API_HKDF_Extended(pSe05xSession_t session_ctx,
uint32_t hmacID, SE05x_DigestMode_t digestMode, SE05x_HkdfMode_t hkdfMode, const uint8_t salt, size_t saltLen, uint32_t saltID, const uint8_t info, size_t infoLen, uint32_t derivedKeyID, uint16_t deriveDataLen, uint8_t hkdfOuput, size_t phkdfOuputLen);
/ * Se05x_API_PBKDF2
Password Based Key Derivation Function 2 (PBKDF2) according [RFC8018].
The password is an input to the KDF and must be stored inside the .
The output is returned to the host.
# Command to Applet
verbatim embed:rst:leading-asterisk +——-+————+———————————————-+ | Field | Value | Description | +=======+============+==============================================+ | CLA | 0x80 | | +——-+————+———————————————-+ | INS | INS_CRYPTO |
SE05x_INS_t
| +——-+————+———————————————-+ | P1 | P1_DEFAULT | SeeSE05x_P1_t
| +——-+————+———————————————-+ | P2 | P2_PBKDF | SeeSE05x_P2_t
| +——-+————+———————————————-+ | Lc | #(Payload) | | +——-+————+———————————————-+ | | TLV[TAG_1] | 4-byte password identifier (object type must | | | | be HMACKey) | +——-+————+———————————————-+ | | TLV[TAG_2] | Salt (0 to 64 bytes) [Optional] | +——-+————+———————————————-+ | | TLV[TAG_3] | 2-byte Iteration count: 1 up to 0x7FFF. | +——-+————+———————————————-+ | | TLV[TAG_4] | 2-byte Requested length: 1 up to 512 bytes. | +——-+————+———————————————-+ | Le | 0x00 | Expecting derived key material. | +——-+————+———————————————-+R-APDU Body
Value
Description
TLV[TAG_1]
Derived key material (session key).
R-APDU Trailer
SW
Description
SW_NO_ERROR
The command is handled successfully.
- Parameters
[in] session_ctx
: Session Context [0:kSE05x_pSession][in] objectID
: 4-byte password identifier (object type must be HMACKey) [1:kSE05x_TAG_1][in] salt
: salt [2:kSE05x_TAG_2][in] saltLen
: Length of salt[in] count
: count [3:kSE05x_TAG_3][in] requestedLen
: requestedLen [4:kSE05x_TAG_4][out] derivedSessionKey
: [0:kSE05x_TAG_1][inout] pderivedSessionKeyLen
: Length for derivedSessionKey