pub struct Context(_);
Expand description
A context for cryptographic operations.
Upstream documentation:
gpgme_ctx_t
Implementations
sourceimpl Context
impl Context
pub unsafe fn from_raw(raw: gpgme_ctx_t) -> Self
pub fn as_raw(&self) -> gpgme_ctx_t
pub fn into_raw(self) -> gpgme_ctx_t
sourcepub fn from_protocol(proto: Protocol) -> Result<Self>
pub fn from_protocol(proto: Protocol) -> Result<Self>
Creates a new context and initializes it to work with the specified protocol.
Upstream documentation: gpgme_new
and gpgme_set_protocol
sourcepub fn protocol(&self) -> Protocol
pub fn protocol(&self) -> Protocol
Upstream documentation:
gpgme_get_protocol
sourcepub fn armor(&self) -> bool
pub fn armor(&self) -> bool
Upstream documentation:
gpgme_get_armor
sourcepub fn set_armor(&mut self, enabled: bool)
pub fn set_armor(&mut self, enabled: bool)
Upstream documentation:
gpgme_set_armor
sourcepub fn text_mode(&self) -> bool
pub fn text_mode(&self) -> bool
Upstream documentation:
gpgme_get_textmode
sourcepub fn set_text_mode(&mut self, enabled: bool)
pub fn set_text_mode(&mut self, enabled: bool)
Upstream documentation:
gpgme_set_textmode
sourcepub fn offline(&self) -> bool
pub fn offline(&self) -> bool
Upstream documentation:
gpgme_get_offline
sourcepub fn set_offline(&mut self, enabled: bool)
pub fn set_offline(&mut self, enabled: bool)
Upstream documentation:
gpgme_set_offline
sourcepub fn get_flag(
&self,
name: impl CStrArgument
) -> Result<&str, Option<Utf8Error>>
pub fn get_flag(
&self,
name: impl CStrArgument
) -> Result<&str, Option<Utf8Error>>
Upstream documentation:
gpgme_get_ctx_flag
sourcepub fn get_flag_raw(&self, name: impl CStrArgument) -> Option<&CStr>
pub fn get_flag_raw(&self, name: impl CStrArgument) -> Option<&CStr>
Upstream documentation:
gpgme_get_ctx_flag
sourcepub fn set_flag(
&mut self,
name: impl CStrArgument,
value: impl CStrArgument
) -> Result<()>
pub fn set_flag(
&mut self,
name: impl CStrArgument,
value: impl CStrArgument
) -> Result<()>
Upstream documentation:
gpgme_set_ctx_flag
sourcepub fn engine_info(&self) -> EngineInfo<'_>
pub fn engine_info(&self) -> EngineInfo<'_>
Upstream documentation:
gpgme_ctx_get_engine_info
pub fn set_engine_path(&mut self, path: impl CStrArgument) -> Result<()>
pub fn set_engine_home_dir(&mut self, home_dir: impl CStrArgument) -> Result<()>
sourcepub fn set_engine_info(
&mut self,
path: Option<impl CStrArgument>,
home_dir: Option<impl CStrArgument>
) -> Result<()>
pub fn set_engine_info(
&mut self,
path: Option<impl CStrArgument>,
home_dir: Option<impl CStrArgument>
) -> Result<()>
Upstream documentation:
gpgme_ctx_set_engine_info
sourcepub fn pinentry_mode(&self) -> PinentryMode
pub fn pinentry_mode(&self) -> PinentryMode
Upstream documentation:
gpgme_get_pinentry_mode
sourcepub fn set_pinentry_mode(&mut self, mode: PinentryMode) -> Result<()>
pub fn set_pinentry_mode(&mut self, mode: PinentryMode) -> Result<()>
Upstream documentation:
gpgme_set_pinentry_mode
sourcepub fn clear_passphrase_provider(&mut self)
pub fn clear_passphrase_provider(&mut self)
Upstream documentation:
gpgme_set_passphrase_cb
sourcepub fn set_passphrase_provider<'a, P>(
self,
provider: P
) -> ContextWithCallbacks<'a>where
P: PassphraseProvider + 'a,
pub fn set_passphrase_provider<'a, P>(
self,
provider: P
) -> ContextWithCallbacks<'a>where
P: PassphraseProvider + 'a,
Upstream documentation:
gpgme_set_passphrase_cb
sourcepub fn with_passphrase_provider<R, P>(
&mut self,
provider: P,
f: impl FnOnce(&mut Context) -> R
) -> Rwhere
P: PassphraseProvider,
pub fn with_passphrase_provider<R, P>(
&mut self,
provider: P,
f: impl FnOnce(&mut Context) -> R
) -> Rwhere
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
});
sourcepub fn clear_progress_reporter(&mut self)
pub fn clear_progress_reporter(&mut self)
Upstream documentation:
gpgme_set_progress_cb
sourcepub fn set_progress_reporter<'a, P>(
self,
reporter: P
) -> ContextWithCallbacks<'a>where
P: ProgressReporter + 'a,
pub fn set_progress_reporter<'a, P>(
self,
reporter: P
) -> ContextWithCallbacks<'a>where
P: ProgressReporter + 'a,
Upstream documentation:
gpgme_set_progress_cb
sourcepub fn with_progress_reporter<R, H>(
&mut self,
handler: H,
f: impl FnOnce(&mut Context) -> R
) -> Rwhere
H: ProgressReporter,
pub fn with_progress_reporter<R, H>(
&mut self,
handler: H,
f: impl FnOnce(&mut Context) -> R
) -> Rwhere
H: ProgressReporter,
Upstream documentation:
gpgme_set_progress_cb
sourcepub fn clear_status_handler(&mut self)
pub fn clear_status_handler(&mut self)
Upstream documentation:
gpgme_set_status_cb
sourcepub fn set_status_handler<'a, H>(self, handler: H) -> ContextWithCallbacks<'a>where
H: StatusHandler + 'a,
pub fn set_status_handler<'a, H>(self, handler: H) -> ContextWithCallbacks<'a>where
H: StatusHandler + 'a,
Upstream documentation:
gpgme_set_status_cb
sourcepub fn with_status_handler<R, H>(
&mut self,
handler: H,
f: impl FnOnce(&mut Context) -> R
) -> Rwhere
H: StatusHandler,
pub fn with_status_handler<R, H>(
&mut self,
handler: H,
f: impl FnOnce(&mut Context) -> R
) -> Rwhere
H: StatusHandler,
Upstream documentation:
gpgme_set_status_cb
sourcepub fn key_list_mode(&self) -> KeyListMode
pub fn key_list_mode(&self) -> KeyListMode
Upstream documentation:
gpgme_get_keylist_mode
sourcepub fn add_key_list_mode(&mut self, mask: KeyListMode) -> Result<()>
pub fn add_key_list_mode(&mut self, mask: KeyListMode) -> Result<()>
Adds all flags set in the provided key listing mode to the Context
’s current mode.
Upstream documentation:
gpgme_set_keylist_mode
sourcepub fn set_key_list_mode(&mut self, mode: KeyListMode) -> Result<()>
pub fn set_key_list_mode(&mut self, mode: KeyListMode) -> Result<()>
Upstream documentation:
gpgme_set_keylist_mode
sourcepub fn keys(&mut self) -> Result<Keys<'_>>
pub fn keys(&mut self) -> Result<Keys<'_>>
Returns an iterator over all public keys available in the keyring.
sourcepub fn secret_keys(&mut self) -> Result<Keys<'_>>
pub fn secret_keys(&mut self) -> Result<Keys<'_>>
Returns an iterator over all secret keys available in the keyring.
sourcepub fn refresh_key(&mut self, key: &Key) -> Result<Key>
pub fn refresh_key(&mut self, key: &Key) -> Result<Key>
Returns an updated version of the provided key.
sourcepub fn get_key(&mut self, fpr: impl CStrArgument) -> Result<Key>
pub fn get_key(&mut self, fpr: impl CStrArgument) -> Result<Key>
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
sourcepub fn get_secret_key(&mut self, fpr: impl CStrArgument) -> Result<Key>
pub fn get_secret_key(&mut self, fpr: impl CStrArgument) -> Result<Key>
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>
sourcepub fn find_keys<I>(&mut self, patterns: I) -> Result<Keys<'_>>where
I: IntoIterator,
I::Item: CStrArgument,
pub fn find_keys<I>(&mut self, patterns: I) -> Result<Keys<'_>>where
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
sourcepub fn find_secret_keys<I>(&mut self, patterns: I) -> Result<Keys<'_>>where
I: IntoIterator,
I::Item: CStrArgument,
pub fn find_secret_keys<I>(&mut self, patterns: I) -> Result<Keys<'_>>where
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
sourcepub fn read_keys<'s, 'd, D>(&'s mut self, src: D) -> Result<Keys<'d, D::Output>>where
D: IntoData<'d>,
's: 'd,
pub fn read_keys<'s, 'd, D>(&'s mut self, src: D) -> Result<Keys<'d, D::Output>>where
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);
}
sourcepub 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>,
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>,
Upstream documentation:
gpgme_op_genkey
sourcepub fn create_key(
&mut self,
userid: impl CStrArgument,
algo: impl CStrArgument,
expires: Duration
) -> Result<KeyGenerationResult>
pub fn create_key(
&mut self,
userid: impl CStrArgument,
algo: impl CStrArgument,
expires: Duration
) -> 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", Default::default())?;
println!("Key Fingerprint: {}", result.fingerprint().unwrap());
sourcepub fn create_key_with_flags(
&mut self,
userid: impl CStrArgument,
algo: impl CStrArgument,
expires: Duration,
flags: CreateKeyFlags
) -> Result<KeyGenerationResult>
pub fn create_key_with_flags(
&mut self,
userid: impl CStrArgument,
algo: impl CStrArgument,
expires: Duration,
flags: CreateKeyFlags
) -> Result<KeyGenerationResult>
Upstream documentation:
gpgme_op_createkey
sourcepub fn create_subkey(
&mut self,
key: &Key,
algo: impl CStrArgument,
expires: Duration
) -> Result<KeyGenerationResult>
pub fn create_subkey(
&mut self,
key: &Key,
algo: impl CStrArgument,
expires: Duration
) -> Result<KeyGenerationResult>
Upstream documentation:
gpgme_op_createsubkey
sourcepub fn create_subkey_with_flags(
&mut self,
key: &Key,
algo: impl CStrArgument,
expires: Duration,
flags: CreateKeyFlags
) -> Result<KeyGenerationResult>
pub fn create_subkey_with_flags(
&mut self,
key: &Key,
algo: impl CStrArgument,
expires: Duration,
flags: CreateKeyFlags
) -> Result<KeyGenerationResult>
Upstream documentation:
gpgme_op_createsubkey
sourcepub fn set_expire_all(&mut self, key: &Key, expires: Duration) -> Result<()>
pub fn set_expire_all(&mut self, key: &Key, expires: Duration) -> Result<()>
Upstream documentation:
gpgme_op_setexpire
sourcepub fn set_expire<I>(
&mut self,
key: &Key,
expires: Duration,
subkeys: I
) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
pub fn set_expire<I>(
&mut self,
key: &Key,
expires: Duration,
subkeys: I
) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
Upstream documentation:
gpgme_op_setexpire
sourcepub fn add_uid(&mut self, key: &Key, userid: impl CStrArgument) -> Result<()>
pub fn add_uid(&mut self, key: &Key, userid: impl CStrArgument) -> Result<()>
Upstream documentation:
gpgme_op_adduid
sourcepub fn revoke_uid(&mut self, key: &Key, userid: impl CStrArgument) -> Result<()>
pub fn revoke_uid(&mut self, key: &Key, userid: impl CStrArgument) -> Result<()>
Upstream documentation:
gpgme_op_revuid
sourcepub fn set_uid_flag(
&mut self,
key: &Key,
userid: impl CStrArgument,
name: impl CStrArgument,
value: Option<impl CStrArgument>
) -> Result<()>
pub fn set_uid_flag(
&mut self,
key: &Key,
userid: impl CStrArgument,
name: impl CStrArgument,
value: Option<impl CStrArgument>
) -> Result<()>
Upstream documentation:
gpgme_op_set_uid_flag
pub fn set_primary_uid(
&mut self,
key: &Key,
userid: impl CStrArgument
) -> Result<()>
sourcepub fn sign_key<I>(
&mut self,
key: &Key,
userids: I,
expires: Duration
) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
pub fn sign_key<I>(
&mut self,
key: &Key,
userids: I,
expires: Duration
) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
Signs the given key with the default signing key, or the keys specified via
add_signer
.
Upstream documentation:
gpgme_op_keysign
sourcepub fn sign_key_with_flags<I>(
&mut self,
key: &Key,
userids: I,
expires: Duration,
flags: KeySigningFlags
) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
pub fn sign_key_with_flags<I>(
&mut self,
key: &Key,
userids: I,
expires: Duration,
flags: KeySigningFlags
) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
Signs the given key with the default signing key, or the keys specified via
add_signer
.
Upstream documentation:
gpgme_op_keysign
sourcepub fn revoke_signature<I>(
&mut self,
key: &Key,
signing_key: &Key,
userids: I
) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
pub fn revoke_signature<I>(
&mut self,
key: &Key,
signing_key: &Key,
userids: I
) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
Upstream documentation:
gpgme_op_revsig
sourcepub fn change_key_tofu_policy(
&mut self,
key: &Key,
policy: TofuPolicy
) -> Result<()>
pub fn change_key_tofu_policy(
&mut self,
key: &Key,
policy: TofuPolicy
) -> Result<()>
Upstream documentation:
gpgme_op_tofu_policy
sourcepub fn change_key_passphrase(&mut self, key: &Key) -> Result<()>
pub fn change_key_passphrase(&mut self, key: &Key) -> Result<()>
Upstream documentation:
gpgme_op_passwd
sourcepub fn edit_key<'a, E, D>(
&mut self,
key: &Key,
interactor: E,
data: D
) -> Result<()>where
E: EditInteractor,
D: IntoData<'a>,
👎Deprecated since 0.9.2: use interact
instead
pub fn edit_key<'a, E, D>(
&mut self,
key: &Key,
interactor: E,
data: D
) -> Result<()>where
E: EditInteractor,
D: IntoData<'a>,
interact
insteadUpstream documentation:
gpgme_op_edit
sourcepub fn edit_card_key<'a, E, D>(
&mut self,
key: &Key,
interactor: E,
data: D
) -> Result<()>where
E: EditInteractor,
D: IntoData<'a>,
👎Deprecated since 0.9.2: use interact_with_card
instead
pub fn edit_card_key<'a, E, D>(
&mut self,
key: &Key,
interactor: E,
data: D
) -> Result<()>where
E: EditInteractor,
D: IntoData<'a>,
interact_with_card
insteadUpstream documentation:
gpgme_op_card_edit
sourcepub fn edit_key_with<'a, D>(
&mut self,
key: &Key,
editor: impl Editor,
data: D
) -> Result<()>where
D: IntoData<'a>,
👎Deprecated since 0.9.2: use interact
instead
pub fn edit_key_with<'a, D>(
&mut self,
key: &Key,
editor: impl Editor,
data: D
) -> Result<()>where
D: IntoData<'a>,
interact
insteadUpstream documentation:
gpgme_op_edit
sourcepub fn edit_card_key_with<'a, D>(
&mut self,
key: &Key,
editor: impl Editor,
data: D
) -> Result<()>where
D: IntoData<'a>,
👎Deprecated since 0.9.2: use interact_with_card
instead
pub fn edit_card_key_with<'a, D>(
&mut self,
key: &Key,
editor: impl Editor,
data: D
) -> Result<()>where
D: IntoData<'a>,
interact_with_card
insteadUpstream documentation:
gpgme_op_card_edit
sourcepub fn interact<'a, I, D>(
&mut self,
key: &Key,
interactor: I,
data: D
) -> Result<()>where
I: Interactor,
D: IntoData<'a>,
pub fn interact<'a, I, D>(
&mut self,
key: &Key,
interactor: I,
data: D
) -> Result<()>where
I: Interactor,
D: IntoData<'a>,
Upstream documentation:
gpgme_op_interact
sourcepub fn interact_with_card<'a, I, D>(
&mut self,
key: &Key,
interactor: I,
data: D
) -> Result<()>where
I: Interactor,
D: IntoData<'a>,
pub fn interact_with_card<'a, I, D>(
&mut self,
key: &Key,
interactor: I,
data: D
) -> Result<()>where
I: Interactor,
D: IntoData<'a>,
Upstream documentation:
gpgme_op_interact
sourcepub fn interact_with_flags<'a, I, D>(
&mut self,
key: Option<&Key>,
interactor: I,
data: D,
flags: InteractFlags
) -> Result<()>where
I: Interactor,
D: IntoData<'a>,
pub fn interact_with_flags<'a, I, D>(
&mut self,
key: Option<&Key>,
interactor: I,
data: D,
flags: InteractFlags
) -> Result<()>where
I: Interactor,
D: IntoData<'a>,
Upstream documentation:
gpgme_op_interact
sourcepub fn delete_key(&mut self, key: &Key) -> Result<()>
pub fn delete_key(&mut self, key: &Key) -> Result<()>
Upstream documentation:
gpgme_op_delete
sourcepub fn delete_secret_key(&mut self, key: &Key) -> Result<()>
pub fn delete_secret_key(&mut self, key: &Key) -> Result<()>
Upstream documentation:
gpgme_op_delete
sourcepub fn delete_key_with_flags(
&mut self,
key: &Key,
flags: DeleteKeyFlags
) -> Result<()>
pub fn delete_key_with_flags(
&mut self,
key: &Key,
flags: DeleteKeyFlags
) -> Result<()>
Upstream documentation:
gpgme_op_delete_ext
sourcepub fn import<'a, D>(&mut self, src: D) -> Result<ImportResult>where
D: IntoData<'a>,
pub fn import<'a, D>(&mut self, src: D) -> Result<ImportResult>where
D: IntoData<'a>,
Upstream documentation:
gpgme_op_import
sourcepub fn import_keys<'k, I>(&mut self, keys: I) -> Result<ImportResult>where
I: IntoIterator<Item = &'k Key>,
pub fn import_keys<'k, I>(&mut self, keys: I) -> Result<ImportResult>where
I: IntoIterator<Item = &'k Key>,
Upstream documentation:
gpgme_op_import_keys
sourcepub fn import_remote_keys<I>(&mut self, uids: I) -> Result<ImportResult>where
I: IntoIterator,
I::Item: CStrArgument,
pub fn import_remote_keys<I>(&mut self, uids: I) -> Result<ImportResult>where
I: IntoIterator,
I::Item: CStrArgument,
Upstream documentation:
gpgme_op_receive_keys
sourcepub fn export_all_extern<I>(&mut self, mode: ExportMode) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
pub fn export_all_extern<I>(&mut self, mode: ExportMode) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
Upstream documentation:
gpgme_op_export_ext
sourcepub fn export_extern<I>(&mut self, patterns: I, mode: ExportMode) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
pub fn export_extern<I>(&mut self, patterns: I, mode: ExportMode) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
Upstream documentation:
gpgme_op_export_ext
sourcepub fn export_all<'a, D>(&mut self, mode: ExportMode, dst: D) -> Result<()>where
D: IntoData<'a>,
pub fn export_all<'a, D>(&mut self, mode: ExportMode, dst: D) -> Result<()>where
D: IntoData<'a>,
Upstream documentation:
gpgme_op_export_ext
sourcepub fn export<'a, I, D>(
&mut self,
patterns: I,
mode: ExportMode,
dst: D
) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
D: IntoData<'a>,
pub fn export<'a, I, D>(
&mut self,
patterns: I,
mode: ExportMode,
dst: D
) -> Result<()>where
I: IntoIterator,
I::Item: CStrArgument,
D: IntoData<'a>,
Upstream documentation:
gpgme_op_export_ext
sourcepub fn export_keys_extern<'k, I>(
&mut self,
keys: I,
mode: ExportMode
) -> Result<()>where
I: IntoIterator<Item = &'k Key>,
pub fn export_keys_extern<'k, I>(
&mut self,
keys: I,
mode: ExportMode
) -> Result<()>where
I: IntoIterator<Item = &'k Key>,
Upstream documentation:
gpgme_op_export_keys
sourcepub 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>,
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>,
Upstream documentation:
gpgme_op_export_keys
sourcepub fn clear_sender(&mut self) -> Result<()>
pub fn clear_sender(&mut self) -> Result<()>
Upstream documentation:
gpgme_set_sender
sourcepub fn set_sender(&mut self, sender: impl CStrArgument) -> Result<()>
pub fn set_sender(&mut self, sender: impl CStrArgument) -> Result<()>
Upstream documentation:
gpgme_set_sender
sourcepub fn sender(&self) -> Result<&str, Option<Utf8Error>>
pub fn sender(&self) -> Result<&str, Option<Utf8Error>>
Upstream documentation:
gpgme_get_sender
sourcepub fn sender_raw(&self) -> Option<&CStr>
pub fn sender_raw(&self) -> Option<&CStr>
Upstream documentation:
gpgme_get_sender
sourcepub fn clear_signers(&mut self)
pub fn clear_signers(&mut self)
Upstream documentation:
gpgme_signers_clear
sourcepub fn add_signer(&mut self, key: &Key) -> Result<()>
pub fn add_signer(&mut self, key: &Key) -> Result<()>
Upstream documentation:
gpgme_signers_add
sourcepub fn signers(&self) -> Signers<'_>ⓘNotable traits for Signers<'_>impl Iterator for Signers<'_> type Item = Key;
pub fn signers(&self) -> Signers<'_>ⓘNotable traits for Signers<'_>impl Iterator for Signers<'_> type Item = Key;
Upstream documentation:
gpgme_signers_enum
sourcepub fn clear_signature_notations(&mut self)
pub fn clear_signature_notations(&mut self)
Upstream documentation:
gpgme_sig_notation_clear
sourcepub fn add_signature_notation(
&mut self,
name: impl CStrArgument,
value: impl CStrArgument,
flags: SignatureNotationFlags
) -> Result<()>
pub fn add_signature_notation(
&mut self,
name: impl CStrArgument,
value: impl CStrArgument,
flags: SignatureNotationFlags
) -> Result<()>
Upstream documentation:
gpgme_sig_notation_add
sourcepub fn add_signature_policy_url(
&mut self,
url: impl CStrArgument,
critical: bool
) -> Result<()>
pub fn add_signature_policy_url(
&mut self,
url: impl CStrArgument,
critical: bool
) -> Result<()>
Upstream documentation:
gpgme_sig_notation_add
sourcepub fn signature_policy_url(&self) -> Result<&str, Option<Utf8Error>>
pub fn signature_policy_url(&self) -> Result<&str, Option<Utf8Error>>
Upstream documentation:
gpgme_sig_notation_get
sourcepub fn signature_policy_url_raw(&self) -> Option<&CStr>
pub fn signature_policy_url_raw(&self) -> Option<&CStr>
Upstream documentation:
gpgme_sig_notation_get
sourcepub fn signature_notations(&self) -> SignatureNotations<'_>ⓘNotable traits for SignatureNotations<'a>impl<'a> Iterator for SignatureNotations<'a> type Item = SignatureNotation<'a>;
pub fn signature_notations(&self) -> SignatureNotations<'_>ⓘNotable traits for SignatureNotations<'a>impl<'a> Iterator for SignatureNotations<'a> type Item = SignatureNotation<'a>;
Upstream documentation:
gpgme_sig_notation_get
sourcepub fn sign_clear<'p, 't, P, T>(
&mut self,
plaintext: P,
signedtext: T
) -> Result<SigningResult>where
P: IntoData<'p>,
T: IntoData<'t>,
pub fn sign_clear<'p, 't, P, T>(
&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
sourcepub fn sign_detached<'p, 's, P, S>(
&mut self,
plaintext: P,
signature: S
) -> Result<SigningResult>where
P: IntoData<'p>,
S: IntoData<'s>,
pub fn sign_detached<'p, 's, P, S>(
&mut self,
plaintext: P,
signature: S
) -> Result<SigningResult>where
P: IntoData<'p>,
S: IntoData<'s>,
Creates a detached signature.
Upstream documentation:
gpgme_op_sign
sourcepub fn sign_normal<'p, 't, P, T>(
&mut self,
plaintext: P,
signedtext: T
) -> Result<SigningResult>where
P: IntoData<'p>,
T: IntoData<'t>,
pub fn sign_normal<'p, 't, P, T>(
&mut self,
plaintext: P,
signedtext: T
) -> Result<SigningResult>where
P: IntoData<'p>,
T: IntoData<'t>,
Creates a normal signature.
Upstream documentation:
gpgme_op_sign
sourcepub fn sign<'p, 's, P, S>(
&mut self,
mode: SignMode,
plaintext: P,
signature: S
) -> Result<SigningResult>where
P: IntoData<'p>,
S: IntoData<'s>,
pub fn sign<'p, 's, P, S>(
&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
sourcepub fn verify_detached<'s, 't, S, T>(
&mut self,
signature: S,
signedtext: T
) -> Result<VerificationResult>where
S: IntoData<'s>,
T: IntoData<'t>,
pub fn verify_detached<'s, 't, S, T>(
&mut self,
signature: S,
signedtext: T
) -> Result<VerificationResult>where
S: IntoData<'s>,
T: IntoData<'t>,
Upstream documentation:
gpgme_op_verify
sourcepub fn verify_opaque<'s, 'p, S, P>(
&mut self,
signedtext: S,
plaintext: P
) -> Result<VerificationResult>where
S: IntoData<'s>,
P: IntoData<'p>,
pub fn verify_opaque<'s, 'p, S, P>(
&mut self,
signedtext: S,
plaintext: P
) -> Result<VerificationResult>where
S: IntoData<'s>,
P: IntoData<'p>,
Upstream documentation:
gpgme_op_verify
sourcepub 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>,
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>,
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.get_key("[some key fingerprint]")?;
let (plaintext, mut ciphertext) = ("Hello, World!", Vec::new());
ctx.encrypt(Some(&key), plaintext, &mut ciphertext)?;
sourcepub 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>,
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>,
Upstream documentation:
gpgme_op_encrypt
sourcepub fn encrypt_symmetric<'p, 'c, P, C>(
&mut self,
plaintext: P,
ciphertext: C
) -> Result<()>where
P: IntoData<'p>,
C: IntoData<'c>,
pub fn encrypt_symmetric<'p, 'c, P, C>(
&mut self,
plaintext: P,
ciphertext: C
) -> Result<()>where
P: IntoData<'p>,
C: IntoData<'c>,
Upstream documentation:
gpgme_op_encrypt
sourcepub 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>,
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>,
Upstream documentation:
gpgme_op_encrypt
sourcepub 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>,
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>,
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.get_key("[some key fingerprint]")?;
let (plaintext, mut ciphertext) = ("Hello, World!", Vec::new());
ctx.sign_and_encrypt(Some(&key), plaintext, &mut ciphertext)?;
sourcepub 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>,
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>,
Upstream documentation:
gpgme_op_encrypt_sign
sourcepub fn decrypt<'c, 'p, C, P>(
&mut self,
ciphertext: C,
plaintext: P
) -> Result<DecryptionResult>where
C: IntoData<'c>,
P: IntoData<'p>,
pub fn decrypt<'c, 'p, C, P>(
&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)?;
sourcepub 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>,
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>,
Upstream documentation:
gpgme_op_decrypt_ext
sourcepub fn decrypt_and_verify<'c, 'p, C, P>(
&mut self,
ciphertext: C,
plaintext: P
) -> Result<(DecryptionResult, VerificationResult)>where
C: IntoData<'c>,
P: IntoData<'p>,
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>,
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)?;
sourcepub 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>,
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>,
Upstream documentation:
gpgme_op_decrypt_ext
sourcepub fn query_swdb(
&mut self,
name: Option<impl CStrArgument>,
installed_ver: Option<impl CStrArgument>
) -> Result<QuerySwdbResult>
pub fn query_swdb(
&mut self,
name: Option<impl CStrArgument>,
installed_ver: Option<impl CStrArgument>
) -> Result<QuerySwdbResult>
Upstream documentation:
gpgme_op_query_swdb
sourcepub fn get_audit_log<'a, D>(&mut self, dst: D, flags: AuditLogFlags) -> Result<()>where
D: IntoData<'a>,
pub fn get_audit_log<'a, D>(&mut self, dst: D, flags: AuditLogFlags) -> Result<()>where
D: IntoData<'a>,
Upstream documentation:
gpgme_op_getauditlog