raw_decrypt

Function raw_decrypt 

Source
pub fn raw_decrypt(
    private_key: &RsaPrivateKey,
    encrypted_data: &[u8],
) -> Result<Vec<u8>, Box<dyn Error>>
Expand description

Decrypts data that was encrypted with the hybrid RSA + AES-GCM approach using a pre-parsed private key.

This is similar to decrypt but takes an already parsed RsaPrivateKey object rather than a PEM-encoded string.

§Arguments

  • private_key - The RSA private key object
  • encrypted_data - The encrypted data to decrypt (as serialized by encrypt or raw_encrypt)

§Returns

The decrypted plaintext data

§Errors

Returns an error if:

  • The encrypted data cannot be deserialized
  • The RSA decryption of the AES key fails
  • The AES decryption of the data fails