![]() |
|
Uniot Core
|
| 0.8.1 |
Implementation of COSE_Sign1 message format as specified in RFC 8152. More...
#include <COSEMessage.h>
Public Member Functions | |
| COSEMessage (COSEMessage const &)=delete | |
| Copy constructor disabled. | |
| void | operator= (COSEMessage const &)=delete |
| Assignment operator disabled. | |
| COSEMessage () | |
| Default constructor. | |
| COSEMessage (Bytes buf) | |
| Constructs a message from existing CBOR data. | |
| virtual | ~COSEMessage () |
| Destructor. | |
| bool | read (const Bytes &buf) |
| Reads a CBOR-encoded COSE_Sign1 message. | |
| bool | wasReadSuccessful () const |
| Checks if the message was read successfully. | |
| Bytes | getProtectedHeader () |
| Gets the protected header as a byte string. | |
| CBORObject | getUnprotectedHeader () |
| Gets the unprotected header as a CBORObject. | |
| Bytes | getUnprotectedKid () |
| Gets the key identifier from the unprotected header. | |
| Bytes | getPayload () |
| Gets the payload of the message. | |
| Bytes | getSignature () |
| Gets the signature of the message. | |
| bool | isSigned () |
| Checks if the message has a valid signature structure. | |
| void | setUnprotectedKid (const Bytes &kid) |
| Sets the key identifier in the unprotected header. | |
| bool | setPayload (const Bytes &payload) |
| Sets the payload of the message. | |
| void | sign (const ICOSESigner &signer, const Bytes &external=Bytes()) |
| Signs the message using the provided signer. | |
| bool | verify (const Bytes &publicKey) |
| Verifies the signature of the message using the provided public key. | |
| Bytes | build () const |
| Builds the CBOR representation of the message. | |
| void | clean () |
| Resets the message to its initial empty state. | |
Implementation of COSE_Sign1 message format as specified in RFC 8152.
This class provides functionality to create, read, sign, and verify COSE_Sign1 messages. It implements the message structure defined in section 4.2 of RFC 8152. The class supports EdDSA signatures (algorithm -8).
|
delete |
Copy constructor disabled.
|
inline |
Default constructor.
Creates an empty COSE_Sign1 message with default structure
|
inline |
Constructs a message from existing CBOR data.
| buf | CBOR-encoded COSE_Sign1 message |
|
inlinevirtual |
Destructor.
|
inline |
Builds the CBOR representation of the message.
| Bytes | Contains the CBOR-encoded message |
|
inline |
Resets the message to its initial empty state.
|
inline |
Gets the payload of the message.
| Bytes | Contains the payload data |
|
inline |
Gets the protected header as a byte string.
| Bytes | Contains the CBOR-encoded protected header |
|
inline |
Gets the signature of the message.
| Bytes | Contains the signature |
|
inline |
Gets the unprotected header as a CBORObject.
| CBORObject | Represents the unprotected header |
|
inline |
|
inline |
Checks if the message has a valid signature structure.
| true | The message is signed (has an algorithm and non-empty signature) |
| false | The message is not signed |
|
delete |
Assignment operator disabled.
|
inline |
Reads a CBOR-encoded COSE_Sign1 message.
| buf | CBOR data to parse |
| true | The message was read successfully |
| false | The message was not read successfully |
|
inline |
Sets the payload of the message.
| payload | Data to set as the payload |
| true | The payload was set successfully |
| false | The payload was not set successfully |
|
inline |
Sets the key identifier in the unprotected header.
| kid | Key identifier to set |
|
inline |
Signs the message using the provided signer.
| signer | Object implementing the ICOSESigner interface that performs the signature |
| external | Optional external data to include in the signature calculation (AAD) |
|
inline |
Verifies the signature of the message using the provided public key.
| publicKey | Public key to use for verification |
| true | The signature is valid |
| false | The signature is invalid |
|
inline |
Checks if the message was read successfully.
| true | The read operation was successful |
| false | The read operation failed |