Skip to main content

RealCryptoHandler

Struct RealCryptoHandler 

Source
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§

Source§

impl RealCryptoHandler

Source

pub fn new() -> Self

Create a new real crypto handler using OS entropy

Source

pub fn seeded(seed: [u8; 32]) -> Self

Create a seeded crypto handler for deterministic testing

When seeded, all randomness will be deterministic based on the provided seed. This is useful for reproducible tests and simulations.

Trait Implementations§

Source§

impl Clone for RealCryptoHandler

Source§

fn clone(&self) -> RealCryptoHandler

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

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,

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,

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,

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,

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,

Verify Ed25519 signature
Source§

fn is_simulated(&self) -> bool

Check if this crypto handler supports simulation mode
Source§

fn crypto_capabilities(&self) -> Vec<String>

Get crypto implementation capabilities
Source§

fn constant_time_eq(&self, a: &[u8], b: &[u8]) -> bool

Constant-time comparison for cryptographic values
Source§

fn secure_zero(&self, data: &mut [u8])

Securely zero memory
Source§

impl CryptoExtendedEffects for RealCryptoHandler

Source§

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,

Generate signing keys with an explicit method. Read more
Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

fn frost_sign_share<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, package: &'life1 FrostSigningPackage, key_share: &'life2 [u8], nonces: &'life3 [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, 'life3: 'async_trait,

Source§

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,

Source§

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,

Extract public key from Ed25519 private key
Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

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,

Convert Ed25519 private key (seed) to X25519 (Curve25519) private key for Diffie-Hellman.
Source§

impl Debug for RealCryptoHandler

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RealCryptoHandler

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

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,

Generate random bytes of specified length
Source§

fn random_bytes_32<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = [u8; 32]> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generate 32 random bytes as array
Source§

fn random_u64<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generate a random u64 value

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> RandomExtendedEffects for T

Source§

fn random_range<'life0, 'async_trait>( &'life0 self, min: u64, max: u64, ) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Generate a random number in the specified range
Source§

fn random_uuid<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Uuid> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Generate a random UUID v4
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> CryptoEffects for T

Source§

impl<T> RandomEffects for T