Struct coset::CoseSignBuilder
source · pub struct CoseSignBuilder(/* private fields */);
Expand description
Builder for CoseSign
objects.
Implementations§
source§impl CoseSignBuilder
impl CoseSignBuilder
sourcepub fn unprotected(self, unprotected: Header) -> Self
pub fn unprotected(self, unprotected: Header) -> Self
Set the associated field.
sourcepub fn add_signature(self, sig: CoseSignature) -> Self
pub fn add_signature(self, sig: CoseSignature) -> Self
Add a signature value.
sourcepub fn add_created_signature<F>(
self,
sig: CoseSignature,
aad: &[u8],
signer: F
) -> Self
pub fn add_created_signature<F>( self, sig: CoseSignature, aad: &[u8], signer: F ) -> Self
Calculate the signature value, using signer
to generate the signature bytes that will be
used to complete sig
. Any protected header values should be set before using this
method.
sourcepub fn add_detached_signature<F>(
self,
sig: CoseSignature,
payload: &[u8],
aad: &[u8],
signer: F
) -> Self
pub fn add_detached_signature<F>( self, sig: CoseSignature, payload: &[u8], aad: &[u8], signer: F ) -> Self
Calculate the signature value for a detached payload, using signer
to generate the
signature bytes that will be used to complete sig
. Any protected header values should
be set before using this method.
§Panics
This method will panic if self.payload.is_some()
.
sourcepub fn try_add_created_signature<F, E>(
self,
sig: CoseSignature,
aad: &[u8],
signer: F
) -> Result<Self, E>
pub fn try_add_created_signature<F, E>( self, sig: CoseSignature, aad: &[u8], signer: F ) -> Result<Self, E>
Calculate the signature value, using signer
to generate the signature bytes that will be
used to complete sig
. Any protected header values should be set before using this
method.
sourcepub fn try_add_detached_signature<F, E>(
self,
sig: CoseSignature,
payload: &[u8],
aad: &[u8],
signer: F
) -> Result<Self, E>
pub fn try_add_detached_signature<F, E>( self, sig: CoseSignature, payload: &[u8], aad: &[u8], signer: F ) -> Result<Self, E>
Calculate the signature value for a detached payload, using signer
to generate the
signature bytes that will be used to complete sig
. Any protected header values should
be set before using this method.
§Panics
This method will panic if self.payload.is_some()
.