pub struct GpgContext {
pub config: GpgConfig,
/* private fields */
}Expand description
A context for cryptographic operations.
Fields§
§config: GpgConfigGPGME configuration manager.
Implementations§
Source§impl GpgContext
impl GpgContext
Sourcepub fn apply_config(&mut self)
pub fn apply_config(&mut self)
Applies the current configuration values to the context.
Sourcepub fn get_output_file(
&self,
key_type: KeyType,
patterns: Vec<String>,
) -> Result<PathBuf>
pub fn get_output_file( &self, key_type: KeyType, patterns: Vec<String>, ) -> Result<PathBuf>
Returns the configured file path.
output_dir is used for output directory.
Sourcepub fn get_key(&mut self, key_type: KeyType, key_id: String) -> Result<Key>
pub fn get_key(&mut self, key_type: KeyType, key_id: String) -> Result<Key>
Returns the public/secret key with the specified ID.
Sourcepub fn get_keys(
&mut self,
key_type: KeyType,
patterns: Option<Vec<String>>,
detail_level: KeyDetail,
) -> Result<Vec<GpgKey>>
pub fn get_keys( &mut self, key_type: KeyType, patterns: Option<Vec<String>>, detail_level: KeyDetail, ) -> Result<Vec<GpgKey>>
Returns a list of all public/secret keys matching one or more of the specified patterns.
Sourcepub fn get_all_keys(
&mut self,
detail_level: Option<KeyDetail>,
) -> Result<HashMap<KeyType, Vec<GpgKey>>>
pub fn get_all_keys( &mut self, detail_level: Option<KeyDetail>, ) -> Result<HashMap<KeyType, Vec<GpgKey>>>
Returns the all available keys and their types in a HashMap.
Sourcepub fn import_keys(
&mut self,
keys: Vec<String>,
read_from_file: bool,
) -> Result<u32>
pub fn import_keys( &mut self, keys: Vec<String>, read_from_file: bool, ) -> Result<u32>
Adds the given keys to the keyring.
Sourcepub fn get_exported_keys(
&mut self,
key_type: KeyType,
patterns: Option<Vec<String>>,
) -> Result<Vec<u8>>
pub fn get_exported_keys( &mut self, key_type: KeyType, patterns: Option<Vec<String>>, ) -> Result<Vec<u8>>
Returns the exported public/secret keys matching one or more of the specified patterns.
Sourcepub fn export_keys(
&mut self,
key_type: KeyType,
patterns: Option<Vec<String>>,
) -> Result<String>
pub fn export_keys( &mut self, key_type: KeyType, patterns: Option<Vec<String>>, ) -> Result<String>
Exports keys and saves them to the specified/default path.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GpgContext
impl RefUnwindSafe for GpgContext
impl !Send for GpgContext
impl !Sync for GpgContext
impl Unpin for GpgContext
impl UnsafeUnpin for GpgContext
impl UnwindSafe for GpgContext
Blanket Implementations§
Source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
Source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
Source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
Source§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
Source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
Source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
Source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
Approximate the subject to a given type with the default scheme.
Source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
Approximate the subject to a given type with a specific scheme.
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more