Trait rsa::PublicKey[][src]

pub trait PublicKey: EncryptionPrimitive + PublicKeyParts {
    fn encrypt<R: Rng>(
        &self,
        rng: &mut R,
        padding: PaddingScheme,
        msg: &[u8]
    ) -> Result<Vec<u8>>;
fn verify(
        &self,
        padding: PaddingScheme,
        hashed: &[u8],
        sig: &[u8]
    ) -> Result<()>; }
Expand description

Generic trait for operations on a public key.

Required methods

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

Expand description

Encrypt the given message.

fn verify(
    &self,
    padding: PaddingScheme,
    hashed: &[u8],
    sig: &[u8]
) -> Result<()>
[src]

Expand description

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...

Implementors

impl PublicKey for RSAPublicKey[src]

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

fn verify(
    &self,
    padding: PaddingScheme,
    hashed: &[u8],
    sig: &[u8]
) -> Result<()>
[src]

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

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

fn verify(
    &self,
    padding: PaddingScheme,
    hashed: &[u8],
    sig: &[u8]
) -> Result<()>
[src]

Loading content...