Struct rsa::RSAPublicKey
source · pub struct RSAPublicKey { /* private fields */ }
Expand description
Represents the public part of an RSA key.
Implementations§
source§impl RSAPublicKey
impl RSAPublicKey
sourcepub fn encrypt<R: Rng>(
&self,
rng: &mut R,
padding: PaddingScheme,
msg: &[u8]
) -> Result<Vec<u8>>
pub fn encrypt<R: Rng>(
&self,
rng: &mut R,
padding: PaddingScheme,
msg: &[u8]
) -> Result<Vec<u8>>
Encrypt the given message.
sourcepub fn verify<H: Hash>(
&self,
padding: PaddingScheme,
hash: Option<&H>,
hashed: &[u8],
sig: &[u8]
) -> Result<()>
pub fn verify<H: Hash>(
&self,
padding: PaddingScheme,
hash: Option<&H>,
hashed: &[u8],
sig: &[u8]
) -> Result<()>
Verify a signed message.
hashed
must be the result of hashing the input using the hashing function
passed in through hash
.
If the message is valid Ok(())
is returned, otherwiese an Err
indicating failure.
Trait Implementations§
source§impl Clone for RSAPublicKey
impl Clone for RSAPublicKey
source§fn clone(&self) -> RSAPublicKey
fn clone(&self) -> RSAPublicKey
Returns a copy of the value. Read more
1.0.0 · 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 RSAPublicKey
impl Debug for RSAPublicKey
source§impl From<RSAPrivateKey> for RSAPublicKey
impl From<RSAPrivateKey> for RSAPublicKey
source§fn from(private_key: RSAPrivateKey) -> Self
fn from(private_key: RSAPrivateKey) -> Self
Converts to this type from the input type.