libzypp 8.13.6
|
Gpg key handling. More...
#include <KeyRing.h>
Classes | |
struct | Impl |
KeyRing implementation. More... | |
Public Member Functions | |
KeyRing (const Pathname &baseTmpDir) | |
Default ctor. | |
void | importKey (const PublicKey &key, bool trusted=false) |
imports a key from a file. | |
void | multiKeyImport (const Pathname &keyfile_r, bool trusted_r=false) |
Initial import from RpmDb. | |
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) |
std::string | readSignatureKeyId (const Pathname &signature) |
reads the public key id from a signature | |
bool | isKeyTrusted (const std::string &id) |
true if the key id is trusted | |
bool | isKeyKnown (const std::string &id) |
true if the key id is knows, that means at least exist on the untrusted keyring | |
void | deleteKey (const std::string &id, bool trusted=false) |
removes a key from the keyring. | |
std::list< PublicKey > | publicKeys () |
Get a list of public keys in the keyring. | |
std::list< PublicKey > | trustedPublicKeys () |
Get a list of trusted public keys in the keyring. | |
std::list< std::string > | publicKeyIds () |
Get a list of public key ids in the keyring. | |
std::list< std::string > | trustedPublicKeyIds () |
Get a list of trusted public key ids in the keyring. | |
bool | verifyFileSignatureWorkflow (const Pathname &file, const std::string filedesc, const Pathname &signature, const KeyContext &keycontext=KeyContext()) |
Follows a signature verification interacting with the user. | |
bool | verifyFileSignature (const Pathname &file, const Pathname &signature) |
Verifies a file against a signature, with no user interaction. | |
bool | verifyFileTrustedSignature (const Pathname &file, const Pathname &signature) |
~KeyRing () | |
Dtor. | |
Private Attributes | |
RWCOW_pointer< Impl > | _pimpl |
Pointer to implementation. | |
Friends | |
std::ostream & | operator<< (std::ostream &str, const KeyRing &obj) |
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. | |
static void | setDefaultAccept (DefaultAccept value_r) |
Set the active accept bits. |
DefaultAccept flags (
zypp::KeyRing::KeyRing | ( | const Pathname & | baseTmpDir | ) |
Default ctor.
Definition at line 695 of file KeyRing.cc.
zypp::KeyRing::~KeyRing | ( | ) |
Dtor.
Definition at line 713 of file KeyRing.cc.
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] |
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 723 of file KeyRing.cc.
References _pimpl.
void zypp::KeyRing::multiKeyImport | ( | const Pathname & | keyfile_r, |
bool | trusted_r = false |
||
) |
void zypp::KeyRing::dumpTrustedPublicKey | ( | const std::string & | id, |
std::ostream & | stream | ||
) | [inline] |
Definition at line 183 of file KeyRing.h.
References dumpPublicKey().
void zypp::KeyRing::dumpUntrustedPublicKey | ( | const std::string & | id, |
std::ostream & | stream | ||
) | [inline] |
Definition at line 186 of file KeyRing.h.
References dumpPublicKey().
void zypp::KeyRing::dumpPublicKey | ( | const std::string & | id, |
bool | trusted, | ||
std::ostream & | stream | ||
) |
Definition at line 782 of file KeyRing.cc.
References _pimpl.
Referenced by dumpTrustedPublicKey(), and dumpUntrustedPublicKey().
string zypp::KeyRing::readSignatureKeyId | ( | const Pathname & | signature | ) |
reads the public key id from a signature
Definition at line 733 of file KeyRing.cc.
References _pimpl.
bool zypp::KeyRing::isKeyTrusted | ( | const std::string & | id | ) |
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 792 of file KeyRing.cc.
References _pimpl.
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 738 of file KeyRing.cc.
References _pimpl.
list< PublicKey > zypp::KeyRing::publicKeys | ( | ) |
Get a list of public keys in the keyring.
Definition at line 743 of file KeyRing.cc.
References _pimpl.
list< PublicKey > zypp::KeyRing::trustedPublicKeys | ( | ) |
Get a list of trusted public keys in the keyring.
Definition at line 748 of file KeyRing.cc.
References _pimpl.
list< string > zypp::KeyRing::publicKeyIds | ( | ) |
Get a list of public key ids in the keyring.
Definition at line 753 of file KeyRing.cc.
References _pimpl.
list< string > zypp::KeyRing::trustedPublicKeyIds | ( | ) |
Get a list of trusted public key ids in the keyring.
Definition at line 758 of file KeyRing.cc.
References _pimpl.
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 ); ... };
file | Path of the file to be verified |
filedesc | Description of the file (to give the user some context) |
signature | Signature to verify the file against |
Definition at line 763 of file KeyRing.cc.
References _pimpl.
bool zypp::KeyRing::verifyFileSignature | ( | const Pathname & | file, |
const Pathname & | signature | ||
) |
Verifies a file against a signature, with no user interaction.
file | Path of the file to be verified |
signature | Signature to verify the file against |
Definition at line 772 of file KeyRing.cc.
References _pimpl.
bool zypp::KeyRing::verifyFileTrustedSignature | ( | const Pathname & | file, |
const Pathname & | signature | ||
) |
Definition at line 777 of file KeyRing.cc.
References _pimpl.
std::ostream & operator<< | ( | std::ostream & | str, |
const KeyRing & | obj | ||
) | [friend] |
RWCOW_pointer<Impl> zypp::KeyRing::_pimpl [private] |
Pointer to implementation.
Definition at line 279 of file KeyRing.h.
Referenced by deleteKey(), dumpPublicKey(), importKey(), isKeyKnown(), isKeyTrusted(), multiKeyImport(), publicKeyIds(), publicKeys(), readSignatureKeyId(), trustedPublicKeyIds(), trustedPublicKeys(), verifyFileSignature(), verifyFileSignatureWorkflow(), and verifyFileTrustedSignature().