Skip to main content

CryptoProvider

Trait CryptoProvider 

Source
pub trait CryptoProvider {
    // Required methods
    fn verify_signature(
        &self,
        _signature_data: &[u8],
        _signed_data: &[u8],
        _config: &CryptoConfig,
    ) -> CryptoResult<SignatureVerificationResult>;
    fn parse_certificate(
        &self,
        cert_data: &[u8],
    ) -> CryptoResult<CertificateInfo>;
    fn verify_certificate_chain(
        &self,
        cert_chain: &[&[u8]],
        _config: &CryptoConfig,
    ) -> CryptoResult<CertificateChainResult>;
    fn decrypt(
        &self,
        encrypted_data: &[u8],
        key: &[u8],
        algorithm: &str,
    ) -> CryptoResult<Vec<u8>>;
    fn encrypt(
        &self,
        data: &[u8],
        key: &[u8],
        algorithm: &str,
    ) -> CryptoResult<Vec<u8>>;
}
Expand description

Main cryptographic provider interface

Required Methods§

Source

fn verify_signature( &self, _signature_data: &[u8], _signed_data: &[u8], _config: &CryptoConfig, ) -> CryptoResult<SignatureVerificationResult>

Verify a digital signature

Source

fn parse_certificate(&self, cert_data: &[u8]) -> CryptoResult<CertificateInfo>

Parse and validate a certificate

Source

fn verify_certificate_chain( &self, cert_chain: &[&[u8]], _config: &CryptoConfig, ) -> CryptoResult<CertificateChainResult>

Verify a certificate chain

Source

fn decrypt( &self, encrypted_data: &[u8], key: &[u8], algorithm: &str, ) -> CryptoResult<Vec<u8>>

Decrypt encrypted data

Source

fn encrypt( &self, data: &[u8], key: &[u8], algorithm: &str, ) -> CryptoResult<Vec<u8>>

Encrypt data

Implementors§