pub struct RsaPrivateKey {
pub n: BigUint,
pub d: BigUint,
/* private fields */
}Expand description
Represents an RSA private key with arbitrary-size modulus and exponent.
Fields§
§n: BigUint§d: BigUintImplementations§
Source§impl RsaPrivateKey
impl RsaPrivateKey
Sourcepub fn from_be_bytes(n: &[u8], d: &[u8]) -> Result<Self>
pub fn from_be_bytes(n: &[u8], d: &[u8]) -> Result<Self>
Creates private key from big-endian modulus and private exponent bytes.
§Arguments
n: RSA modulus encoded as big-endian bytes.d: RSA private exponent encoded as big-endian bytes.
§Returns
Parsed RsaPrivateKey when both fields are non-empty.
§Errors
Returns Error::InvalidLength when fields are empty, or when modulus size is below
2048 bits in default-safe builds (legacy-compatible hazardous mode permits smaller imports),
or other RSA component validation errors from [validate_private_components].
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears private key material to a zeroized placeholder state.
§Notes
This mirrors explicit key free/reset lifecycle flows from the C surface.
Sourcepub fn with_crt_components(
self,
p: &[u8],
q: &[u8],
dp: &[u8],
dq: &[u8],
qinv: &[u8],
) -> Result<Self>
pub fn with_crt_components( self, p: &[u8], q: &[u8], dp: &[u8], dq: &[u8], qinv: &[u8], ) -> Result<Self>
Trait Implementations§
Source§impl Clone for RsaPrivateKey
impl Clone for RsaPrivateKey
Source§fn clone(&self) -> RsaPrivateKey
fn clone(&self) -> RsaPrivateKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RsaPrivateKey
impl Debug for RsaPrivateKey
Source§impl Drop for RsaPrivateKey
impl Drop for RsaPrivateKey
Auto Trait Implementations§
impl Freeze for RsaPrivateKey
impl RefUnwindSafe for RsaPrivateKey
impl Send for RsaPrivateKey
impl Sync for RsaPrivateKey
impl Unpin for RsaPrivateKey
impl UnsafeUnpin for RsaPrivateKey
impl UnwindSafe for RsaPrivateKey
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