pub struct CryptographicLibrary { /* private fields */ }Expand description
Cryptographic Library Manager
Implementations§
Source§impl CryptographicLibrary
impl CryptographicLibrary
Sourcepub fn generate_managed_signing_pair(
&mut self,
ml_id: &str,
ed_id: &str,
security: SecurityLevel,
) -> Result<(Key, Key), CryptographicError>
pub fn generate_managed_signing_pair( &mut self, ml_id: &str, ed_id: &str, security: SecurityLevel, ) -> Result<(Key, Key), CryptographicError>
Explicit local admin provisioning through the EXISTING algorithm generator. Returns public keys only; private keys move directly into the existing store. This is not an identity enrollment, trusted pin, or paired epoch rotation.
Sourcepub fn install_managed_signing_policy(&mut self, policy: AccessPolicy)
pub fn install_managed_signing_policy(&mut self, policy: AccessPolicy)
Trusted local administrative boundary; never install a wire-claimed policy.
Sourcepub fn begin_paired_signing<'a>(
&'a self,
request: PairedSigningRequest<'a>,
control: &'a SigningControl,
clock: &'a dyn Fn() -> u64,
) -> Result<ManagedPairedSigning<'a>, CryptoError>
pub fn begin_paired_signing<'a>( &'a self, request: PairedSigningRequest<'a>, control: &'a SigningControl, clock: &'a dyn Fn() -> u64, ) -> Result<ManagedPairedSigning<'a>, CryptoError>
Uses host-authenticated access context and a trusted Unix clock. Requires policies for BOTH keys. The returned capability cannot export keys.
Source§impl CryptographicLibrary
impl CryptographicLibrary
Sourcepub fn generate_managed_recipient_pair(
&mut self,
ml_id: &str,
dh_id: &str,
security: SecurityLevel,
) -> Result<(Key, Key), CryptographicError>
pub fn generate_managed_recipient_pair( &mut self, ml_id: &str, dh_id: &str, security: SecurityLevel, ) -> Result<(Key, Key), CryptographicError>
Trusted local provisioning boundary. Returns PUBLIC keys only; private keys move directly into the existing store. Does not enroll or recognize an identity.
pub fn begin_recipient_unwrap<'a>( &'a self, request: RecipientUnwrapRequest<'a>, control: &'a ManagedOperationControl, clock: &'a dyn Fn() -> u64, ) -> Result<ManagedRecipientUnwrap<'a>, CryptoError>
pub fn begin_object_publication<'a>( &'a mut self, request: PublicationRequest<'a>, workspace: &'a mut PublicationWorkspace, control: &'a ManagedOperationControl, clock: &'a dyn Fn() -> u64, ) -> Result<ManagedObjectPublication<'a>, CryptoError>
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>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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