Skip to main content

EncryptionKey

Trait EncryptionKey 

Source
pub trait EncryptionKey: AgentKey {
    // Required methods
    fn encrypt<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        plaintext: &'life1 [u8],
        aad: Option<&'life2 [u8]>,
        recipient_public_key: &'life3 dyn VerificationKey,
    ) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, Vec<u8>, Vec<u8>)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn recommended_jwe_alg_enc(&self) -> (JweAlgorithm, JweEncryption);
    fn create_jwe<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        plaintext: &'life1 [u8],
        recipients: &'life2 [Arc<dyn VerificationKey>],
        protected_header: Option<JweProtected>,
    ) -> Pin<Box<dyn Future<Output = Result<Jwe>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Agent key capable of encrypting data for JWE creation.

Implementations of this trait can encrypt data for specific recipients to create JWEs.

Required Methods§

Source

fn encrypt<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, plaintext: &'life1 [u8], aad: Option<&'life2 [u8]>, recipient_public_key: &'life3 dyn VerificationKey, ) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, Vec<u8>, Vec<u8>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Encrypts plaintext data for a specific recipient

Source

fn recommended_jwe_alg_enc(&self) -> (JweAlgorithm, JweEncryption)

Returns the recommended JWE algorithm and encryption for this key

Source

fn create_jwe<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, plaintext: &'life1 [u8], recipients: &'life2 [Arc<dyn VerificationKey>], protected_header: Option<JweProtected>, ) -> Pin<Box<dyn Future<Output = Result<Jwe>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Creates a JWE for multiple recipients

Implementors§