11.12.3.4.59. Function Se05x_API_CipherOneShot

11.12.3.4.59.1. Function Documentation

smStatus_t Se05x_API_CipherOneShot(pSe05xSession_t session_ctx, uint32_t objectID, SE05x_CipherMode_t cipherMode, const uint8_t *inputData, size_t inputDataLen, uint8_t *IV, size_t IVLen, uint8_t *outputData, size_t *poutputDataLen, const SE05x_Cipher_Oper_OneShot_t operation)

Se05x_API_CipherOneShot.

Encrypt or decrypt data in one shot mode.

The key object must be either an AES key or DES key.

Command to Applet

Field

Value

Description

CLA

0x80

INS

INS_CRYPTO

SE05x_INS_t

P1

P1_CIPHER

See SE05x_P1_t

P2

P2_ENCRYPT_ONESHOT or P2_DECRYPT_ONESHOT

See SE05x_P2_t

Lc

#(Payload)

Payload

TLV[TAG_1]

4-byte identifier of the key object.

TLV[TAG_2]

1-byte CipherMode

TLV[TAG_3]

Byte array containing input data.

TLV[TAG_4]

Byte array containing an initialization vector. [Optional] [Conditional: only when the Crypto Object type equals CC_CIPHER and subtype is not including ECB]

Le

0x00

Expecting return data.

R-APDU Body

Value

Description

TLV[TAG_1]

Output data

R-APDU Trailer

SW

Description

SW_NO_ERROR

The command is handled successfully.

Return

The sm status.

Parameters
  • [in] session_ctx: The session context

  • [in] objectID: The object id

  • [in] cipherMode: The cipher mode

  • [in] inputData: The input data

  • [in] inputDataLen: The input data length

  • [in] IV: Initial vector

  • [in] IVLen: The iv length

  • outputData: The output data

  • poutputDataLen: The poutput data length

  • [in] operation: The operation