BSL v1.1.1 - 39.g9f43410
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
CoseContext.h File Reference

Header for the implementation of the COSE context [17]. More...

#include "bsl/BPSecLib_Private.h"
#include "bsl/BPSecLib_Public.h"
#include "bsl/dynamic/CBOR.h"
#include <m-bptree.h>
+ Include dependency graph for CoseContext.h:
+ This graph shows which files directly or indirectly include this file:

Macros

#define BSLX_COSESC_CTX_ID   3
 Registered BPSec context ID.
 

Enumerations

enum  BSLX_CoseSC_Option_e {
  BSLX_COSESC_OPTION_KEY_ID = 3000 , BSLX_COSESC_OPTION_KEY_ALG , BSLX_COSESC_OPTION_TGT_ALG , BSLX_COSESC_OPTION_AAD_SCOPE ,
  BSLX_COSESC_OPTION_IV_COUNTER_OFFSET , BSLX_COSESC_OPTION_IV_BASE , BSLX_COSESC_OPTION_SALT_LENGTH , BSLX_COSESC_OPTION_SALT_COUNTER_OFFSET ,
  BSLX_COSESC_OPTION_SALT_BASE
}
 Internal option enumerations. More...
 
enum  BSLX_CoseSC_Param_e { BSLX_COSESC_PARAM_ADDL_PHDR = 3 , BSLX_COSESC_PARAM_ADDL_UHDR = 4 , BSLX_COSESC_PARAM_AAD_SCOPE = 5 }
 From https://www.ietf.org/archive/id/draft-ietf-dtn-bpsec-cose-16.html#section-2.2. More...
 
enum  BSLX_CoseSC_Result_e {
  BSLX_COSESC_RESULT_COSE_ENCRYPT0 = 16 , BSLX_COSESC_RESULT_COSE_MAC0 = 17 , BSLX_COSESC_RESULT_COSE_SIGN1 = 18 , BSLX_COSESC_RESULT_COSE_ENCRYPT = 96 ,
  BSLX_COSESC_RESULT_COSE_MAC = 97 , BSLX_COSESC_RESULT_COSE_SIGN = 98
}
 From https://www.ietf.org/archive/id/draft-ietf-dtn-bpsec-cose-16.html#section-2.3. More...
 
enum  BSLX_CoseSC_AAD_Flag_e { BSLX_COSESC_AAD_FLAG_METADATA = 0x1 , BSLX_COSESC_AAD_FLAG_BTSD = 0x2 }
 Flags for AAD Scope parameter. More...
 

Functions

int BSLX_CoseSc_AadScope_Encode (QCBOREncodeContext *enc, const BSLX_CoseSc_AadScope_t *scope)
 
int BSLX_CoseSc_AadScope_Decode (QCBORDecodeContext *dec, BSLX_CoseSc_AadScope_t *scope)
 
bool BSLX_CoseSc_Validate (BSL_LibCtx_t *lib, BSL_BundleRef_t *bundle, BSL_SecOper_t *sec_oper)
 Match signature BSL_SecCtx_Validate_f.
 
int BSLX_CoseSc_Execute (BSL_LibCtx_t *lib, BSL_BundleRef_t *bundle, BSL_SecOper_t *sec_oper)
 Match signature BSL_SecCtx_Execute_f.
 

Detailed Description

Header for the implementation of the COSE context [17].

Macro Definition Documentation

◆ BSLX_COSESC_CTX_ID

#define BSLX_COSESC_CTX_ID   3

Registered BPSec context ID.

Enumeration Type Documentation

◆ BSLX_CoseSC_AAD_Flag_e

Flags for AAD Scope parameter.

Enumerator
BSLX_COSESC_AAD_FLAG_METADATA 
BSLX_COSESC_AAD_FLAG_BTSD 

◆ BSLX_CoseSC_Option_e

Internal option enumerations.

Enumerator
BSLX_COSESC_OPTION_KEY_ID 

Key ID as a byte string.

