11.12.3.4.128. Function Se05x_API_TLSCalculatePreMasterSecret

11.12.3.4.128.1. Function Documentation

smStatus_t Se05x_API_TLSCalculatePreMasterSecret(pSe05xSession_t session_ctx, uint32_t keyPairId, uint32_t pskId, uint32_t hmacKeyId, const uint8_t *inputData, size_t inputDataLen)

Se05x_API_TLSCalculatePreMasterSecret

The command TLSCalculatePreMasterSecret will compute the pre-master secret for TLS according [RFC5246]. The pre-master secret will always be stored in an HMACKey object (TLV[TAG_3]). The HMACKey object must be created before; otherwise the calculation of the pre-master secret will fail.

It can use one of these algorithms: - - - -

  • PSK Key Exchange algorithm as defined in [RFC4279]

  • RSA_PSK Key Exchange algorithm as defined in [RFC4279]

  • ECDHE_PSK Key Exchange algorithm as defined in [RFC5489]

  • EC Key Exchange algorithm as defined in [RFC4492]

  • RSA Key Exchange algorithm as defined in [RFC5246]

TLV[TAG_1] needs to be an (existing) HMACKey identifier containing the pre- shared Key.

Input data in TLV[TAG_4] are:

  • An EC public key when TLV[TAG_2] refers to an EC key pair.

  • An RSA encrypted secret when TLV[TAG_2] refers to an RSA key pair.

  • Empty when TLV[TAG_2] is absent or empty.

Command to Applet

Field

Value

Description

CLA

0x80

INS

INS_CRYPTO

See SE05x_INS_t

P1

P1_TLS

See SE05x_P1_t

P2

P2_PMS

See SE05x_P2_t

Lc

#(Payload)

TLV[TAG_1]

4-byte PSK identifier referring to a 16, 32, 48 or 64-byte Pre Shared Key. [Optional]

TLV[TAG_2]

4-byte key pair identifier. [Optional]

TLV[TAG_3]

4-byte target HMACKey identifier.

TLV[TAG_4]

Byte array containing input data.

Le

R-APDU Body

NA

R-APDU Trailer

SW

Description

SW_NO_ERROR

The command is handled successfully.

Parameters
  • [in] session_ctx: Session Context [0:kSE05x_pSession]

  • [in] keyPairId: keyPairId [1:kSE05x_TAG_1]

  • [in] pskId: pskId [2:kSE05x_TAG_2]

  • [in] hmacKeyId: hmacKeyId [3:kSE05x_TAG_3]

  • [in] inputData: inputData [4:kSE05x_TAG_4]

  • [in] inputDataLen: Length of inputData