Files | |
| file | psa_crypto_cbor_encoder.h |
Macros | |
| #define | CBOR_BUF_SIZE_START |
| Required size of CBOR output buffer from start to end of attributes. More... | |
Functions | |
| psa_status_t | psa_encode_key_slot (psa_key_slot_t *slot, uint8_t *output, size_t output_len, size_t *output_size) |
| Encodes a basic key slot in CBOR. More... | |
| psa_status_t | psa_decode_key_slot_data (psa_key_slot_t *slot, uint8_t *cbor_buf, size_t cbor_buf_size) |
| Decode CBOR encoded key data and write to PSA key slot. More... | |
| psa_status_t | psa_decode_key_attributes (psa_key_attributes_t *attr, uint8_t *cbor_buf, size_t cbor_buf_size) |
| Decode CBOR PSA key attributes. More... | |
| #define CBOR_BUF_SIZE_START |
Required size of CBOR output buffer from start to end of attributes.
Adds attributes sizes to CBOR encodings for individual values.
Definition at line 33 of file psa_crypto_cbor_encoder.h.
| psa_status_t psa_decode_key_attributes | ( | psa_key_attributes_t * | attr, |
| uint8_t * | cbor_buf, | ||
| size_t | cbor_buf_size | ||
| ) |
Decode CBOR PSA key attributes.
Only decodes key attributes and not the actual key. Key can be decoded with psa_decode_key_slot_data.
| attr | Key attribute struct to store decoded attributes |
| cbor_buf | Buffer containing CBOR encoded data |
| cbor_buf_size | Size of cbor_buf |
| psa_status_t psa_decode_key_slot_data | ( | psa_key_slot_t * | slot, |
| uint8_t * | cbor_buf, | ||
| size_t | cbor_buf_size | ||
| ) |
Decode CBOR encoded key data and write to PSA key slot.
Only decodes the key and should be called in combination with psa_decode_key_attributes.
| slot | Pointer to key slot to write decoded key to |
| cbor_buf | Buffer containing CBOR encoded data |
| cbor_buf_size | Size of cbor_buf |
| psa_status_t psa_encode_key_slot | ( | psa_key_slot_t * | slot, |
| uint8_t * | output, | ||
| size_t | output_len, | ||
| size_t * | output_size | ||
| ) |
Encodes a basic key slot in CBOR.
Single Key Format:
- [
[ID, Type, Bits, Lifetime, [Usage, Algorithm]],
h'key
]
Asymmetric Key Pair Format:
- [
[ID, Type, Bits, Lifetime, [Usage, Algorithm]],
[h'private_key, h'public_key]
]
Protected Key Format:
- [
[ID, Type, Bits, Lifetime, [Usage, Algorithm]],
[Slot No, *optional: h'public_key*]
]
| [in] | slot | Pointer to slot containing the key to encode |
| [in] | output | Buffer to write the encoded key to |
| [in] | output_len | Length of output buffer |
| [out] | output_size | Pointer to write actual length of encoding |