pub struct RsaPublicKey {
pub n: BigUint,
pub e: BigUint,
}Expand description
Represents an RSA public key with arbitrary-size modulus and exponent.
Fields§
§n: BigUint§e: BigUintImplementations§
Source§impl RsaPublicKey
impl RsaPublicKey
Sourcepub fn from_be_bytes(n: &[u8], e: &[u8]) -> Result<Self>
pub fn from_be_bytes(n: &[u8], e: &[u8]) -> Result<Self>
Creates public key from big-endian modulus and exponent bytes.
§Arguments
n: RSA modulus encoded as big-endian bytes.e: RSA public exponent encoded as big-endian bytes.
§Returns
Parsed RsaPublicKey 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_public_components].
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears public key material to a zeroized placeholder state.
§Notes
This mirrors explicit key free/reset lifecycle flows from the C surface.
Sourcepub fn verify_pss_sha256(
&self,
msg: &[u8],
signature: &[u8],
salt_len: usize,
) -> Result<()>
pub fn verify_pss_sha256( &self, msg: &[u8], signature: &[u8], salt_len: usize, ) -> Result<()>
Sourcepub fn verify_pss_sha384(
&self,
msg: &[u8],
signature: &[u8],
salt_len: usize,
) -> Result<()>
pub fn verify_pss_sha384( &self, msg: &[u8], signature: &[u8], salt_len: usize, ) -> Result<()>
Sourcepub fn encrypt_pkcs1_v15_auto(
&self,
plaintext: &[u8],
drbg: &mut HmacDrbgSha256,
) -> Result<Vec<u8>>
pub fn encrypt_pkcs1_v15_auto( &self, plaintext: &[u8], drbg: &mut HmacDrbgSha256, ) -> Result<Vec<u8>>
Sourcepub fn encrypt_oaep_sha256_auto(
&self,
plaintext: &[u8],
label: &[u8],
drbg: &mut HmacDrbgSha256,
) -> Result<Vec<u8>>
pub fn encrypt_oaep_sha256_auto( &self, plaintext: &[u8], label: &[u8], drbg: &mut HmacDrbgSha256, ) -> Result<Vec<u8>>
Trait Implementations§
Source§impl Clone for RsaPublicKey
impl Clone for RsaPublicKey
Source§fn clone(&self) -> RsaPublicKey
fn clone(&self) -> RsaPublicKey
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 moreAuto Trait Implementations§
impl Freeze for RsaPublicKey
impl RefUnwindSafe for RsaPublicKey
impl Send for RsaPublicKey
impl Sync for RsaPublicKey
impl Unpin for RsaPublicKey
impl UnsafeUnpin for RsaPublicKey
impl UnwindSafe for RsaPublicKey
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