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();
Methods
impl Encryptor
[src]
impl Encryptor
pub fn new(key: &Pubkey, padding: &str) -> Result<Encryptor>
[src]
pub fn new(key: &Pubkey, padding: &str) -> Result<Encryptor>
Create a new public key encryptor object
pub fn encrypt(
&self,
ptext: &[u8],
rng: &RandomNumberGenerator
) -> Result<Vec<u8>>
[src]
pub fn encrypt(
&self,
ptext: &[u8],
rng: &RandomNumberGenerator
) -> Result<Vec<u8>>
Encrypt a message using the provided public key
Trait Implementations
impl Debug for Encryptor
[src]
impl Debug for Encryptor
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Drop for Encryptor
[src]
impl Drop for Encryptor