11#ifndef __ATTEST_TOKEN_H__
12#define __ATTEST_TOKEN_H__
89#define TOKEN_OPT_OMIT_CLAIMS 0x40000000
99#define TOKEN_OPT_SHORT_CIRCUIT_SIGN 0x80000000
enum attest_token_err_t attest_token_finish(struct attest_token_ctx *me, struct useful_buf_c *completed_token)
Finish the token, complete the signing and get the result.
void attest_token_add_integer(struct attest_token_ctx *me, int32_t label, int64_t value)
Add a 64-bit signed integer claim.
void attest_token_add_encoded(struct attest_token_ctx *me, int32_t label, const struct useful_buf_c *encoded)
Add some already-encoded CBOR to payload.
void attest_token_add_bstr(struct attest_token_ctx *me, int32_t label, const struct useful_buf_c *value)
Add a binary string claim.
QCBOREncodeContext * attest_token_borrow_cbor_cntxt(struct attest_token_ctx *me)
Get a copy of the CBOR encoding context.
attest_token_err_t
Error codes returned from attestation token creation.
@ ATTEST_TOKEN_ERR_GENERAL
A general, unspecific error when creating or decoding the token.
@ ATTEST_TOKEN_ERR_COSE_SIGN1_VALIDATION
COSE signature is invalid, data is corrupted.
@ ATTEST_TOKEN_ERR_CBOR_FORMATTING
Something went wrong formatting the CBOR, most likely the payload has maps or arrays that are not clo...
@ ATTEST_TOKEN_ERR_COSE_SIGN1_FORMAT
Something is wrong with the COSE signing structure, missing headers or such.
@ ATTEST_TOKEN_ERR_CBOR_NOT_WELL_FORMED
CBOR Syntax not well-formed – a CBOR syntax error.
@ ATTEST_TOKEN_ERR_VERIFICATION_KEY
Verification key is not found or of wrong type.
@ ATTEST_TOKEN_ERR_CBOR_STRUCTURE
Bad CBOR structure, for example not a map when was is required.
@ ATTEST_TOKEN_ERR_INTEGER_VALUE
Integer too large, for example an int32_t is required, but value only fits in int64_t.
@ ATTEST_TOKEN_ERR_TAMPERING_DETECTED
Tampering detected in cryptographic function.
@ ATTEST_TOKEN_ERR_TOO_SMALL
The buffer passed in to receive the output is too small.
@ ATTETST_TOKEN_ERR_CBOR_TYPE
Bad CBOR type, for example an not a text string, when a text string is required.
@ ATTEST_TOKEN_ERR_HASH_UNAVAILABLE
A hash function that is needed to make the token is not available.
@ ATTEST_TOKEN_ERR_UNSUPPORTED_SIG_ALG
The signing algorithm is not supported.
@ ATTEST_TOKEN_ERR_INSUFFICIENT_MEMORY
Out of memory.
@ ATTEST_TOKEN_ERR_SUCCESS
Success.
void attest_token_add_tstr(struct attest_token_ctx *me, int32_t label, const struct useful_buf_c *value)
Add a text string claim.
enum attest_token_err_t attest_token_start(struct attest_token_ctx *me, uint32_t opt_flags, int32_t key_select, int32_t cose_alg_id, const struct useful_buf *out_buffer)
Initialize a token creation context.
Q C B O R E n c o d e / D e c o d e.
The context for creating an attestation token.
This is the context for creating a COSE_Sign1 structure.
UsefulBufC and UsefulBuf are simple data structures to hold a pointer and length for a binary data.
The non-const UsefulBuf typically used for some allocated memory that is to be filled in.
Create a COSE_Sign1, usually for EAT or CWT Token.