pub struct PrivateDecryptingKey(/* private fields */);
Expand description
An RSA private key used for decrypting ciphertext encrypted by a PublicEncryptingKey
.
Implementations§
Source§impl PrivateDecryptingKey
impl PrivateDecryptingKey
Sourcepub fn generate(size: KeySize) -> Result<Self, Unspecified>
pub fn generate(size: KeySize) -> Result<Self, Unspecified>
Generate a new RSA private key pair for use with asymmetrical encryption.
Supports the following key sizes:
KeySize::Rsa2048
KeySize::Rsa3072
KeySize::Rsa4096
KeySize::Rsa8192
§Errors
Unspecified
for any error that occurs during the generation of the RSA keypair.
Sourcepub fn from_pkcs8(pkcs8: &[u8]) -> Result<Self, KeyRejected>
pub fn from_pkcs8(pkcs8: &[u8]) -> Result<Self, KeyRejected>
Construct a PrivateDecryptingKey
from the provided PKCS#8 (v1) document.
Supports RSA key sizes between 2048 and 8192 (inclusive).
§Errors
Unspecified
for any error that occurs during deserialization of this key from PKCS#8.
Sourcepub fn key_size_bytes(&self) -> usize
pub fn key_size_bytes(&self) -> usize
Returns the RSA key size in bytes.
Sourcepub fn key_size_bits(&self) -> usize
pub fn key_size_bits(&self) -> usize
Returns the RSA key size in bits.
Sourcepub fn public_key(&self) -> PublicEncryptingKey
pub fn public_key(&self) -> PublicEncryptingKey
Retrieves the PublicEncryptingKey
corresponding with this PrivateDecryptingKey
.
Trait Implementations§
Source§impl AsDer<Pkcs8V1Der<'static>> for PrivateDecryptingKey
impl AsDer<Pkcs8V1Der<'static>> for PrivateDecryptingKey
Source§fn as_der(&self) -> Result<Pkcs8V1Der<'static>, Unspecified>
fn as_der(&self) -> Result<Pkcs8V1Der<'static>, Unspecified>
Serializes into a DER format. Read more
Source§impl Clone for PrivateDecryptingKey
impl Clone for PrivateDecryptingKey
Auto Trait Implementations§
impl Freeze for PrivateDecryptingKey
impl RefUnwindSafe for PrivateDecryptingKey
impl !Send for PrivateDecryptingKey
impl !Sync for PrivateDecryptingKey
impl Unpin for PrivateDecryptingKey
impl UnwindSafe for PrivateDecryptingKey
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