00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_PUBLICKEY_H 00013 #define ZYPP_PUBLICKEY_H 00014 00015 #include <iosfwd> 00016 #include <map> 00017 #include <list> 00018 #include <set> 00019 #include <string> 00020 00021 #include "zypp/base/PtrTypes.h" 00022 #include "zypp/base/Exception.h" 00023 #include "zypp/Pathname.h" 00024 00026 namespace zypp 00027 { 00028 00033 class BadKeyException : public Exception 00034 { 00035 public: 00039 BadKeyException() 00040 : Exception( "Bad Key Exception" ) 00041 {} 00042 00043 Pathname keyFile() const 00044 { return _keyfile; } 00045 00049 BadKeyException( const std::string & msg_r, const Pathname &keyfile = Pathname() ) 00050 : Exception( msg_r ), _keyfile(keyfile) 00051 {} 00053 virtual ~BadKeyException() throw() {}; 00054 private: 00055 Pathname _keyfile; 00056 }; 00057 00058 00059 // forward declaration of class Date 00060 class Date; 00061 00063 // 00064 // CLASS NAME : PublicKey 00065 // 00069 class PublicKey 00070 { 00071 friend std::ostream & operator<<( std::ostream & str, const PublicKey & obj ); 00072 00073 public: 00075 class Impl; 00076 00077 public: 00078 PublicKey(); 00082 PublicKey(const Pathname &file); 00083 00084 ~PublicKey(); 00085 00086 bool isValid() const 00087 { return ( ! id().empty() && ! fingerprint().empty() && !path().empty() ); } 00088 00089 std::string asString() const; 00090 std::string armoredData() const; 00091 std::string id() const; 00092 std::string name() const; 00093 std::string fingerprint() const; 00094 00098 Date created() const; 00099 00104 Date expires() const; 00105 00106 Pathname path() const; 00107 00108 bool operator==( PublicKey b ) const; 00109 bool operator==( std::string sid ) const; 00110 00111 private: 00113 RWCOW_pointer<Impl> _pimpl; 00114 }; 00116 00118 inline std::ostream & operator<<( std::ostream & str, const PublicKey & obj ) 00119 { return str << obj.asString(); } 00120 00122 std::ostream & dumpOn( std::ostream & str, const PublicKey & obj ); 00123 00125 } // namespace zypp 00127 #endif // ZYPP_PUBLICKEY_H
1.5.0