Struct botan::Encryptor[][src]

pub struct Encryptor { /* fields omitted */ }

An object that performs public key encryption

Examples

let rng = botan::RandomNumberGenerator::new_system().unwrap();
let rsa = botan::Privkey::create("RSA", "2048", &rng).unwrap();
let rsa_pub = rsa.pubkey().unwrap();
let enc = botan::Encryptor::new(&rsa_pub, "OAEP(SHA-256)").unwrap();
let ctext = enc.encrypt(&[1,2,3], &rng).unwrap();

Implementations

impl Encryptor[src]

pub fn new(key: &Pubkey, padding: &str) -> Result<Encryptor>[src]

Create a new public key encryptor object

pub fn encrypt(
    &self,
    ptext: &[u8],
    rng: &RandomNumberGenerator
) -> Result<Vec<u8>>
[src]

Encrypt a message using the provided public key

Trait Implementations

impl Debug for Encryptor[src]

impl Drop for Encryptor[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.