The value is a byte string (which may contain encoded UTF8 text). Required for source and optional filter for verifier/acceptor. If they key algorithm is different than BSLX_COSESC_OPTION_TGT_ALG option, the key will be used for the recipient layer, otherwise it will be used for a single-layer message.

BSLX_COSESC_OPTION_KEY_ALG 

Optional recipient algorithm as an integer.

The value is a COSE algorithm code point (BSLX_CoseMsg_Alg_e). Optional for source and optional filter for verifier/acceptor. When not present, the key itself must have an algorithm parameter.

BSLX_COSESC_OPTION_TGT_ALG 

Content-layer algorithm as an integer.

The value is a COSE algorithm code point (BSLX_CoseMsg_Alg_e). Required for source and optional filter for verifier/acceptor.

BSLX_COSESC_OPTION_AAD_SCOPE 

AAD Scope as raw encoded data.

The value is encoded CBOR interpreted as BSLX_CoseSc_AadScope_t. Optional for source, optional exact-match for verifier/acceptor.

BSLX_COSESC_OPTION_IV_COUNTER_OFFSET 

An option to use the key telemetry counter (number of security operations performed) as the basis of a unique IV or Partial IV for encryption.

The value is an offset (as int64_t) to add to the counter which is then converted to a byte string in network byte order. When used as IV this is padded to the needed length, when used as Partial IV it is not padded. Optional for source and unused for verifier/acceptor.

BSLX_COSESC_OPTION_IV_BASE 

An option to define a Base IV outside a COSE key.

The value is a byte string used in the same way that RFC 9052 defines the Base IV of a key. When present, this base will not be visible in the messaging. Optional for source and unused for verifier/acceptor.

BSLX_COSESC_OPTION_SALT_LENGTH 

An option to select a salt length for KDF sources.

The value is a length in bytes (as int64_t) to generate a salt. Optional for source and unused for verifier/acceptor. When not present, the default salt length for the KDF algorithm will be used.

BSLX_COSESC_OPTION_SALT_COUNTER_OFFSET 

An option to use the key telemetry counter (number of security operations performed) as the basis of a unique salt for key derivation.

The value is an offset (as int64_t) to add to the counter which is then converted to a byte string in network byte order. When used as a salt this is not padded. Optional for source and unused for verifier/acceptor.

BSLX_COSESC_OPTION_SALT_BASE 

An option to define a base salt value (similar in function to a Base IV).

The value is a byte string used to determine the full salt length and XOR-ed with the salt counter. When present, this base will not be visible in the messaging. Optional for source and unused for verifier/acceptor.

◆ BSLX_CoseSC_Param_e

From https://www.ietf.org/archive/id/draft-ietf-dtn-bpsec-cose-16.html#section-2.2.

Enumerator
BSLX_COSESC_PARAM_ADDL_PHDR 

Additional Protected headers.

BSLX_COSESC_PARAM_ADDL_UHDR 

Additional Unprotected headers.

BSLX_COSESC_PARAM_AAD_SCOPE 

AAD Scope map.

◆ BSLX_CoseSC_Result_e

From https://www.ietf.org/archive/id/draft-ietf-dtn-bpsec-cose-16.html#section-2.3.

Enumerator
BSLX_COSESC_RESULT_COSE_ENCRYPT0 
BSLX_COSESC_RESULT_COSE_MAC0 
BSLX_COSESC_RESULT_COSE_SIGN1 
BSLX_COSESC_RESULT_COSE_ENCRYPT 
BSLX_COSESC_RESULT_COSE_MAC 
BSLX_COSESC_RESULT_COSE_SIGN 

Function Documentation

◆ BSLX_CoseSc_AadScope_Decode()

int BSLX_CoseSc_AadScope_Decode ( QCBORDecodeContext *  dec,
BSLX_CoseSc_AadScope_t scope 
)

◆ BSLX_CoseSc_AadScope_Encode()

◆ BSLX_CoseSc_Execute()

◆ BSLX_CoseSc_Validate()