Skip to main content

KeyRecoveryKey

Trait KeyRecoveryKey 

Source
pub trait KeyRecoveryKey: Send + Sync {
    // Required methods
    fn rsa_modulus_bits(&self) -> usize;
    fn rsa_public_exponent(&self) -> Option<u64>;
    fn ciphertext_len(&self) -> usize;
    fn recover_with_provider(
        &self,
        provider: &dyn CryptoProvider,
        parameters: &RsaOaepParameters,
        ciphertext: &[u8],
    ) -> Result<Vec<u8>, ProviderError>;

    // Provided methods
    fn recover_content_with_provider(
        &self,
        provider: &dyn CryptoProvider,
        parameters: &RsaOaepParameters,
        _content_algorithm: DataEncryptionAlgorithm,
        ciphertext: &[u8],
    ) -> Result<RecoveredContentKey, ProviderError> { ... }
    fn provider_name(&self) -> Option<&'static str> { ... }
    fn public_spki(&self) -> Option<&[u8]> { ... }
}
Expand description

Opaque private-key handle used to recover transported key bytes.

Private key material never crosses this boundary. The ciphertext size is public metadata required to reject malformed RSA inputs before dispatch.

Required Methods§

Source

fn rsa_modulus_bits(&self) -> usize

Exact mathematical bit length of the recovery key’s public modulus, excluding leading zero padding. Not the rounded ciphertext width.

Source

fn rsa_public_exponent(&self) -> Option<u64>

Public exponent of that same key, or None if wider than 64 bits. Opaque providers expose public metadata without copying private material.

Source

fn ciphertext_len(&self) -> usize

Exact RSA ciphertext width in bytes for the key used by Self::recover_with_provider.

Source

fn recover_with_provider( &self, provider: &dyn CryptoProvider, parameters: &RsaOaepParameters, ciphertext: &[u8], ) -> Result<Vec<u8>, ProviderError>

Execute OAEP recovery using the selected provider’s randomness.

Provided Methods§

Source

fn recover_content_with_provider( &self, provider: &dyn CryptoProvider, parameters: &RsaOaepParameters, _content_algorithm: DataEncryptionAlgorithm, ciphertext: &[u8], ) -> Result<RecoveredContentKey, ProviderError>

Recover without exporting a CEK when supported by the execution domain.

Source

fn provider_name(&self) -> Option<&'static str>

Native engine binding; an incompatible provider must reject this handle.

Source

fn public_spki(&self) -> Option<&[u8]>

Borrow the matching public SPKI when available for certificate binding.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl KeyRecoveryKey for RsaPrivateKey

Available on crate feature xmlenc only.

Implementors§

Source§

impl KeyRecoveryKey for RustCryptoRsaPrivateKey

Available on crate feature xmlenc only.