pub struct CryptoImpl;Trait Implementations§
Source§impl Crypto for CryptoStub
impl Crypto for CryptoStub
Source§fn create_uuid() -> String
fn create_uuid() -> String
Generate a new UUID (version 4). Returns the UUID as a string.
Source§fn hash_sha256<'a>(
_to_digest: &'a [u8],
) -> AsyncCryptoResult<'a, [u8; 32], Self::Sha256Error>
fn hash_sha256<'a>( _to_digest: &'a [u8], ) -> AsyncCryptoResult<'a, [u8; 32], Self::Sha256Error>
Compute the SHA-256 hash of the input data. Returns the 32-byte hash.
Source§fn hkdf_sha256<'a>(
_ikm: &'a [u8],
_salt: &'a [u8],
) -> AsyncCryptoResult<'a, [u8; 32], Self::HkdfError>
fn hkdf_sha256<'a>( _ikm: &'a [u8], _salt: &'a [u8], ) -> AsyncCryptoResult<'a, [u8; 32], Self::HkdfError>
Derive a 32-byte key from the input keying material and salt using HKDF-SHA256.
Source§fn gen_ed25519<'a>() -> AsyncCryptoResult<'a, (Vec<u8>, Vec<u8>), Self::Ed25519GenError>
fn gen_ed25519<'a>() -> AsyncCryptoResult<'a, (Vec<u8>, Vec<u8>), Self::Ed25519GenError>
Generate a new Ed25519 key pair. Returns the public and private keys.
Source§fn sig_ed25519<'a>(
_pri_key: &'a [u8],
_data: &'a [u8],
) -> AsyncCryptoResult<'a, [u8; 64], Self::Ed25519SignError>
fn sig_ed25519<'a>( _pri_key: &'a [u8], _data: &'a [u8], ) -> AsyncCryptoResult<'a, [u8; 64], Self::Ed25519SignError>
Sign the given data using the provided Ed25519 private key. Returns the signature.
Source§fn ver_ed25519<'a>(
_pub_key: &'a [u8],
_sig: &'a [u8],
_data: &'a [u8],
) -> AsyncCryptoResult<'a, bool, Self::Ed25519VerifyError>
fn ver_ed25519<'a>( _pub_key: &'a [u8], _sig: &'a [u8], _data: &'a [u8], ) -> AsyncCryptoResult<'a, bool, Self::Ed25519VerifyError>
Verify the given Ed25519 signature against the provided public key and data.
Returns true if the signature is valid, false if it is invalid.
Source§fn aes_ctr_encrypt<'a>(
_key: &'a [u8; 32],
_iv: &'a [u8; 16],
_plaintext: &'a [u8],
) -> AsyncCryptoResult<'a, Vec<u8>, Self::AesCtrError>
fn aes_ctr_encrypt<'a>( _key: &'a [u8; 32], _iv: &'a [u8; 16], _plaintext: &'a [u8], ) -> AsyncCryptoResult<'a, Vec<u8>, Self::AesCtrError>
Encrypt the plaintext using AES-256 in CTR mode with the given key and IV. Returns the ciphertext.
Source§fn aes_ctr_decrypt<'a>(
_key: &'a [u8; 32],
_iv: &'a [u8; 16],
_cipher: &'a [u8],
) -> AsyncCryptoResult<'a, Vec<u8>, Self::AesCtrError>
fn aes_ctr_decrypt<'a>( _key: &'a [u8; 32], _iv: &'a [u8; 16], _cipher: &'a [u8], ) -> AsyncCryptoResult<'a, Vec<u8>, Self::AesCtrError>
Decrypt the ciphertext using AES-256 in CTR mode with the given key and IV. Returns the plaintext.
Source§fn key_wrap_rfc3394<'a>(
_kek: &'a [u8; 32],
_key_to_wrap: &'a [u8; 32],
) -> AsyncCryptoResult<'a, [u8; 40], Self::KeyWrapError>
fn key_wrap_rfc3394<'a>( _kek: &'a [u8; 32], _key_to_wrap: &'a [u8; 32], ) -> AsyncCryptoResult<'a, [u8; 40], Self::KeyWrapError>
Wrap the given 32-byte key using the provided 32-byte KEK with the RFC3394 algorithm. Returns the wrapped key.
Source§fn key_unwrap_rfc3394<'a>(
_kek: &'a [u8; 32],
_wrapped: &'a [u8; 40],
) -> AsyncCryptoResult<'a, [u8; 32], Self::KeyUnwrapError>
fn key_unwrap_rfc3394<'a>( _kek: &'a [u8; 32], _wrapped: &'a [u8; 40], ) -> AsyncCryptoResult<'a, [u8; 32], Self::KeyUnwrapError>
Unwrap the given 40-byte wrapped key using the provided 32-byte KEK with the RFC3394 algorithm.
Returns the unwrapped key.
Source§fn gen_x25519<'a>() -> AsyncCryptoResult<'a, ([u8; 44], [u8; 48]), Self::X25519GenError>
fn gen_x25519<'a>() -> AsyncCryptoResult<'a, ([u8; 44], [u8; 48]), Self::X25519GenError>
Generate a new X25519 key pair. Returns the public key as a base58 string and the private key as bytes.
Source§fn derive_x25519<'a>(
_pri_key: &'a [u8; 48],
_peer_pub: &'a [u8; 44],
) -> AsyncCryptoResult<'a, [u8; 32], Self::X25519DeriveError>
fn derive_x25519<'a>( _pri_key: &'a [u8; 48], _peer_pub: &'a [u8; 44], ) -> AsyncCryptoResult<'a, [u8; 32], Self::X25519DeriveError>
Derive a shared secret using the X25519 key agreement protocol with the given private key and peer’s public key.
Returns the derived 32-byte shared secret.
type Sha256Error = Sha256Error
Source§fn dec_b58_32(data: &str) -> Result<[u8; 32], B58DecodeError>
fn dec_b58_32(data: &str) -> Result<[u8; 32], B58DecodeError>
Decode the given Base58 string into a 32-byte array.
Returns an error if the input is not valid Base58 or does not decode to exactly 32 bytes.
type HkdfError = HkdfError
type Ed25519GenError = Ed25519GenError
type Ed25519SignError = Ed25519SignError
type Ed25519VerifyError = Ed25519VerifyError
type AesCtrError = AesCtrError
type KeyWrapError = KeyWrapError
type KeyUnwrapError = KeyUnwrapError
type X25519GenError = X25519GenError
type X25519DeriveError = X25519DeriveError
Auto Trait Implementations§
impl Freeze for CryptoStub
impl RefUnwindSafe for CryptoStub
impl Send for CryptoStub
impl Sync for CryptoStub
impl Unpin for CryptoStub
impl UnsafeUnpin for CryptoStub
impl UnwindSafe for CryptoStub
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more