[−][src]Struct gpgme::context::Context
A context for cryptographic operations.
Upstream documentation:
gpgme_ctx_t
Methods
impl Context
[src]
pub unsafe fn from_raw(raw: gpgme_ctx_t) -> Self
[src]
pub fn as_raw(&self) -> gpgme_ctx_t
[src]
pub fn into_raw(self) -> gpgme_ctx_t
[src]
pub fn from_protocol(proto: Protocol) -> Result<Self>
[src]
Creates a new context and initializes it to work with the specified protocol.
Upstream documentation: gpgme_new
and gpgme_set_protocol
pub fn protocol(&self) -> Protocol
[src]
Upstream documentation:
gpgme_get_protocol
pub fn armor(&self) -> bool
[src]
Upstream documentation:
gpgme_get_armor
pub fn set_armor(&mut self, enabled: bool)
[src]
Upstream documentation:
gpgme_set_armor
pub fn text_mode(&self) -> bool
[src]
Upstream documentation:
gpgme_get_textmode
pub fn set_text_mode(&mut self, enabled: bool)
[src]
Upstream documentation:
gpgme_set_textmode
pub fn offline(&self) -> bool
[src]
Upstream documentation:
gpgme_get_offline
pub fn set_offline(&mut self, enabled: bool)
[src]
Upstream documentation:
gpgme_set_offline
pub fn get_flag(
&self,
name: impl CStrArgument
) -> Result<&str, Option<Utf8Error>>
[src]
&self,
name: impl CStrArgument
) -> Result<&str, Option<Utf8Error>>
Upstream documentation:
gpgme_get_ctx_flag
pub fn get_flag_raw(&self, name: impl CStrArgument) -> Option<&CStr>
[src]
Upstream documentation:
gpgme_get_ctx_flag
pub fn set_flag(
&mut self,
name: impl CStrArgument,
value: impl CStrArgument
) -> Result<()>
[src]
&mut self,
name: impl CStrArgument,
value: impl CStrArgument
) -> Result<()>
Upstream documentation:
gpgme_set_ctx_flag
pub fn engine_info(&self) -> EngineInfo
[src]
Upstream documentation:
gpgme_ctx_get_engine_info
pub fn set_engine_path(&mut self, path: impl CStrArgument) -> Result<()>
[src]
pub fn set_engine_home_dir(&mut self, home_dir: impl CStrArgument) -> Result<()>
[src]
pub fn set_engine_info(
&mut self,
path: Option<impl CStrArgument>,
home_dir: Option<impl CStrArgument>
) -> Result<()>
[src]
&mut self,
path: Option<impl CStrArgument>,
home_dir: Option<impl CStrArgument>
) -> Result<()>
Upstream documentation:
gpgme_ctx_set_engine_info
pub fn pinentry_mode(&self) -> PinentryMode
[src]
Upstream documentation:
gpgme_get_pinentry_mode
pub fn set_pinentry_mode(&mut self, mode: PinentryMode) -> Result<()>
[src]
Upstream documentation:
gpgme_set_pinentry_mode
pub fn clear_passphrase_provider(&mut self)
[src]
Upstream documentation:
gpgme_set_passphrase_cb
pub fn set_passphrase_provider<'a, P>(
self,
provider: P
) -> ContextWithCallbacks<'a> where
P: PassphraseProvider + 'a,
[src]
self,
provider: P
) -> ContextWithCallbacks<'a> where
P: PassphraseProvider + 'a,
Upstream documentation:
gpgme_set_passphrase_cb
pub fn with_passphrase_provider<R, P>(
&mut self,
provider: P,
f: impl FnOnce(&mut Context) -> R
) -> R where
P: PassphraseProvider,
[src]
&mut self,
provider: P,
f: impl FnOnce(&mut Context) -> R
) -> R where
P: PassphraseProvider,
Uses the specified provider to handle passphrase requests for the duration of the closure.
Upstream documentation:
gpgme_set_passphrase_cb
Examples
use std::io::prelude::*; use gpgme::{Context, PassphraseRequest, Protocol}; let mut ctx = Context::from_protocol(Protocol::OpenPgp)?; ctx.with_passphrase_provider(|_: PassphraseRequest, out: &mut dyn Write| { out.write_all(b"some passphrase")?; Ok(()) }, |mut ctx| { // Do something with ctx requiring a passphrase, for example decryption });
pub fn clear_progress_reporter(&mut self)
[src]
Upstream documentation:
gpgme_set_progress_cb
pub fn set_progress_reporter<'a, P>(
self,
reporter: P
) -> ContextWithCallbacks<'a> where
P: ProgressReporter + 'a,
[src]
self,
reporter: P
) -> ContextWithCallbacks<'a> where
P: ProgressReporter + 'a,
Upstream documentation:
gpgme_set_progress_cb
pub fn with_progress_reporter<R, H>(
&mut self,
handler: H,
f: impl FnOnce(&mut Context) -> R
) -> R where
H: ProgressReporter,
[src]
&mut self,
handler: H,
f: impl FnOnce(&mut Context) -> R
) -> R where
H: ProgressReporter,
Upstream documentation:
gpgme_set_progress_cb
pub fn with_progress_handler<R, H>(
&mut self,
handler: H,
f: impl FnOnce(&mut Context) -> R
) -> R where
H: ProgressHandler,
[src]
&mut self,
handler: H,
f: impl FnOnce(&mut Context) -> R
) -> R where
H: ProgressHandler,
use with_progress_reporter
instead
Upstream documentation:
gpgme_set_progress_cb
pub fn clear_status_handler(&mut self)
[src]
Upstream documentation:
gpgme_set_status_cb
pub fn set_status_handler<'a, H>(self, handler: H) -> ContextWithCallbacks<'a> where
H: StatusHandler + 'a,
[src]
H: StatusHandler + 'a,
Upstream documentation:
gpgme_set_status_cb
pub fn with_status_handler<R, H>(
&mut self,
handler: H,
f: impl FnOnce(&mut Context) -> R
) -> R where
H: StatusHandler,
[src]
&mut self,
handler: H,
f: impl FnOnce(&mut Context) -> R
) -> R where
H: StatusHandler,
Upstream documentation:
gpgme_set_status_cb
pub fn find_trust_items(
&mut self,
pattern: impl CStrArgument,
max_level: i32
) -> Result<TrustItems>
[src]
&mut self,
pattern: impl CStrArgument,
max_level: i32
) -> Result<TrustItems>
Returns an iterator yielding TrustItem
s matching the provided pattern.
Upstream documentation:
gpgme_op_trustlist_start
pub fn key_list_mode(&self) -> KeyListMode
[src]
Upstream documentation:
gpgme_get_keylist_mode
pub fn add_key_list_mode(&mut self, mask: KeyListMode) -> Result<()>
[src]
Adds all flags set in the provided key listing mode to the Context
's current mode.
Upstream documentation:
gpgme_set_keylist_mode
pub fn set_key_list_mode(&mut self, mode: KeyListMode) -> Result<()>
[src]
Upstream documentation:
gpgme_set_keylist_mode
pub fn keys(&mut self) -> Result<Keys>
[src]
Returns an iterator over all public keys available in the keyring.
pub fn secret_keys(&mut self) -> Result<Keys>
[src]
Returns an iterator over all secret keys available in the keyring.
pub fn refresh_key(&mut self, key: &Key) -> Result<Key>
[src]
Returns an updated version of the provided key.
pub fn get_key(&mut self, fpr: impl CStrArgument) -> Result<Key>
[src]
Returns the public key with the specified fingerprint, if such a key can be found. Otherwise, an error is returned.
Upstream documentation:
gpgme_get_key
pub fn get_secret_key(&mut self, fpr: impl CStrArgument) -> Result<Key>
[src]
Returns the secret key with the specified fingerprint, if such a key can be found. Otherwise, an error is returned.
Upstream documentation:
gpgme_get_key
pub fn locate_key(&mut self, email: impl CStrArgument) -> Result<Key>
[src]
pub fn find_key(&mut self, fpr: impl CStrArgument) -> Result<Key>
[src]
use get_key
instead
Upstream documentation:
gpgme_get_key
pub fn find_secret_key(&mut self, fpr: impl CStrArgument) -> Result<Key>
[src]
use get_secret_key
instead
Upstream documentation:
gpgme_get_key
pub fn find_keys<I>(&mut self, patterns: I) -> Result<Keys> where
I: IntoIterator,
I::Item: CStrArgument,
[src]
I: IntoIterator,
I::Item: CStrArgument,
Returns an iterator over a list of all public keys matching one or more of the specified patterns.
Upstream documentation:
gpgme_op_keylist_ext_start
pub fn find_secret_keys<I>(&mut self, patterns: I) -> Result<Keys> where
I: IntoIterator,
I::Item: CStrArgument,
[src]
I: IntoIterator,
I::Item: CStrArgument,
Returns an iterator over a list of all secret keys matching one or more of the specified patterns.
Upstream documentation:
gpgme_op_keylist_ext_start
pub fn read_keys<'s, 'd, D>(&'s mut self, src: D) -> Result<Keys<'d, D::Output>> where
D: IntoData<'d>,
's: 'd,
[src]
D: IntoData<'d>,
's: 'd,
Returns an iterator over the keys encoded in the specified source.
Upstream documentation:
gpgme_op_keylist_from_data_start
Examples
use gpgme::{Context, Data, Protocol}; let mut ctx = Context::from_protocol(Protocol::OpenPgp)?; let mut keyring = Data::load("somefile")?; for key in ctx.read_keys(&mut keyring)? { println!("{:?}", key); }
pub fn generate_key<'d1, 'd2, D1, D2>(
&mut self,
params: impl CStrArgument,
public: Option<D1>,
secret: Option<D2>
) -> Result<KeyGenerationResult> where
D1: IntoData<'d1>,
D2: IntoData<'d2>,
[src]
&mut self,
params: impl CStrArgument,
public: Option<D1>,
secret: Option<D2>
) -> Result<KeyGenerationResult> where
D1: IntoData<'d1>,
D2: IntoData<'d2>,
Upstream documentation:
gpgme_op_genkey
pub fn create_key(
&mut self,
userid: impl CStrArgument,
algo: impl CStrArgument,
expires: Option<SystemTime>
) -> Result<KeyGenerationResult>
[src]
&mut self,
userid: impl CStrArgument,
algo: impl CStrArgument,
expires: Option<SystemTime>
) -> Result<KeyGenerationResult>
Creates a new OpenPGP key.
Upstream documentation:
gpgme_op_createkey
Examples
use gpgme::{Context, Data, Protocol}; let mut ctx = Context::from_protocol(Protocol::OpenPgp)?; let result = ctx.create_key("Example User <example@example.com>", "default", None)?; println!("Key Fingerprint: {}", result.fingerprint().unwrap());
pub fn create_key_with_flags(
&mut self,
userid: impl CStrArgument,
algo: impl CStrArgument,
expires: Option<SystemTime>,
flags: CreateKeyFlags
) -> Result<KeyGenerationResult>
[src]
&mut self,
userid: impl CStrArgument,
algo: impl CStrArgument,
expires: Option<SystemTime>,
flags: CreateKeyFlags
) -> Result<KeyGenerationResult>
Upstream documentation:
gpgme_op_createkey
pub fn create_subkey(
&mut self,
key: &Key,
algo: impl CStrArgument,
expires: Option<SystemTime>
) -> Result<KeyGenerationResult>
[src]
&mut self,
key: &Key,
algo: impl CStrArgument,
expires: Option<SystemTime>
) -> Result<KeyGenerationResult>
Upstream documentation:
gpgme_op_createsubkey
pub fn create_subkey_with_flags(
&mut self,
key: &Key,
algo: impl CStrArgument,
expires: Option<SystemTime>,
flags: CreateKeyFlags
) -> Result<KeyGenerationResult>
[src]
&mut self,
key: &Key,
algo: impl CStrArgument,
expires: Option<SystemTime>,
flags: CreateKeyFlags
) -> Result<KeyGenerationResult>
Upstream documentation:
gpgme_op_createsubkey
pub fn add_uid(&mut self, key: &Key, userid: impl CStrArgument) -> Result<()>
[src]
Upstream documentation:
gpgme_op_adduid
pub fn revoke_uid(&mut self, key: &Key, userid: impl CStrArgument) -> Result<()>
[src]
Upstream documentation:
gpgme_op_revuid
pub fn set_uid_flag(
&mut self,
key: &Key,
userid: impl CStrArgument,
name: impl CStrArgument,
value: Option<impl CStrArgument>
) -> Result<()>
[src]
&mut self,
key: &Key,
userid: impl CStrArgument,
name: impl CStrArgument,
value: Option<impl CStrArgument>
) -> Result<()>
Upstream documentation:
gpgme_op_set_uid_flag
pub fn sign_key<I>(
&mut self,
key: &Key,
userids: I,
expires: Option<SystemTime>
) -> Result<()> where
I: IntoIterator,
I::Item: AsRef<[u8]>,
[src]
&mut self,
key: &Key,
userids: I,
expires: Option<SystemTime>
) -> Result<()> where
I: IntoIterator,
I::Item: AsRef<[u8]>,
Signs the given key with the default signing key, or the keys specified via
add_signer
.
Upstream documentation:
gpgme_op_keysign
pub fn sign_key_with_flags<I>(
&mut self,
key: &Key,
userids: I,
expires: Option<SystemTime>,
flags: KeySigningFlags
) -> Result<()> where
I: IntoIterator,
I::Item: AsRef<[u8]>,
[src]
&mut self,
key: &Key,
userids: I,
expires: Option<SystemTime>,
flags: KeySigningFlags
) -> Result<()> where
I: IntoIterator,
I::Item: AsRef<[u8]>,
Signs the given key with the default signing key, or the keys specified via
add_signer
.
Upstream documentation:
gpgme_op_keysign
pub fn change_key_tofu_policy(
&mut self,
key: &Key,
policy: TofuPolicy
) -> Result<()>
[src]
&mut self,
key: &Key,
policy: TofuPolicy
) -> Result<()>
Upstream documentation:
gpgme_op_tofu_policy
pub fn change_key_passphrase(&mut self, key: &Key) -> Result<()>
[src]
Upstream documentation:
gpgme_op_passwd
pub fn edit_key<'a, E, D>(
&mut self,
key: &Key,
interactor: E,
data: D
) -> Result<()> where
E: EditInteractor,
D: IntoData<'a>,
[src]
&mut self,
key: &Key,
interactor: E,
data: D
) -> Result<()> where
E: EditInteractor,
D: IntoData<'a>,
use interact
instead
Upstream documentation:
gpgme_op_edit
pub fn edit_card_key<'a, E, D>(
&mut self,
key: &Key,
interactor: E,
data: D
) -> Result<()> where
E: EditInteractor,
D: IntoData<'a>,
[src]
&mut self,
key: &Key,
interactor: E,
data: D
) -> Result<()> where
E: EditInteractor,
D: IntoData<'a>,
use interact_with_card
instead
Upstream documentation:
gpgme_op_card_edit
pub fn edit_key_with<'a, D>(
&mut self,
key: &Key,
editor: impl Editor,
data: D
) -> Result<()> where
D: IntoData<'a>,
[src]
&mut self,
key: &Key,
editor: impl Editor,
data: D
) -> Result<()> where
D: IntoData<'a>,
use interact
instead
Upstream documentation:
gpgme_op_edit
pub fn edit_card_key_with<'a, D>(
&mut self,
key: &Key,
editor: impl Editor,
data: D
) -> Result<()> where
D: IntoData<'a>,
[src]
&mut self,
key: &Key,
editor: impl Editor,
data: D
) -> Result<()> where
D: IntoData<'a>,
use interact_with_card
instead
Upstream documentation:
gpgme_op_card_edit
pub fn interact<'a, I, D>(
&mut self,
key: &Key,
interactor: I,
data: D
) -> Result<()> where
I: Interactor,
D: IntoData<'a>,
[src]
&mut self,
key: &Key,
interactor: I,
data: D
) -> Result<()> where
I: Interactor,
D: IntoData<'a>,
Upstream documentation:
gpgme_op_interact
pub fn interact_with_card<'a, I, D>(
&mut self,
key: &Key,
interactor: I,
data: D
) -> Result<()> where
I: Interactor,
D: IntoData<'a>,
[src]
&mut self,
key: &Key,
interactor: I,
data: D
) -> Result<()> where
I: Interactor,
D: IntoData<'a>,
Upstream documentation:
gpgme_op_interact
pub fn delete_key(&mut self, key: &Key) -> Result<()>
[src]
Upstream documentation:
gpgme_op_delete
pub fn delete_secret_key(&mut self, key: &Key) -> Result<()>
[src]
Upstream documentation:
gpgme_op_delete
pub fn delete_key_with_flags(
&mut self,
key: &Key,
flags: DeleteKeyFlags
) -> Result<()>
[src]
&mut self,
key: &Key,
flags: DeleteKeyFlags
) -> Result<()>
Upstream documentation:
gpgme_op_delete_ext
pub fn import<'a, D>(&mut self, src: D) -> Result<ImportResult> where
D: IntoData<'a>,
[src]
D: IntoData<'a>,
Upstream documentation:
gpgme_op_import
pub fn import_keys<'k, I>(&mut self, keys: I) -> Result<ImportResult> where
I: IntoIterator<Item = &'k Key>,
[src]
I: IntoIterator<Item = &'k Key>,
Upstream documentation:
gpgme_op_import_keys
pub fn export_all_extern<I>(&mut self, mode: ExportMode) -> Result<()> where
I: IntoIterator,
I::Item: CStrArgument,
[src]
I: IntoIterator,
I::Item: CStrArgument,
Upstream documentation:
gpgme_op_export_ext
pub fn export_extern<I>(&mut self, patterns: I, mode: ExportMode) -> Result<()> where
I: IntoIterator,
I::Item: CStrArgument,
[src]
I: IntoIterator,
I::Item: CStrArgument,
Upstream documentation:
gpgme_op_export_ext
pub fn export_all<'a, D>(&mut self, mode: ExportMode, dst: D) -> Result<()> where
D: IntoData<'a>,
[src]
D: IntoData<'a>,
Upstream documentation:
gpgme_op_export_ext
pub fn export<'a, I, D>(
&mut self,
patterns: I,
mode: ExportMode,
dst: D
) -> Result<()> where
I: IntoIterator,
I::Item: CStrArgument,
D: IntoData<'a>,
[src]
&mut self,
patterns: I,
mode: ExportMode,
dst: D
) -> Result<()> where
I: IntoIterator,
I::Item: CStrArgument,
D: IntoData<'a>,
Upstream documentation:
gpgme_op_export_ext
pub fn export_keys_extern<'k, I>(
&mut self,
keys: I,
mode: ExportMode
) -> Result<()> where
I: IntoIterator<Item = &'k Key>,
[src]
&mut self,
keys: I,
mode: ExportMode
) -> Result<()> where
I: IntoIterator<Item = &'k Key>,
Upstream documentation:
gpgme_op_export_keys
pub fn export_keys<'k, 'a, I, D>(
&mut self,
keys: I,
mode: ExportMode,
dst: D
) -> Result<()> where
I: IntoIterator<Item = &'k Key>,
D: IntoData<'a>,
[src]
&mut self,
keys: I,
mode: ExportMode,
dst: D
) -> Result<()> where
I: IntoIterator<Item = &'k Key>,
D: IntoData<'a>,
Upstream documentation:
gpgme_op_export_keys
pub fn clear_sender(&mut self) -> Result<()>
[src]
Upstream documentation:
gpgme_set_sender
pub fn set_sender(&mut self, sender: impl CStrArgument) -> Result<()>
[src]
Upstream documentation:
gpgme_set_sender
pub fn sender(&self) -> Result<&str, Option<Utf8Error>>
[src]
Upstream documentation:
gpgme_get_sender
pub fn sender_raw(&self) -> Option<&CStr>
[src]
Upstream documentation:
gpgme_get_sender
pub fn clear_signers(&mut self)
[src]
Upstream documentation:
gpgme_signers_clear
pub fn add_signer(&mut self, key: &Key) -> Result<()>
[src]
Upstream documentation:
gpgme_signers_add
ⓘImportant traits for Signers<'_>pub fn signers(&self) -> Signers
[src]
Upstream documentation:
gpgme_signers_enum
pub fn clear_signature_notations(&mut self)
[src]
Upstream documentation:
gpgme_sig_notation_clear
pub fn add_signature_notation(
&mut self,
name: impl CStrArgument,
value: impl CStrArgument,
flags: SignatureNotationFlags
) -> Result<()>
[src]
&mut self,
name: impl CStrArgument,
value: impl CStrArgument,
flags: SignatureNotationFlags
) -> Result<()>
Upstream documentation:
gpgme_sig_notation_add
pub fn add_signature_policy_url(
&mut self,
url: impl CStrArgument,
critical: bool
) -> Result<()>
[src]
&mut self,
url: impl CStrArgument,
critical: bool
) -> Result<()>
Upstream documentation:
gpgme_sig_notation_add
pub fn signature_policy_url(&self) -> Result<&str, Option<Utf8Error>>
[src]
Upstream documentation:
gpgme_sig_notation_get
pub fn signature_policy_url_raw(&self) -> Option<&CStr>
[src]
Upstream documentation:
gpgme_sig_notation_get
ⓘImportant traits for SignatureNotations<'a>pub fn signature_notations(&self) -> SignatureNotations
[src]
Upstream documentation:
gpgme_sig_notation_get
pub fn sign_clear<'p, 't, P, T>(
&mut self,
plaintext: P,
signedtext: T
) -> Result<SigningResult> where
P: IntoData<'p>,
T: IntoData<'t>,
[src]
&mut self,
plaintext: P,
signedtext: T
) -> Result<SigningResult> where
P: IntoData<'p>,
T: IntoData<'t>,
Creates a clear text signature.
Upstream documentation:
gpgme_op_sign
pub fn sign_detached<'p, 's, P, S>(
&mut self,
plaintext: P,
signature: S
) -> Result<SigningResult> where
P: IntoData<'p>,
S: IntoData<'s>,
[src]
&mut self,
plaintext: P,
signature: S
) -> Result<SigningResult> where
P: IntoData<'p>,
S: IntoData<'s>,
Creates a detached signature.
Upstream documentation:
gpgme_op_sign
pub fn sign_normal<'p, 't, P, T>(
&mut self,
plaintext: P,
signedtext: T
) -> Result<SigningResult> where
P: IntoData<'p>,
T: IntoData<'t>,
[src]
&mut self,
plaintext: P,
signedtext: T
) -> Result<SigningResult> where
P: IntoData<'p>,
T: IntoData<'t>,
Creates a normal signature.
Upstream documentation:
gpgme_op_sign
pub fn sign<'p, 's, P, S>(
&mut self,
mode: SignMode,
plaintext: P,
signature: S
) -> Result<SigningResult> where
P: IntoData<'p>,
S: IntoData<'s>,
[src]
&mut self,
mode: SignMode,
plaintext: P,
signature: S
) -> Result<SigningResult> where
P: IntoData<'p>,
S: IntoData<'s>,
Creates a signature for the text stored in the data object plaintext
and writes it to the
data object signature
.
The type of the signature created is determined by the ASCII armor (or, if that is not set, by the encoding specified for sig), the text mode attributes set for the context and the requested signature mode.
Information about the results of the operation are returned in the SigningResult
structure.
Upstream documentation:
gpgme_op_sign
pub fn verify_detached<'s, 't, S, T>(
&mut self,
signature: S,
signedtext: T
) -> Result<VerificationResult> where
S: IntoData<'s>,
T: IntoData<'t>,
[src]
&mut self,
signature: S,
signedtext: T
) -> Result<VerificationResult> where
S: IntoData<'s>,
T: IntoData<'t>,
Upstream documentation:
gpgme_op_verify
pub fn verify_opaque<'s, 'p, S, P>(
&mut self,
signedtext: S,
plaintext: P
) -> Result<VerificationResult> where
S: IntoData<'s>,
P: IntoData<'p>,
[src]
&mut self,
signedtext: S,
plaintext: P
) -> Result<VerificationResult> where
S: IntoData<'s>,
P: IntoData<'p>,
Upstream documentation:
gpgme_op_verify
pub fn encrypt<'k, 'p, 'c, I, P, C>(
&mut self,
recp: I,
plaintext: P,
ciphertext: C
) -> Result<EncryptionResult> where
I: IntoIterator<Item = &'k Key>,
P: IntoData<'p>,
C: IntoData<'c>,
[src]
&mut self,
recp: I,
plaintext: P,
ciphertext: C
) -> Result<EncryptionResult> where
I: IntoIterator<Item = &'k Key>,
P: IntoData<'p>,
C: IntoData<'c>,
Encrypts a message for the specified recipients.
Upstream documentation:
gpgme_op_encrypt
Examples
use gpgme::{Context, Data, Protocol}; let mut ctx = Context::from_protocol(Protocol::OpenPgp)?; let key = ctx.find_key("[some key fingerprint]")?; let (plaintext, mut ciphertext) = ("Hello, World!", Vec::new()); ctx.encrypt(Some(&key), plaintext, &mut ciphertext)?;
pub fn encrypt_with_flags<'k, 'p, 'c, I, P, C>(
&mut self,
recp: I,
plaintext: P,
ciphertext: C,
flags: EncryptFlags
) -> Result<EncryptionResult> where
I: IntoIterator<Item = &'k Key>,
P: IntoData<'p>,
C: IntoData<'c>,
[src]
&mut self,
recp: I,
plaintext: P,
ciphertext: C,
flags: EncryptFlags
) -> Result<EncryptionResult> where
I: IntoIterator<Item = &'k Key>,
P: IntoData<'p>,
C: IntoData<'c>,
Upstream documentation:
gpgme_op_encrypt
pub fn encrypt_symmetric<'p, 'c, P, C>(
&mut self,
plaintext: P,
ciphertext: C
) -> Result<()> where
P: IntoData<'p>,
C: IntoData<'c>,
[src]
&mut self,
plaintext: P,
ciphertext: C
) -> Result<()> where
P: IntoData<'p>,
C: IntoData<'c>,
Upstream documentation:
gpgme_op_encrypt
pub fn encrypt_symmetric_with_flags<'p, 'c, P, C>(
&mut self,
plaintext: P,
ciphertext: C,
flags: EncryptFlags
) -> Result<()> where
P: IntoData<'p>,
C: IntoData<'c>,
[src]
&mut self,
plaintext: P,
ciphertext: C,
flags: EncryptFlags
) -> Result<()> where
P: IntoData<'p>,
C: IntoData<'c>,
Upstream documentation:
gpgme_op_encrypt
pub fn sign_and_encrypt<'k, 'p, 'c, I, P, C>(
&mut self,
recp: I,
plaintext: P,
ciphertext: C
) -> Result<(EncryptionResult, SigningResult)> where
I: IntoIterator<Item = &'k Key>,
P: IntoData<'p>,
C: IntoData<'c>,
[src]
&mut self,
recp: I,
plaintext: P,
ciphertext: C
) -> Result<(EncryptionResult, SigningResult)> where
I: IntoIterator<Item = &'k Key>,
P: IntoData<'p>,
C: IntoData<'c>,
Encrypts and signs a message for the specified recipients.
Upstream documentation:
gpgme_op_encrypt_sign
Examples
use gpgme::{Context, Protocol}; let mut ctx = Context::from_protocol(Protocol::OpenPgp)?; let key = ctx.find_key("[some key fingerprint]")?; let (plaintext, mut ciphertext) = ("Hello, World!", Vec::new()); ctx.sign_and_encrypt(Some(&key), plaintext, &mut ciphertext)?;
pub fn sign_and_encrypt_with_flags<'k, 'p, 'c, I, P, C>(
&mut self,
recp: I,
plaintext: P,
ciphertext: C,
flags: EncryptFlags
) -> Result<(EncryptionResult, SigningResult)> where
I: IntoIterator<Item = &'k Key>,
P: IntoData<'p>,
C: IntoData<'c>,
[src]
&mut self,
recp: I,
plaintext: P,
ciphertext: C,
flags: EncryptFlags
) -> Result<(EncryptionResult, SigningResult)> where
I: IntoIterator<Item = &'k Key>,
P: IntoData<'p>,
C: IntoData<'c>,
Upstream documentation:
gpgme_op_encrypt_sign
pub fn decrypt<'c, 'p, C, P>(
&mut self,
ciphertext: C,
plaintext: P
) -> Result<DecryptionResult> where
C: IntoData<'c>,
P: IntoData<'p>,
[src]
&mut self,
ciphertext: C,
plaintext: P
) -> Result<DecryptionResult> where
C: IntoData<'c>,
P: IntoData<'p>,
Decrypts a message.
Upstream documentation:
gpgme_op_decrypt
Examples
use gpgme::{Context, Data, Protocol}; let mut ctx = Context::from_protocol(Protocol::OpenPgp)?; let mut cipher = Data::load("some file")?; let mut plain = Vec::new(); ctx.decrypt(&mut cipher, &mut plain)?;
pub fn decrypt_with_flags<'c, 'p, C, P>(
&mut self,
ciphertext: C,
plaintext: P,
flags: DecryptFlags
) -> Result<DecryptionResult> where
C: IntoData<'c>,
P: IntoData<'p>,
[src]
&mut self,
ciphertext: C,
plaintext: P,
flags: DecryptFlags
) -> Result<DecryptionResult> where
C: IntoData<'c>,
P: IntoData<'p>,
Upstream documentation:
gpgme_op_decrypt_ext
pub fn decrypt_and_verify<'c, 'p, C, P>(
&mut self,
ciphertext: C,
plaintext: P
) -> Result<(DecryptionResult, VerificationResult)> where
C: IntoData<'c>,
P: IntoData<'p>,
[src]
&mut self,
ciphertext: C,
plaintext: P
) -> Result<(DecryptionResult, VerificationResult)> where
C: IntoData<'c>,
P: IntoData<'p>,
Decrypts and verifies a message.
Upstream documentation:
gpgme_op_decrypt_verify
Examples
use gpgme::{Context, Data, Protocol}; let mut ctx = Context::from_protocol(Protocol::OpenPgp)?; let mut cipher = Data::load("some file")?; let mut plain = Vec::new(); ctx.decrypt_and_verify(&mut cipher, &mut plain)?;
pub fn decrypt_and_verify_with_flags<'c, 'p, C, P>(
&mut self,
ciphertext: C,
plaintext: P,
flags: DecryptFlags
) -> Result<(DecryptionResult, VerificationResult)> where
C: IntoData<'c>,
P: IntoData<'p>,
[src]
&mut self,
ciphertext: C,
plaintext: P,
flags: DecryptFlags
) -> Result<(DecryptionResult, VerificationResult)> where
C: IntoData<'c>,
P: IntoData<'p>,
Upstream documentation:
gpgme_op_decrypt_ext
pub fn query_swdb(
&mut self,
name: Option<impl CStrArgument>,
installed_ver: Option<impl CStrArgument>
) -> Result<QuerySwdbResult>
[src]
&mut self,
name: Option<impl CStrArgument>,
installed_ver: Option<impl CStrArgument>
) -> Result<QuerySwdbResult>
Upstream documentation:
gpgme_op_query_swdb
pub fn get_audit_log<'a, D>(
&mut self,
dst: D,
flags: AuditLogFlags
) -> Result<()> where
D: IntoData<'a>,
[src]
&mut self,
dst: D,
flags: AuditLogFlags
) -> Result<()> where
D: IntoData<'a>,
Upstream documentation:
gpgme_op_getauditlog
Trait Implementations
impl Drop for Context
[src]
impl<'_> From<Context> for ContextWithCallbacks<'_>
[src]
impl Debug for Context
[src]
Auto Trait Implementations
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
impl RefUnwindSafe for Context
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src where
Scheme: ApproxScheme,
[src]
Scheme: ApproxScheme,
type Err = NoError
The error type produced by a failed conversion.
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
[src]
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src where
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
[src]
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
[src]
impl<Src> ValueFrom<Src> for Src
[src]
type Err = NoError
The error type produced by a failed conversion.
fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
[src]
impl<Src, Dst> ValueInto<Dst> for Src where
Dst: ValueFrom<Src>,
[src]
Dst: ValueFrom<Src>,
type Err = <Dst as ValueFrom<Src>>::Err
The error type produced by a failed conversion.
fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>
[src]
impl<T> ConvUtil for T
[src]
fn approx_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
[src]
Self: ApproxInto<Dst, DefaultApprox>,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err> where
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
[src]
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
fn into_as<Dst>(self) -> Dst where
Self: Into<Dst>,
[src]
Self: Into<Dst>,
fn try_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: TryInto<Dst>,
[src]
Self: TryInto<Dst>,
fn value_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ValueInto<Dst>,
[src]
Self: ValueInto<Dst>,
impl<T, Dst> ConvAsUtil<Dst> for T
[src]
fn approx(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
[src]
Self: ApproxInto<Dst, DefaultApprox>,
fn approx_by<Scheme>(self) -> Result<Dst, Self::Err> where
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
[src]
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
impl<Src> TryFrom<Src> for Src
[src]
type Err = NoError
The error type produced by a failed conversion.
fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>
[src]
impl<Src, Dst> TryInto<Dst> for Src where
Dst: TryFrom<Src>,
[src]
Dst: TryFrom<Src>,