1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/KeyRing.h
12 #ifndef ZYPP_KEYRING_H
13 #define ZYPP_KEYRING_H
21 #include "zypp/base/ReferenceCounted.h"
22 #include "zypp/Callback.h"
23 #include "zypp/base/PtrTypes.h"
24 #include "zypp/Locale.h"
26 ///////////////////////////////////////////////////////////////////
28 { /////////////////////////////////////////////////////////////////
30 DEFINE_PTR_TYPE(KeyRing);
32 struct KeyRingReport : public callback::ReportBase
34 virtual bool askUserToTrustKey( const std::string keyid, const std::string keyname )
39 struct KeyRingSignals : public callback::ReportBase
41 virtual void trustedKeyAdded( const KeyRing &keyring, const std::string keyid, const std::string keyname )
43 virtual void trustedKeyRemoved( const KeyRing &keyring, const std::string keyid, const std::string keyname )
51 std::string fingerprint;
54 ///////////////////////////////////////////////////////////////////
56 // CLASS NAME : KeyRing
58 /** Class that represent a text and multiple translations.
60 class KeyRing : public base::ReferenceCounted, private base::NonCopyable
62 friend std::ostream & operator<<( std::ostream & str, const KeyRing & obj );
71 /** Ctor \todo Make ctor it explicit */
73 KeyRing(const Pathname &general_kr, const Pathname &trusted_kr);
76 * imports a key from a file.
77 * throw if key was not imported
79 void importKey( const Pathname &keyfile, bool trusted = false);
80 PublicKey readPublicKey( const Pathname &keyfile );
81 std::string readSignatureKeyId( const Pathname &keyfile );
84 * removes a key from the keyring.
85 * If trusted is true, Remove it from trusted keyring too.
87 void deleteKey( const std::string &id, bool trusted = false);
89 std::list<PublicKey> publicKeys();
90 std::list<PublicKey> trustedPublicKeys();
93 * Follows a signature verification interacting with the user.
94 * The boolr eturned depends on user desicion to trust or not.
96 bool verifyFileSignatureWorkflow( const Pathname &file, const Pathname &signature);
98 bool verifyFileSignature( const Pathname &file, const Pathname &signature);
99 bool verifyFileTrustedSignature( const Pathname &file, const Pathname &signature);
106 /** Synonym for \ref text */
107 //std::string asString() const
111 /** Pointer to implementation */
112 RWCOW_pointer<Impl> _pimpl;
114 ///////////////////////////////////////////////////////////////////
116 /** \relates KeyRing Stream output */
117 inline std::ostream & operator<<( std::ostream & str, const KeyRing & obj )
119 //return str << obj.asString();
123 /////////////////////////////////////////////////////////////////
125 ///////////////////////////////////////////////////////////////////
126 #endif // ZYPP_KEYRING_H