pub struct RsaKeyUnwrapper { /* private fields */ }Expand description
RSA-OAEP key unwrapper for decrypting Column Encryption Keys.
Implementations§
Source§impl RsaKeyUnwrapper
impl RsaKeyUnwrapper
Sourcepub fn from_pem(pem: &str) -> Result<Self, EncryptionError>
pub fn from_pem(pem: &str) -> Result<Self, EncryptionError>
Sourcepub fn from_der(der: &[u8]) -> Result<Self, EncryptionError>
pub fn from_der(der: &[u8]) -> Result<Self, EncryptionError>
Sourcepub fn from_key(private_key: RsaPrivateKey) -> Self
pub fn from_key(private_key: RsaPrivateKey) -> Self
Create a new unwrapper from an existing RSA private key.
Sourcepub fn decrypt_cek(
&self,
encrypted_cek: &[u8],
) -> Result<Vec<u8>, EncryptionError>
pub fn decrypt_cek( &self, encrypted_cek: &[u8], ) -> Result<Vec<u8>, EncryptionError>
Decrypt a Column Encryption Key (CEK) using RSA-OAEP.
Parses the canonical envelope, verifies its signature against this CMK’s public key, and unwraps the CEK.
§Arguments
encrypted_cek- The encrypted CEK envelope
§Returns
The decrypted CEK (32 bytes for AES-256).
§Errors
Returns an error if:
- The encrypted CEK envelope is invalid
- The ciphertext or signature length does not match the RSA key size
- Signature verification fails
- RSA decryption fails
Sourcepub fn decrypt_raw(&self, ciphertext: &[u8]) -> Result<Vec<u8>, EncryptionError>
pub fn decrypt_raw(&self, ciphertext: &[u8]) -> Result<Vec<u8>, EncryptionError>
Decrypt raw RSA-OAEP ciphertext (without SQL Server header).
Use this when you have just the RSA ciphertext without the SQL Server envelope.
Auto Trait Implementations§
impl Freeze for RsaKeyUnwrapper
impl RefUnwindSafe for RsaKeyUnwrapper
impl Send for RsaKeyUnwrapper
impl Sync for RsaKeyUnwrapper
impl Unpin for RsaKeyUnwrapper
impl UnsafeUnpin for RsaKeyUnwrapper
impl UnwindSafe for RsaKeyUnwrapper
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