pub struct RustCryptoProvider { /* private fields */ }Expand description
Default crypto provider built on the in-crate
crate::crypto::Crypto (RustCrypto-backed AES + RSA).
Despite the historical “Openssl” name in the design doc, the
implementation uses the workspace’s RustCrypto stack. Recorded
as a Deviation in docs/parity.md.
Implementations§
Source§impl RustCryptoProvider
impl RustCryptoProvider
Sourcepub fn new(crypto: Crypto) -> Self
pub fn new(crypto: Crypto) -> Self
Wrap an existing crate::crypto::Crypto.
§Examples
use dynomite::embed::hooks::{CryptoProvider, RustCryptoProvider};
use dynomite::crypto::Crypto;
// Production embedders load the key from disk:
let crypto = Crypto::from_pem("/etc/dynomite/dynomite.pem").unwrap();
let p = RustCryptoProvider::new(crypto);
assert!(p.rsa_size() >= 128);Trait Implementations§
Source§impl CryptoProvider for RustCryptoProvider
impl CryptoProvider for RustCryptoProvider
Source§fn aes_encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, CryptoProviderError>
fn aes_encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, CryptoProviderError>
AES-encrypt
plaintext under the provider’s key.Source§fn aes_decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>, CryptoProviderError>
fn aes_decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>, CryptoProviderError>
AES-decrypt
ciphertext under the provider’s key.Source§fn rsa_encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, CryptoProviderError>
fn rsa_encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, CryptoProviderError>
RSA-encrypt
plaintext under the provider’s public key.Source§fn rsa_decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>, CryptoProviderError>
fn rsa_decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>, CryptoProviderError>
RSA-decrypt
ciphertext under the provider’s private key.Auto Trait Implementations§
impl Freeze for RustCryptoProvider
impl RefUnwindSafe for RustCryptoProvider
impl Send for RustCryptoProvider
impl Sync for RustCryptoProvider
impl Unpin for RustCryptoProvider
impl UnsafeUnpin for RustCryptoProvider
impl UnwindSafe for RustCryptoProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more