Struct aws_nitro_enclaves_cose::sign::SigStructure
source · pub struct SigStructure(/* private fields */);
Expand description
Implementation of the Sig_structure as defined in RFC8152.
In order to create a signature, a well-defined byte stream is needed. The Sig_structure is used to create the canonical form. This signing and verification process takes in the body information (COSE_Sign or COSE_Sign1), the signer information (COSE_Signature), and the application data (external source). A Sig_structure is a CBOR array. The fields of the Sig_structure in order are:
-
A text string identifying the context of the signature. The context string is:
“Signature” for signatures using the COSE_Signature structure.
“Signature1” for signatures using the COSE_Sign1 structure.
“CounterSignature” for signatures used as counter signature attributes.
-
The protected attributes from the body structure encoded in a bstr type. If there are no protected attributes, a bstr of length zero is used.
-
The protected attributes from the signer structure encoded in a bstr type. If there are no protected attributes, a bstr of length zero is used. This field is omitted for the COSE_Sign1 signature structure.
-
The protected attributes from the application encoded in a bstr type. If this field is not supplied, it defaults to a zero- length binary string. (See Section 4.3 for application guidance on constructing this field.)
-
The payload to be signed encoded in a bstr type. The payload is placed here independent of how it is transported.
Note: A struct serializes to a map, while a tuple serializes to an array, which is why this struct is actually a tuple Note: This structure only needs to be serializable, since it’s used for generating a signature and not transported anywhere. Both sides need to generate it independently.
Implementations§
source§impl SigStructure
impl SigStructure
sourcepub fn new_sign1(
body_protected: &[u8],
payload: &[u8]
) -> Result<Self, CborError>
pub fn new_sign1( body_protected: &[u8], payload: &[u8] ) -> Result<Self, CborError>
Takes the protected field of the COSE_Sign object and a raw slice of bytes as payload and creates a SigStructure for one signer from it
Trait Implementations§
source§impl Clone for SigStructure
impl Clone for SigStructure
source§fn clone(&self) -> SigStructure
fn clone(&self) -> SigStructure
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more