[][src]Struct aws_nitro_enclaves_cose::sign::SigStructure

pub struct SigStructure(_, _, _, _, _);

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:

  1. 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.

  2. 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.

  3. 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.

  4. 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.)

  5. 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

impl SigStructure[src]

pub fn new_sign1(
    body_protected: &[u8],
    payload: &[u8]
) -> Result<Self, CborError>
[src]

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

pub fn new_sign1_cbor_value(
    body_protected: &[u8],
    payload: &CborValue
) -> Result<Self, CborError>
[src]

Takes the protected field of the COSE_Sign object and a CborValue as payload and creates a SigStructure for one signer from it

pub fn as_bytes(&self) -> Result<Vec<u8>, CborError>[src]

Serializes the SigStructure to . We don't care about deserialization, since both sides are supposed to compute the SigStructure and compare.

Trait Implementations

impl Clone for SigStructure[src]

impl Debug for SigStructure[src]

impl Serialize for SigStructure[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.