11.12.3.4.133. Function Se05x_API_WriteECKey

11.12.3.4.133.1. Function Documentation

smStatus_t Se05x_API_WriteECKey(pSe05xSession_t session_ctx, pSe05xPolicy_t policy, SE05x_MaxAttemps_t maxAttempt, uint32_t objectID, SE05x_ECCurve_t curveID, const uint8_t *privKey, size_t privKeyLen, const uint8_t *pubKey, size_t pubKeyLen, const SE05x_INS_t ins_type, const SE05x_KeyPart_t key_part)

Se05x_API_WriteECKey

Write or update an EC key object.

P1KeyPart indicates the key type to be created (if the object does not yet exist).

If P1KeyPart = P1_KEY_PAIR, Private Key Value (TLV[TAG_3]) and Public Key Value (TLV[TAG_4) must both be present, or both be absent. If absent, the key pair is generated in the SE05X .

If the object already exists, P1KeyPart is ignored.

Field

Value

Description

P1

SE05x_P1_t | P1_EC

See SE05x_P1_t , P1KeyType should only be set for new objects.

P2

P2_DEFAULT

See P2

Payload

TLV[TAG_POLICY]

Byte array containing the object policy. [Optional: default policy applies] [Conditional - only when the object identifier is not in use yet]

TLV[TAG_MAX_ATTEMPTS]

2-byte maximum number of attempts. If 0 is given, this means unlimited. [Optional: default unlimited] [Conditional: only when the object identifier is not in use yet and INS includes INS_AUTH_OBJECT; see AuthenticationObjectPolicies ]

TLV[TAG_1]

4-byte object identifier

TLV[TAG_2]

1-byte curve identifier, see ECCurve [Conditional: only when the object identifier is not in use yet; ]

TLV[TAG_3]

Private key value (see ECKeyRef ) [Conditional: only when the private key is externally generated and P1KeyType is either P1_KEY_PAIR or P1_PRIVATE]

TLV[TAG_4]

Public key value (see ECKeyRef ) [Conditional: only when the public key is externally generated and P1KeyType is either P1_KEY_PAIR or P1_PUBLIC]

TLV[TAG_11]

4-byte version [Optional]

Return

The sm status.

Parameters
  • [in] session_ctx: The session context

  • [in] policy: The policy

  • [in] maxAttempt: The maximum attempt

  • [in] objectID: The object id

  • [in] curveID: The curve id

  • [in] privKey: The priv key

  • [in] privKeyLen: The priv key length

  • [in] pubKey: The pub key

  • [in] pubKeyLen: The pub key length

  • [in] ins_type: The insert type

  • [in] key_part: The key part