[][src]Trait rsa::PublicKey

pub trait PublicKey {
    fn n(&self) -> &BigUint;
fn e(&self) -> &BigUint;
fn encrypt<R: Rng>(
        &self,
        rng: &mut R,
        padding: PaddingScheme,
        msg: &[u8]
    ) -> Result<Vec<u8>>;
fn verify<H: Hash>(
        &self,
        padding: PaddingScheme,
        hash: Option<&H>,
        hashed: &[u8],
        sig: &[u8]
    ) -> Result<()>; fn size(&self) -> usize { ... } }

Generic trait for operations on a public key.

Required methods

fn n(&self) -> &BigUint

Returns the modulus of the key.

fn e(&self) -> &BigUint

Returns the public exponent of the key.

fn encrypt<R: Rng>(
    &self,
    rng: &mut R,
    padding: PaddingScheme,
    msg: &[u8]
) -> Result<Vec<u8>>

Encrypt the given message.

fn verify<H: Hash>(
    &self,
    padding: PaddingScheme,
    hash: Option<&H>,
    hashed: &[u8],
    sig: &[u8]
) -> Result<()>

Verify a signed message. hashedmust 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.

Loading content...

Provided methods

fn size(&self) -> usize

Returns the modulus size in bytes. Raw signatures and ciphertexts for or by this public key will have the same size.

Loading content...

Implementors

impl PublicKey for RSAPrivateKey[src]

impl PublicKey for RSAPublicKey[src]

impl<'a> PublicKey for &'a RSAPrivateKey[src]

impl<'a> PublicKey for &'a RSAPublicKey[src]

Loading content...