|
| 1 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | +// Licensed under the Apache 2.0 License. |
| 3 | + |
| 4 | +#pragma once |
| 5 | + |
| 6 | +#include <cstddef> |
| 7 | +#include <cstdint> |
| 8 | + |
| 9 | +#ifdef __cplusplus |
| 10 | +extern "C" |
| 11 | +{ |
| 12 | +#endif |
| 13 | + |
| 14 | + /// Sign a CCF ledger signature (COSE_Sign1, detached payload). |
| 15 | + /// Returns 0 on success, non-zero on failure. |
| 16 | + int ccf_cose_sign_ledger( |
| 17 | + const uint8_t* key_der_ptr, |
| 18 | + size_t key_der_len, |
| 19 | + const uint8_t* kid_ptr, |
| 20 | + size_t kid_len, |
| 21 | + int64_t iat, |
| 22 | + const uint8_t* issuer_ptr, |
| 23 | + size_t issuer_len, |
| 24 | + const uint8_t* subject_ptr, |
| 25 | + size_t subject_len, |
| 26 | + const uint8_t* txid_ptr, |
| 27 | + size_t txid_len, |
| 28 | + const uint8_t* payload_ptr, |
| 29 | + size_t payload_len, |
| 30 | + uint8_t** out_ptr, |
| 31 | + size_t* out_len); |
| 32 | + |
| 33 | + /// Sign a CCF identity endorsement (COSE_Sign1, embedded payload). |
| 34 | + /// epoch_end and prev_root may be NULL/0 if not applicable. |
| 35 | + /// Returns 0 on success, non-zero on failure. |
| 36 | + int ccf_cose_sign_endorsement( |
| 37 | + const uint8_t* key_der_ptr, |
| 38 | + size_t key_der_len, |
| 39 | + int64_t iat, |
| 40 | + const uint8_t* epoch_begin_ptr, |
| 41 | + size_t epoch_begin_len, |
| 42 | + const uint8_t* epoch_end_ptr, |
| 43 | + size_t epoch_end_len, |
| 44 | + const uint8_t* prev_root_ptr, |
| 45 | + size_t prev_root_len, |
| 46 | + const uint8_t* payload_ptr, |
| 47 | + size_t payload_len, |
| 48 | + uint8_t** out_ptr, |
| 49 | + size_t* out_len); |
| 50 | + |
| 51 | + /// Free a buffer returned by ccf_cose_sign_*. |
| 52 | + void ccf_cose_free(uint8_t* ptr, size_t len); |
| 53 | + |
| 54 | +#ifdef __cplusplus |
| 55 | +} |
| 56 | +#endif |
0 commit comments