pub struct CryptographicLibrary { /* private fields */ }Expand description
Cryptographic Library Manager
Implementations§
Source§impl CryptographicLibrary
impl CryptographicLibrary
Sourcepub fn initialize(&mut self) -> Result<(), CryptographicError>
pub fn initialize(&mut self) -> Result<(), CryptographicError>
Initialize the library
Sourcepub fn generate_mldsa_key_pair(
&mut self,
key_id: String,
security_level: SecurityLevel,
) -> Result<CryptographicResult<(Key, Key)>, CryptographicError>
pub fn generate_mldsa_key_pair( &mut self, key_id: String, security_level: SecurityLevel, ) -> Result<CryptographicResult<(Key, Key)>, CryptographicError>
Generate ML-DSA key pair
Sourcepub fn sign_data(
&mut self,
key_id: &str,
data: &[u8],
) -> Result<CryptographicResult<Signature>, CryptographicError>
pub fn sign_data( &mut self, key_id: &str, data: &[u8], ) -> Result<CryptographicResult<Signature>, CryptographicError>
Sign data with ML-DSA
Sourcepub fn verify_signature(
&mut self,
key_id: &str,
signature: &Signature,
data: &[u8],
) -> Result<CryptographicResult<bool>, CryptographicError>
pub fn verify_signature( &mut self, key_id: &str, signature: &Signature, data: &[u8], ) -> Result<CryptographicResult<bool>, CryptographicError>
Verify signature with ML-DSA
Sourcepub fn encrypt_data(
&mut self,
key_id: &str,
data: &[u8],
additional_data: Option<&[u8]>,
) -> Result<CryptographicResult<EncryptedData>, CryptographicError>
pub fn encrypt_data( &mut self, key_id: &str, data: &[u8], additional_data: Option<&[u8]>, ) -> Result<CryptographicResult<EncryptedData>, CryptographicError>
Encrypt data with AES-256-GCM
Sourcepub fn encrypt_data_with_algorithm(
&mut self,
key_id: &str,
data: &[u8],
additional_data: Option<&[u8]>,
algorithm: EncryptionAlgorithm,
) -> Result<CryptographicResult<EncryptedData>, CryptographicError>
pub fn encrypt_data_with_algorithm( &mut self, key_id: &str, data: &[u8], additional_data: Option<&[u8]>, algorithm: EncryptionAlgorithm, ) -> Result<CryptographicResult<EncryptedData>, CryptographicError>
Encrypt data with an explicitly chosen AEAD algorithm (AES-256-GCM, ChaCha20-Poly1305, or XChaCha20-Poly1305).
Sourcepub fn decrypt_data(
&mut self,
key_id: &str,
encrypted_data: &EncryptedData,
) -> Result<CryptographicResult<Vec<u8>>, CryptographicError>
pub fn decrypt_data( &mut self, key_id: &str, encrypted_data: &EncryptedData, ) -> Result<CryptographicResult<Vec<u8>>, CryptographicError>
Decrypt data with AES-256-GCM
Sourcepub fn compute_hash(
&mut self,
data: &[u8],
) -> Result<CryptographicResult<HashResult>, CryptographicError>
pub fn compute_hash( &mut self, data: &[u8], ) -> Result<CryptographicResult<HashResult>, CryptographicError>
Compute hash with SHA-256
Sourcepub fn compute_hash_blake3(
&mut self,
data: &[u8],
) -> Result<CryptographicResult<HashResult>, CryptographicError>
pub fn compute_hash_blake3( &mut self, data: &[u8], ) -> Result<CryptographicResult<HashResult>, CryptographicError>
Compute hash with BLAKE3 (32-byte digest)
Sourcepub fn derive_hkdf(
&self,
ikm: &[u8],
info: &[u8],
) -> Result<Vec<u8>, CryptographicError>
pub fn derive_hkdf( &self, ikm: &[u8], info: &[u8], ) -> Result<Vec<u8>, CryptographicError>
Derive key material using HKDF-SHA256 (RFC 5869).
Sourcepub fn issue_vc_mldsa(
&self,
claim_quins: &[NQuin],
issuer_sk_key_id: &str,
issuer_did_hash: u64,
context: &CryptoContext,
) -> Result<CryptographicResult<MlDsaVcProof>, CryptographicError>
pub fn issue_vc_mldsa( &self, claim_quins: &[NQuin], issuer_sk_key_id: &str, issuer_did_hash: u64, context: &CryptoContext, ) -> Result<CryptographicResult<MlDsaVcProof>, CryptographicError>
Issue an ML-DSA-signed Verifiable Credential via the fiduciary VC fragment layout.
Sourcepub fn verify_vc_mldsa(
&self,
proof: &MlDsaVcProof,
claim_quins: &[NQuin],
issuer_pk_key_id: &str,
context: &CryptoContext,
) -> Result<CryptographicResult<bool>, CryptographicError>
pub fn verify_vc_mldsa( &self, proof: &MlDsaVcProof, claim_quins: &[NQuin], issuer_pk_key_id: &str, context: &CryptoContext, ) -> Result<CryptographicResult<bool>, CryptographicError>
Verify an ML-DSA-signed Verifiable Credential issued via Self::issue_vc_mldsa.
Sourcepub fn generate_zk_proof(
&mut self,
circuit_id: &str,
witness: &[Vec<u8>],
public_inputs: &[Vec<u8>],
) -> Result<CryptographicResult<Proof>, CryptographicError>
pub fn generate_zk_proof( &mut self, circuit_id: &str, witness: &[Vec<u8>], public_inputs: &[Vec<u8>], ) -> Result<CryptographicResult<Proof>, CryptographicError>
Generate zero-knowledge proof
Sourcepub fn verify_zk_proof(
&mut self,
proof: &Proof,
public_inputs: &[Vec<u8>],
) -> Result<CryptographicResult<bool>, CryptographicError>
pub fn verify_zk_proof( &mut self, proof: &Proof, public_inputs: &[Vec<u8>], ) -> Result<CryptographicResult<bool>, CryptographicError>
Verify zero-knowledge proof
Sourcepub fn get_security_metrics(&self) -> SecurityMetrics
pub fn get_security_metrics(&self) -> SecurityMetrics
Get security metrics
Sourcepub fn get_key_info(&self, key_id: &str) -> Option<KeyMetadata>
pub fn get_key_info(&self, key_id: &str) -> Option<KeyMetadata>
Get key information
Sourcepub fn rotate_key(
&mut self,
key_id: &str,
) -> Result<CryptographicResult<Key>, CryptographicError>
pub fn rotate_key( &mut self, key_id: &str, ) -> Result<CryptographicResult<Key>, CryptographicError>
Rotate key
Auto Trait Implementations§
impl Freeze for CryptographicLibrary
impl RefUnwindSafe for CryptographicLibrary
impl Send for CryptographicLibrary
impl Sync for CryptographicLibrary
impl Unpin for CryptographicLibrary
impl UnsafeUnpin for CryptographicLibrary
impl UnwindSafe for CryptographicLibrary
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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