Trait prs_lib::crypto::IsContext[][src]

pub trait IsContext {
Show methods fn encrypt(
        &mut self,
        recipients: &Recipients,
        plaintext: Plaintext
    ) -> Result<Ciphertext>;
fn decrypt(&mut self, ciphertext: Ciphertext) -> Result<Plaintext>;
fn can_decrypt(&mut self, ciphertext: Ciphertext) -> Result<bool>;
fn keys_public(&mut self) -> Result<Vec<Key>>;
fn keys_private(&mut self) -> Result<Vec<Key>>;
fn import_key(&mut self, key: &[u8]) -> Result<()>;
fn export_key(&mut self, key: Key) -> Result<Vec<u8>>;
fn supports_proto(&self, proto: Proto) -> bool; fn encrypt_file(
        &mut self,
        recipients: &Recipients,
        plaintext: Plaintext,
        path: &Path
    ) -> Result<()> { ... }
fn decrypt_file(&mut self, path: &Path) -> Result<Plaintext> { ... }
fn can_decrypt_file(&mut self, path: &Path) -> Result<bool> { ... }
fn get_public_key(&mut self, fingerprint: &str) -> Result<Key> { ... }
fn find_public_keys(&mut self, fingerprints: &[&str]) -> Result<Vec<Key>> { ... }
fn import_key_file(&mut self, path: &Path) -> Result<()> { ... }
fn export_key_file(&mut self, key: Key, path: &Path) -> Result<()> { ... }
}

Defines generic crypto context.

Implemented on backend specific cryptography contexcts, makes using it possible through a single simple interface.

Required methods

fn encrypt(
    &mut self,
    recipients: &Recipients,
    plaintext: Plaintext
) -> Result<Ciphertext>
[src]

Encrypt plaintext for recipients.

fn decrypt(&mut self, ciphertext: Ciphertext) -> Result<Plaintext>[src]

Decrypt ciphertext.

fn can_decrypt(&mut self, ciphertext: Ciphertext) -> Result<bool>[src]

Check whether we can decrypt ciphertext.

fn keys_public(&mut self) -> Result<Vec<Key>>[src]

Obtain all public keys from keychain.

fn keys_private(&mut self) -> Result<Vec<Key>>[src]

Obtain all public keys from keychain.

fn import_key(&mut self, key: &[u8]) -> Result<()>[src]

Import the given key from bytes into keychain.

fn export_key(&mut self, key: Key) -> Result<Vec<u8>>[src]

Export the given key from the keychain as bytes.

fn supports_proto(&self, proto: Proto) -> bool[src]

Check whether this context supports the given protocol.

Loading content...

Provided methods

fn encrypt_file(
    &mut self,
    recipients: &Recipients,
    plaintext: Plaintext,
    path: &Path
) -> Result<()>
[src]

Encrypt plaintext and write it to the file.

fn decrypt_file(&mut self, path: &Path) -> Result<Plaintext>[src]

Decrypt ciphertext from file.

fn can_decrypt_file(&mut self, path: &Path) -> Result<bool>[src]

Check whether we can decrypt ciphertext from file.

fn get_public_key(&mut self, fingerprint: &str) -> Result<Key>[src]

Obtain a public key from keychain for fingerprint.

fn find_public_keys(&mut self, fingerprints: &[&str]) -> Result<Vec<Key>>[src]

Find public keys from keychain for fingerprints.

Skips fingerprints no key is found for.

fn import_key_file(&mut self, path: &Path) -> Result<()>[src]

Import the given key from a file into keychain.

fn export_key_file(&mut self, key: Key, path: &Path) -> Result<()>[src]

Export the given key from the keychain to a file.

Loading content...

Implementors

impl IsContext for prs_lib::crypto::backend::gnupg_bin::context::Context[src]

impl IsContext for prs_lib::crypto::backend::gpgme::context::Context[src]

impl IsContext for prs_lib::crypto::Context[src]

Loading content...