pub struct RealCryptoHandler { /* private fields */ }Expand description
Real crypto handler using actual cryptographic operations. Can be seeded for deterministic testing or use OS entropy in production.
Implementations§
Trait Implementations§
Source§impl Clone for RealCryptoHandler
impl Clone for RealCryptoHandler
Source§fn clone(&self) -> RealCryptoHandler
fn clone(&self) -> RealCryptoHandler
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl CryptoCoreEffects for RealCryptoHandler
impl CryptoCoreEffects for RealCryptoHandler
Source§fn kdf_derive<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ikm: &'life1 [u8],
salt: &'life2 [u8],
info: &'life3 [u8],
output_len: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn kdf_derive<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ikm: &'life1 [u8],
salt: &'life2 [u8],
info: &'life3 [u8],
output_len: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Deterministic key derivation with explicit salt and info inputs.
Source§fn derive_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
master_key: &'life1 [u8],
context: &'life2 KeyDerivationContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn derive_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
master_key: &'life1 [u8],
context: &'life2 KeyDerivationContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Derive key using context for deterministic derivation
Source§fn ed25519_generate_keypair<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, Vec<u8>), CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn ed25519_generate_keypair<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, Vec<u8>), CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate Ed25519 keypair
Source§fn ed25519_sign<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 [u8],
private_key: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn ed25519_sign<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 [u8],
private_key: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sign with Ed25519 private key
Source§fn ed25519_verify<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
message: &'life1 [u8],
signature: &'life2 [u8],
public_key: &'life3 [u8],
) -> Pin<Box<dyn Future<Output = Result<bool, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn ed25519_verify<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
message: &'life1 [u8],
signature: &'life2 [u8],
public_key: &'life3 [u8],
) -> Pin<Box<dyn Future<Output = Result<bool, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Verify Ed25519 signature
Source§fn is_simulated(&self) -> bool
fn is_simulated(&self) -> bool
Check if this crypto handler supports simulation mode
Source§fn crypto_capabilities(&self) -> Vec<String>
fn crypto_capabilities(&self) -> Vec<String>
Get crypto implementation capabilities
Source§fn constant_time_eq(&self, a: &[u8], b: &[u8]) -> bool
fn constant_time_eq(&self, a: &[u8], b: &[u8]) -> bool
Constant-time comparison for cryptographic values
Source§fn secure_zero(&self, data: &mut [u8])
fn secure_zero(&self, data: &mut [u8])
Securely zero memory
Source§impl CryptoExtendedEffects for RealCryptoHandler
impl CryptoExtendedEffects for RealCryptoHandler
fn generate_signing_keys<'life0, 'async_trait>(
&'life0 self,
threshold: u16,
max_signers: u16,
) -> Pin<Box<dyn Future<Output = Result<SigningKeyGenResult, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn generate_signing_keys_with<'life0, 'async_trait>(
&'life0 self,
method: KeyGenerationMethod,
threshold: u16,
max_signers: u16,
) -> Pin<Box<dyn Future<Output = Result<SigningKeyGenResult, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn generate_signing_keys_with<'life0, 'async_trait>(
&'life0 self,
method: KeyGenerationMethod,
threshold: u16,
max_signers: u16,
) -> Pin<Box<dyn Future<Output = Result<SigningKeyGenResult, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate signing keys with an explicit method. Read more
fn sign_with_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 [u8],
key_package: &'life2 [u8],
mode: SigningMode,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn verify_signature<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
message: &'life1 [u8],
signature: &'life2 [u8],
public_key_package: &'life3 [u8],
mode: SigningMode,
) -> Pin<Box<dyn Future<Output = Result<bool, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn frost_generate_keys<'life0, 'async_trait>(
&'life0 self,
threshold: u16,
max_signers: u16,
) -> Pin<Box<dyn Future<Output = Result<FrostKeyGenResult, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn frost_generate_nonces<'life0, 'life1, 'async_trait>(
&'life0 self,
key_package: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn frost_create_signing_package<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
message: &'life1 [u8],
nonces: &'life2 [Vec<u8>],
participants: &'life3 [u16],
public_key_package: &'life4 [u8],
) -> Pin<Box<dyn Future<Output = Result<FrostSigningPackage, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn frost_aggregate_signatures<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
package: &'life1 FrostSigningPackage,
signature_shares: &'life2 [Vec<u8>],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn frost_verify<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
message: &'life1 [u8],
signature: &'life2 [u8],
group_public_key: &'life3 [u8],
) -> Pin<Box<dyn Future<Output = Result<bool, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Source§fn ed25519_public_key<'life0, 'life1, 'async_trait>(
&'life0 self,
private_key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ed25519_public_key<'life0, 'life1, 'async_trait>(
&'life0 self,
private_key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Extract public key from Ed25519 private key
fn chacha20_encrypt<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
plaintext: &'life1 [u8],
key: &'life2 [u8; 32],
nonce: &'life3 [u8; 12],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn chacha20_decrypt<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ciphertext: &'life1 [u8],
key: &'life2 [u8; 32],
nonce: &'life3 [u8; 12],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn aes_gcm_encrypt<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
plaintext: &'life1 [u8],
key: &'life2 [u8; 32],
nonce: &'life3 [u8; 12],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn aes_gcm_decrypt<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
ciphertext: &'life1 [u8],
key: &'life2 [u8; 32],
nonce: &'life3 [u8; 12],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn frost_rotate_keys<'life0, 'life1, 'async_trait>(
&'life0 self,
_old_shares: &'life1 [Vec<u8>],
_old_threshold: u16,
new_threshold: u16,
new_max_signers: u16,
) -> Pin<Box<dyn Future<Output = Result<FrostKeyGenResult, CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn convert_ed25519_to_x25519_public<'life0, 'life1, 'async_trait>(
&'life0 self,
ed25519_public_key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<[u8; 32], CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn convert_ed25519_to_x25519_public<'life0, 'life1, 'async_trait>(
&'life0 self,
ed25519_public_key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<[u8; 32], CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Convert Ed25519 public key to X25519 (Curve25519) public key for Diffie-Hellman.
Source§fn convert_ed25519_to_x25519_private<'life0, 'life1, 'async_trait>(
&'life0 self,
ed25519_private_key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<[u8; 32], CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn convert_ed25519_to_x25519_private<'life0, 'life1, 'async_trait>(
&'life0 self,
ed25519_private_key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<[u8; 32], CryptoError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Convert Ed25519 private key (seed) to X25519 (Curve25519) private key for Diffie-Hellman.
Source§impl Debug for RealCryptoHandler
impl Debug for RealCryptoHandler
Source§impl Default for RealCryptoHandler
impl Default for RealCryptoHandler
Source§impl RandomCoreEffects for RealCryptoHandler
impl RandomCoreEffects for RealCryptoHandler
Source§fn random_bytes<'life0, 'async_trait>(
&'life0 self,
len: usize,
) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn random_bytes<'life0, 'async_trait>(
&'life0 self,
len: usize,
) -> Pin<Box<dyn Future<Output = Vec<u8>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate random bytes of specified length
Auto Trait Implementations§
impl Freeze for RealCryptoHandler
impl RefUnwindSafe for RealCryptoHandler
impl Send for RealCryptoHandler
impl Sync for RealCryptoHandler
impl Unpin for RealCryptoHandler
impl UnsafeUnpin for RealCryptoHandler
impl UnwindSafe for RealCryptoHandler
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