pub struct CoseAgent {
pub header: CoseHeader,
pub payload: Vec<u8>,
pub pub_key: Vec<u8>,
pub s_key: Vec<u8>,
/* private fields */
}
Expand description
COSE recipient, signer or counter-signature structure.
Fields§
§header: CoseHeader
Header of the CoseAgent (recipient, signer or counter-signature).
payload: Vec<u8>
Payload (signature, ciphertext or MAC).
pub_key: Vec<u8>
Public key.
s_key: Vec<u8>
Private/Symmetric key.
Implementations§
Source§impl CoseAgent
impl CoseAgent
Sourcepub fn new_counter_sig() -> CoseAgent
pub fn new_counter_sig() -> CoseAgent
Creates an empty CoseAgent structure for counter signatures.
Sourcepub fn add_header(&mut self, header: CoseHeader)
pub fn add_header(&mut self, header: CoseHeader)
Adds an header.
Sourcepub fn key(&mut self, key: &CoseKey) -> CoseResult
pub fn key(&mut self, key: &CoseKey) -> CoseResult
Adds a cose-key.
Sourcepub fn add_signature(&mut self, signature: Vec<u8>) -> CoseResult
pub fn add_signature(&mut self, signature: Vec<u8>) -> CoseResult
Adds the counter signature to the CoseAgent.
Function to use when signature was produce externally to the module. This function is to use only in the context of counter signatures, not message recipients/signers.
Sourcepub fn counter_sig(
&self,
external_aad: Option<Vec<u8>>,
counter: &mut CoseAgent,
) -> CoseResult
pub fn counter_sig( &self, external_aad: Option<Vec<u8>>, counter: &mut CoseAgent, ) -> CoseResult
Adds a counter signature to the signer/recipient.
Sourcepub fn get_to_sign(
&self,
external_aad: Option<Vec<u8>>,
counter: &mut CoseAgent,
) -> CoseResultWithRet<Vec<u8>>
pub fn get_to_sign( &self, external_aad: Option<Vec<u8>>, counter: &mut CoseAgent, ) -> CoseResultWithRet<Vec<u8>>
Function to get the content to sign by the counter signature.
This function is meant to be called if the counter signature process needs to be external to this crate, like a timestamp authority.
Sourcepub fn get_to_verify(
&mut self,
external_aad: Option<Vec<u8>>,
counter: &usize,
) -> CoseResultWithRet<Vec<u8>>
pub fn get_to_verify( &mut self, external_aad: Option<Vec<u8>>, counter: &usize, ) -> CoseResultWithRet<Vec<u8>>
Function to get the content to verify with the counter signature.
This function is meant to be called if the counter signature process needs to be external to this crate, like a timestamp authority.
Sourcepub fn counters_verify(
&mut self,
external_aad: Option<Vec<u8>>,
counter: usize,
) -> CoseResult
pub fn counters_verify( &mut self, external_aad: Option<Vec<u8>>, counter: usize, ) -> CoseResult
Function that verifies a given counter signature on the respective signer/recipient.
Sourcepub fn add_counter_sig(&mut self, counter: CoseAgent) -> CoseResult
pub fn add_counter_sig(&mut self, counter: CoseAgent) -> CoseResult
Function that adds a counter signature which was signed externally with the use of get_to_sign