Skip to main content

CryptoProvider

Trait CryptoProvider 

Source
pub trait CryptoProvider: Send + Sync {
    // Required methods
    fn provider_id(&self) -> CryptoProviderId;
    fn generate_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: GenerateKey<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<NewKey, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn generate_sealing_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: GenerateSealingKey<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<NewKey, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn import_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: ImportKey<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<NewKey, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn sign<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: SignRequest<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn verify<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: VerifyRequest<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<bool, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn encapsulate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: EncapsulateRequest<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<Encapsulation, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn decapsulate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: DecapsulateRequest<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<Zeroizing<Vec<u8>>, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn wrap_envelope<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: WrapEnvelopeRequest<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<Envelope, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn unwrap_envelope<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: UnwrapEnvelopeRequest<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Provider-neutral crypto operations.

Required Methods§

Source

fn provider_id(&self) -> CryptoProviderId

Stable provider identifier.

Source

fn generate_key<'life0, 'life1, 'async_trait>( &'life0 self, request: GenerateKey<'life1>, ) -> Pin<Box<dyn Future<Output = Result<NewKey, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate a new provider-native signing key.

Source

fn generate_sealing_key<'life0, 'life1, 'async_trait>( &'life0 self, request: GenerateSealingKey<'life1>, ) -> Pin<Box<dyn Future<Output = Result<NewKey, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate a new provider-native KEM sealing (recipient) key.

Source

fn import_key<'life0, 'life1, 'async_trait>( &'life0 self, request: ImportKey<'life1>, ) -> Pin<Box<dyn Future<Output = Result<NewKey, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Import caller-provided key material.

Source

fn sign<'life0, 'life1, 'async_trait>( &'life0 self, request: SignRequest<'life1>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sign in place.

Source

fn verify<'life0, 'life1, 'async_trait>( &'life0 self, request: VerifyRequest<'life1>, ) -> Pin<Box<dyn Future<Output = Result<bool, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Verify with provider-held public material.

Source

fn encapsulate<'life0, 'life1, 'async_trait>( &'life0 self, request: EncapsulateRequest<'life1>, ) -> Pin<Box<dyn Future<Output = Result<Encapsulation, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

KEM encapsulation.

Source

fn decapsulate<'life0, 'life1, 'async_trait>( &'life0 self, request: DecapsulateRequest<'life1>, ) -> Pin<Box<dyn Future<Output = Result<Zeroizing<Vec<u8>>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

KEM decapsulation.

Source

fn wrap_envelope<'life0, 'life1, 'async_trait>( &'life0 self, request: WrapEnvelopeRequest<'life1>, ) -> Pin<Box<dyn Future<Output = Result<Envelope, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

KEM plus envelope encryption.

Source

fn unwrap_envelope<'life0, 'life1, 'async_trait>( &'life0 self, request: UnwrapEnvelopeRequest<'life1>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

KEM plus envelope decryption.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§