libzypp  13.10.6
zypp::KeyRing Class Reference

Gpg key handling. More...

#include <KeyRing.h>

Inheritance diagram for zypp::KeyRing:
zypp::base::ReferenceCounted

Classes

struct  Impl
 KeyRing implementation. More...
 

Public Member Functions

 KeyRing (const Pathname &baseTmpDir)
 Default ctor. More...
 
void importKey (const PublicKey &key, bool trusted=false)
 imports a key from a file. More...
 
void multiKeyImport (const Pathname &keyfile_r, bool trusted_r=false)
 Initial import from RpmDb. More...
 
void dumpTrustedPublicKey (const std::string &id, std::ostream &stream)
 
void dumpUntrustedPublicKey (const std::string &id, std::ostream &stream)
 
void dumpPublicKey (const std::string &id, bool trusted, std::ostream &stream)
 
PublicKey exportPublicKey (const PublicKeyData &keyData)
 Export a public key identified by its key data. More...
 
PublicKey exportTrustedPublicKey (const PublicKeyData &keyData)
 Export a trusted public key identified by its key data. More...
 
std::string readSignatureKeyId (const Pathname &signature)
 reads the public key id from a signature More...
 
bool isKeyTrusted (const std::string &id)
 true if the key id is trusted More...
 
bool isKeyKnown (const std::string &id)
 true if the key id is knows, that means at least exist on the untrusted keyring More...
 
void deleteKey (const std::string &id, bool trusted=false)
 removes a key from the keyring. More...
 
