|
BSL v1.1.1 - 39.g9f43410
AMMOS Bundle Protocol Security Library (BSL)
|
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. | |
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. | |
Header for the implementation of the COSE context [17].
| #define BSLX_COSESC_CTX_ID 3 |
Registered BPSec context ID.
| enum 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 |
| 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 |
| 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 |
| 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. |
| enum 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. |
| enum 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 | |
| int BSLX_CoseSc_AadScope_Decode | ( | QCBORDecodeContext * | dec, |
| BSLX_CoseSc_AadScope_t * | scope | ||
| ) |
References BSL_LOG_ERR, and BSL_SUCCESS.
Referenced by BSLX_CoseSc_GetAndValidateAadScope(), and BSLX_CoseSc_GetOptions().
| int BSLX_CoseSc_AadScope_Encode | ( | QCBOREncodeContext * | enc, |
| const BSLX_CoseSc_AadScope_t * | scope | ||
| ) |
References BSL_SUCCESS.
Referenced by BSLP_PolicyOptions_SC3(), BSLX_CoseSc_AddAadScope(), BSLX_CoseSc_ExternalAad_Chunked(), test_AppendixA_Example1_BIB_Source(), test_AppendixA_Example1_BIB_VerifyAccept(), test_AppendixA_Example4_BCB_Source(), test_AppendixA_Example4_BCB_VerifyAccept(), test_AppendixA_Example5_BCB_Source(), test_AppendixA_Example5_BCB_VerifyAccept(), test_AppendixA_Example6_BCB_Source(), test_CCSDS_Example_Mac_Source(), and test_CCSDS_Example_Mac_VerifyAccept().
| int BSLX_CoseSc_Execute | ( | BSL_LibCtx_t * | lib, |
| BSL_BundleRef_t * | bundle, | ||
| BSL_SecOper_t * | sec_oper | ||
| ) |
Match signature BSL_SecCtx_Execute_f.
References BSL_ERR_SECURITY_CONTEXT_FAILED, BSL_LOG_ERR, BSL_SecOper_FindResult(), BSL_SecOper_ResultCount(), BSL_SUCCESS, BSLX_CoseSc_Deinit(), BSLX_CoseSc_Encrypt0_Source(), BSLX_CoseSc_Encrypt0_VerifyAccept(), BSLX_CoseSc_Encrypt_Source(), BSLX_CoseSc_Encrypt_VerifyAccept(), BSLX_CoseSc_GetAndValidateKey(), BSLX_CoseSc_GetAndValidateTarget(), BSLX_CoseSc_GetOptions(), BSLX_CoseSc_Init(), BSLX_CoseSc_Mac0_Source(), BSLX_CoseSc_Mac0_VerifyAccept(), BSLX_CoseSc_Mac_Source(), BSLX_CoseSc_Mac_VerifyAccept(), BSLX_CoseSc_Prepare(), BSLX_COSESC_RESULT_COSE_ENCRYPT, BSLX_COSESC_RESULT_COSE_ENCRYPT0, BSLX_COSESC_RESULT_COSE_MAC, BSLX_COSESC_RESULT_COSE_MAC0, and ctx.
Referenced by MockBPA_Agent_Init(), test_AppendixA_Example1_BIB_Source(), test_AppendixA_Example1_BIB_VerifyAccept(), test_AppendixA_Example4_BCB_Source(), test_AppendixA_Example4_BCB_VerifyAccept(), test_AppendixA_Example5_BCB_Source(), test_AppendixA_Example5_BCB_VerifyAccept(), test_AppendixA_Example6_BCB_Source(), test_CCSDS_Example_Mac_Source(), and test_CCSDS_Example_Mac_VerifyAccept().
| bool BSLX_CoseSc_Validate | ( | BSL_LibCtx_t * | lib, |
| BSL_BundleRef_t * | bundle, | ||
| BSL_SecOper_t * | sec_oper | ||
| ) |
Match signature BSL_SecCtx_Validate_f.
References BSL_SUCCESS, BSLX_CoseSc_Deinit(), BSLX_CoseSc_GetOptions(), BSLX_CoseSc_Init(), BSLX_CoseSc_Prepare(), and ctx.
Referenced by MockBPA_Agent_Init(), test_AppendixA_Example1_BIB_Source(), test_AppendixA_Example1_BIB_VerifyAccept(), test_AppendixA_Example4_BCB_Source(), test_AppendixA_Example4_BCB_VerifyAccept(), test_AppendixA_Example5_BCB_Source(), test_AppendixA_Example5_BCB_VerifyAccept(), test_AppendixA_Example6_BCB_Source(), test_CCSDS_Example_Mac_Source(), test_CCSDS_Example_Mac_VerifyAccept(), test_CoseSc_InvalidOptions_Source(), and test_CoseSc_InvalidOptions_Verifier().