Struct coset::CoseRecipientBuilder
source · pub struct CoseRecipientBuilder(/* private fields */);
Expand description
Builder for CoseRecipient
objects.
Implementations§
source§impl CoseRecipientBuilder
impl CoseRecipientBuilder
sourcepub fn build(self) -> CoseRecipient
pub fn build(self) -> CoseRecipient
Build the completed object.
sourcepub fn unprotected(self, unprotected: Header) -> Self
pub fn unprotected(self, unprotected: Header) -> Self
Set the associated field.
sourcepub fn ciphertext(self, ciphertext: Vec<u8>) -> Self
pub fn ciphertext(self, ciphertext: Vec<u8>) -> Self
Set the associated field.
sourcepub fn add_recipient(self, recipient: CoseRecipient) -> Self
pub fn add_recipient(self, recipient: CoseRecipient) -> Self
Add a CoseRecipient
.
sourcepub fn create_ciphertext<F>(
self,
context: EncryptionContext,
plaintext: &[u8],
external_aad: &[u8],
cipher: F
) -> Self
pub fn create_ciphertext<F>( self, context: EncryptionContext, plaintext: &[u8], external_aad: &[u8], cipher: F ) -> Self
Calculate the ciphertext value with an AEAD, using cipher
to generate the encrypted bytes
from the plaintext and combined AAD (in that order) as per RFC 8152 section 5.3. Any
protected header values should be set before using this method.
§Panics
This function will panic if the context
parameter does not refer to a recipient context.
sourcepub fn try_create_ciphertext<F, E>(
self,
context: EncryptionContext,
plaintext: &[u8],
external_aad: &[u8],
cipher: F
) -> Result<Self, E>
pub fn try_create_ciphertext<F, E>( self, context: EncryptionContext, plaintext: &[u8], external_aad: &[u8], cipher: F ) -> Result<Self, E>
Calculate the ciphertext value with an AEAD, using cipher
to generate the encrypted bytes
from the plaintext and combined AAD (in that order) as per RFC 8152 section 5.3. Any
protected header values should be set before using this method.
§Panics
This function will panic if the context
parameter does not refer to a recipient context.