[−][src]Struct aws_nitro_enclaves_cose::sign::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:
-
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
impl SigStructure
[src]
pub fn new_sign1(
body_protected: &[u8],
payload: &[u8]
) -> Result<Self, CborError>
[src]
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
pub fn new_sign1_cbor_value(
body_protected: &[u8],
payload: &CborValue
) -> Result<Self, CborError>
[src]
body_protected: &[u8],
payload: &CborValue
) -> Result<Self, CborError>
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]
fn clone(&self) -> SigStructure
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for SigStructure
[src]
impl Serialize for SigStructure
[src]
Auto Trait Implementations
impl RefUnwindSafe for SigStructure
impl Send for SigStructure
impl Sync for SigStructure
impl Unpin for SigStructure
impl UnwindSafe for SigStructure
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,