std::list< PublicKeypublicKeys ()
 Get a list of public keys in the keyring (incl. More...
 
std::list< PublicKeytrustedPublicKeys ()
 Get a list of trusted public keys in the keyring (incl. More...
 
std::list< PublicKeyDatapublicKeyData ()
 Get a list of public key data in the keyring (key data only) More...
 
std::list< PublicKeyDatatrustedPublicKeyData ()
 Get a list of trusted public key data in the keyring (key data only) More...
 
bool verifyFileSignatureWorkflow (const Pathname &file, const std::string filedesc, const Pathname &signature, const KeyContext &keycontext=KeyContext())
 Follows a signature verification interacting with the user. More...
 
bool verifyFileSignature (const Pathname &file, const Pathname &signature)
 Verifies a file against a signature, with no user interaction. More...
 
bool verifyFileTrustedSignature (const Pathname &file, const Pathname &signature)
 
 ~KeyRing ()
 Dtor. More...
 
- Public Member Functions inherited from zypp::base::ReferenceCounted
 ReferenceCounted ()
 Default ctor. More...
 
 ReferenceCounted (const ReferenceCounted &rhs)
 Copy ctor. More...
 
virtual ~ReferenceCounted ()
 Dtor. More...
 
ReferenceCountedoperator= (const ReferenceCounted &)
 Assignment. More...
 
unsigned refCount () const
 Return reference counter value. More...
 
void ref () const
 Add a reference. More...
 
void unref () const
 Release a reference. More...
 

Private Attributes

RW_pointer< Impl_pimpl
 Pointer to implementation. More...
 

Friends

std::ostream & operator<< (std::ostream &str, const KeyRing &obj)
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const KeyRing &)
 

Default answers in verification workflow.

Per default all answers are false.

enum  DefaultAcceptBits {
  ACCEPT_NOTHING = 0x0000, ACCEPT_UNSIGNED_FILE = 0x0001, ACCEPT_UNKNOWNKEY = 0x0002, TRUST_KEY_TEMPORARILY = 0x0004,
  TRUST_AND_IMPORT_KEY = 0x0008, ACCEPT_VERIFICATION_FAILED = 0x0010
}
 DefaultAccept flags ( More...
 
 ZYPP_DECLARE_FLAGS (DefaultAccept, DefaultAcceptBits)
 
static DefaultAccept defaultAccept ()
 Get the active accept bits. More...
 
static void setDefaultAccept (DefaultAccept value_r)
 Set the active accept bits. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from zypp::base::ReferenceCounted
static void add_ref (const ReferenceCounted *ptr_r)
 Called by zypp::intrusive_ptr to add a reference. More...
 
static void release (const ReferenceCounted *ptr_r)
 Called by zypp::intrusive_ptr to add a reference. More...
 
- Protected Member Functions inherited from zypp::base::ReferenceCounted
virtual std::ostream & dumpOn (std::ostream &str) const
 Overload to realize std::ostream & operator<<. More...
 
virtual void ref_to (unsigned) const
 Trigger derived classes after refCount was increased. More...
 
virtual void unref_to (unsigned) const
 Trigger derived classes after refCount was decreased. More...
 

Detailed Description

Gpg key handling.

Definition at line 132 of file KeyRing.h.

Member Enumeration Documentation

DefaultAccept flags (

See Also
base::Flags) are used to define the default callback answers during signature verification.
KeyRingReport.
Enumerator
ACCEPT_NOTHING 
ACCEPT_UNSIGNED_FILE 
ACCEPT_UNKNOWNKEY 
TRUST_KEY_TEMPORARILY 
TRUST_AND_IMPORT_KEY 
ACCEPT_VERIFICATION_FAILED 

Definition at line 148 of file KeyRing.h.

Constructor & Destructor Documentation

zypp::KeyRing::KeyRing ( const Pathname &  baseTmpDir)

Default ctor.

Definition at line 653 of file KeyRing.cc.

zypp::KeyRing::~KeyRing ( )

Dtor.

Definition at line 657 of file KeyRing.cc.

Member Function Documentation

zypp::KeyRing::ZYPP_DECLARE_FLAGS ( DefaultAccept  ,
DefaultAcceptBits   
)
KeyRing::DefaultAccept zypp::KeyRing::defaultAccept ( )
static

Get the active accept bits.

Definition at line 53 of file KeyRing.cc.

void zypp::KeyRing::setDefaultAccept ( DefaultAccept  value_r)
static

Set the active accept bits.

Definition at line 56 of file KeyRing.cc.

void zypp::KeyRing::importKey ( const PublicKey key,
bool  trusted = false 
)

imports a key from a file.

throw if key was not imported

Definition at line 661 of file KeyRing.cc.

void zypp::KeyRing::multiKeyImport ( const Pathname &  keyfile_r,
bool  trusted_r = false 
)

Initial import from RpmDb.

Definition at line 664 of file KeyRing.cc.

void zypp::KeyRing::dumpTrustedPublicKey ( const std::string &  id,
std::ostream &  stream 
)
inline

Definition at line 183 of file KeyRing.h.

void zypp::KeyRing::dumpUntrustedPublicKey ( const std::string &  id,
std::ostream &  stream 
)
inline

Definition at line 186 of file KeyRing.h.

void zypp::KeyRing::dumpPublicKey ( const std::string &  id,
bool  trusted,
std::ostream &  stream 
)

Definition at line 698 of file KeyRing.cc.

PublicKey zypp::KeyRing::exportPublicKey ( const PublicKeyData keyData)

Export a public key identified by its key data.

Definition at line 701 of file KeyRing.cc.

PublicKey zypp::KeyRing::exportTrustedPublicKey ( const PublicKeyData keyData)

Export a trusted public key identified by its key data.

Definition at line 704 of file KeyRing.cc.

std::string zypp::KeyRing::readSignatureKeyId ( const Pathname &  signature)

reads the public key id from a signature

Definition at line 667 of file KeyRing.cc.

bool zypp::KeyRing::isKeyTrusted ( const std::string &  id)

true if the key id is trusted

Definition at line 707 of file KeyRing.cc.

bool zypp::KeyRing::isKeyKnown ( const std::string &  id)

true if the key id is knows, that means at least exist on the untrusted keyring

Definition at line 710 of file KeyRing.cc.

void zypp::KeyRing::deleteKey ( const std::string &  id,
bool  trusted = false 
)

removes a key from the keyring.

If trusted is true, Remove it from trusted keyring too.

Definition at line 670 of file KeyRing.cc.

std::list< PublicKey > zypp::KeyRing::publicKeys ( )

Get a list of public keys in the keyring (incl.

ASCII armored keys in tmpfiles)

Definition at line 673 of file KeyRing.cc.

std::list< PublicKey > zypp::KeyRing::trustedPublicKeys ( )

Get a list of trusted public keys in the keyring (incl.

ASCII armored keys in tmpfiles)

Definition at line 676 of file KeyRing.cc.

std::list< PublicKeyData > zypp::KeyRing::publicKeyData ( )

Get a list of public key data in the keyring (key data only)

Definition at line 679 of file KeyRing.cc.

std::list< PublicKeyData > zypp::KeyRing::trustedPublicKeyData ( )

Get a list of trusted public key data in the keyring (key data only)

Definition at line 682 of file KeyRing.cc.

bool zypp::KeyRing::verifyFileSignatureWorkflow ( const Pathname &  file,
const std::string  filedesc,
const Pathname &  signature,
const KeyContext keycontext = KeyContext() 
)

Follows a signature verification interacting with the user.

The bool returned depends on user decision to trust or not.

To propagate user decisions, either connect to the KeyRingReport or use its static methods to set the desired defaults.

* struct KeyRingReportReceive : public callback::ReceiveReport<KeyRingReport>
* {
* KeyRingReportReceive() { connect(); }
*
* // Overload the virtual methods to return the appropriate values.
* virtual bool askUserToAcceptUnsignedFile( const std::string &file );
* ...
* };
*
Parameters
filePath of the file to be verified
filedescDescription of the file (to give the user some context)
signatureSignature to verify the file against
See Also
KeyRingReport

Definition at line 685 of file KeyRing.cc.

bool zypp::KeyRing::verifyFileSignature ( const Pathname &  file,
const Pathname &  signature 
)

Verifies a file against a signature, with no user interaction.

Parameters
filePath of the file to be verified
signatureSignature to verify the file against

Definition at line 692 of file KeyRing.cc.

bool zypp::KeyRing::verifyFileTrustedSignature ( const Pathname &  file,
const Pathname &  signature 
)

Definition at line 695 of file KeyRing.cc.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  str,
const KeyRing obj 
)
friend
std::ostream & operator<< ( std::ostream &  str,
const KeyRing  
)
related

Stream output

Definition at line 290 of file KeyRing.h.

Member Data Documentation

RW_pointer<Impl> zypp::KeyRing::_pimpl
private

Pointer to implementation.

Definition at line 285 of file KeyRing.h.


The documentation for this class was generated from the following files: