libzypp  17.16.0
PublicKey.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #include <climits>
13 
14 #include <iostream>
15 #include <vector>
16 
17 #include "zypp/base/Gettext.h"
18 #include "zypp/base/String.h"
19 #include "zypp/base/Regex.h"
20 #include "zypp/PublicKey.h"
21 #include "zypp/ExternalProgram.h"
22 #include "zypp/TmpPath.h"
23 #include "zypp/PathInfo.h"
24 #include "zypp/base/Exception.h"
25 #include "zypp/base/LogTools.h"
26 #include "zypp/Date.h"
27 #include "zypp/KeyManager.h"
28 
29 #include <gpgme.h>
30 
31 using std::endl;
32 
33 #undef ZYPP_BASE_LOGGER_LOGGROUP
34 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::gpg"
35 
37 namespace zypp
38 {
40  namespace
41  {
42  inline bool isExpired( const Date & expires_r )
43  { return( expires_r && expires_r < Date::now() ); }
44 
45  inline int hasDaysToLive( const Date & expires_r )
46  {
47  if ( expires_r )
48  {
49  Date exp( expires_r - Date::now() );
50  int ret = exp / Date::day;
51  if ( exp < 0 ) ret -= 1;
52  return ret;
53  }
54  return INT_MAX;
55  }
56 
57  inline std::string expiresDetail( const Date & expires_r )
58  {
59  str::Str str;
60  if ( ! expires_r )
61  {
62  // translators: an annotation to a gpg keys expiry date
63  str << _("does not expire");
64  }
65  else if ( isExpired( expires_r ) )
66  {
67  // translators: an annotation to a gpg keys expiry date: "expired: 1999-04-12"
68  str << ( str::Format(_("expired: %1%") ) % expires_r.printDate() );
69  }
70  else
71  {
72  // translators: an annotation to a gpg keys expiry date: "expires: 2111-04-12"
73  str << ( str::Format(_("expires: %1%") ) % expires_r.printDate() );
74  }
75  return str;
76  }
77 
78  inline std::string expiresDetailVerbose( const Date & expires_r )
79  {
80  if ( !expires_r )
81  { // translators: an annotation to a gpg keys expiry date
82  return _("(does not expire)");
83  }
84  std::string ret( expires_r.asString() );
85  int ttl( hasDaysToLive( expires_r ) );
86  if ( ttl <= 90 )
87  {
88  ret += " ";
89  if ( ttl < 0 )
90  { // translators: an annotation to a gpg keys expiry date
91  ret += _("(EXPIRED)");
92  }
93  else if ( ttl == 0 )
94  { // translators: an annotation to a gpg keys expiry date
95  ret += _("(expires within 24h)");
96  }
97  else
98  { // translators: an annotation to a gpg keys expiry date
99  ret += str::form( PL_("(expires in %d day)", "(expires in %d days)", ttl ), ttl );
100  }
101  }
102  return ret;
103  }
104 
105  std::string keyAlgoName( const gpgme_subkey_t & key_r )
106  {
107  std::string ret;
108  if ( const char * n = ::gpgme_pubkey_algo_name( key_r->pubkey_algo ) )
109  ret = str::Str() << n << ' ' << key_r->length;
110  else
111  ret = "?";
112  return ret;
113  }
114  } //namespace
116 
117 
122 
124  {
125  std::string _id;
128 
129  public:
131  static shared_ptr<Impl> nullimpl();
132 
133  private:
134  friend Impl * rwcowClone<Impl>( const Impl * rhs );
136  Impl * clone() const;
137  };
138 
139  shared_ptr<zypp::PublicSubkeyData::Impl> PublicSubkeyData::Impl::nullimpl()
140  {
141  static shared_ptr<Impl> _nullimpl( new Impl );
142  return _nullimpl;
143  }
144 
146  {
147  return new Impl( *this );
148  }
149 
153 
155  : _pimpl( Impl::nullimpl() )
156  {}
157 
158  PublicSubkeyData::PublicSubkeyData(const _gpgme_subkey *rawSubKeyData)
159  : _pimpl (new Impl)
160  {
161  _pimpl->_created = zypp::Date(rawSubKeyData->timestamp);
162  _pimpl->_expires = zypp::Date(rawSubKeyData->expires);
163  _pimpl->_id = str::asString(rawSubKeyData->keyid);
164  }
165 
167  {}
168 
169  PublicSubkeyData::operator bool() const
170  { return !_pimpl->_id.empty(); }
171 
172  std::string PublicSubkeyData::id() const
173  { return _pimpl->_id; }
174 
176  { return _pimpl->_created; }
177 
179  { return _pimpl->_expires; }
180 
182  { return isExpired( _pimpl->_expires ); }
183 
185  { return hasDaysToLive( _pimpl->_expires ); }
186 
187  std::string PublicSubkeyData::asString() const
188  {
189  return str::Str() << id() << " " << created().printDate() << " [" << expiresDetail( expires() ) << "]";
190  }
191 
198  {
199  std::string _id;
200  std::string _name;
201  std::string _fingerprint;
202  std::string _algoName;
205 
206  std::vector<PublicSubkeyData> _subkeys;
207 
208  public:
209  bool hasSubkeyId( const std::string & id_r ) const;
210 
211  public:
213  static shared_ptr<Impl> nullimpl();
214  static shared_ptr<Impl> fromGpgmeKey(gpgme_key_t rawData);
215 
216  private:
217  friend Impl * rwcowClone<Impl>( const Impl * rhs );
219  Impl * clone() const;
220  };
221 
222  bool PublicKeyData::Impl::hasSubkeyId(const std::string &id_r) const
223  {
224  bool ret = false;
225  for ( const PublicSubkeyData & sub : _subkeys )
226  {
227  if ( sub.id() == id_r )
228  {
229  ret = true;
230  break;
231  }
232  }
233  return ret;
234  }
235 
236  shared_ptr<PublicKeyData::Impl> PublicKeyData::Impl::nullimpl()
237  {
238  static shared_ptr<Impl> _nullimpl( new Impl );
239  return _nullimpl;
240  }
241 
242  shared_ptr<PublicKeyData::Impl> PublicKeyData::Impl::fromGpgmeKey(gpgme_key_t rawData)
243  {
244  //gpgpme stores almost nothing in the top level key
245  //the information we look for is stored in the subkey, where subkey[0]
246  //is always the primary key
247  gpgme_subkey_t sKey = rawData->subkeys;
248  if (sKey) {
249  shared_ptr<PublicKeyData::Impl> data(new Impl);
250  //libzypp expects the date of the first signature on the first uid
251  if(rawData->uids && rawData->uids->signatures)
252  data->_created = zypp::Date(rawData->uids->signatures->timestamp);
253  else
254  data->_created = zypp::Date(sKey->timestamp);
255 
256  data->_expires = zypp::Date(sKey->expires);
257  data->_fingerprint = str::asString(sKey->fpr);
258  data->_algoName = keyAlgoName( sKey );
259  data->_id = str::asString(sKey->keyid);
260 
261  //get the primary user ID
262  if (rawData->uids) {
263  data->_name = str::asString(rawData->uids->uid);
264  }
265 
266  //the rest of the keys
267  sKey = sKey->next;
268  while (sKey) {
269  data->_subkeys.push_back( PublicSubkeyData(sKey) );
270  sKey = sKey->next;
271  }
272  return data;
273  }
274  return nullimpl();
275  }
276 
278  {
279  return new Impl( *this );
280  }
281 
285 
287  : _pimpl( Impl::nullimpl() )
288  {}
289 
290  PublicKeyData::PublicKeyData(shared_ptr<Impl> data)
291  : _pimpl( data )
292  {}
293 
295  {}
296 
298  { return PublicKeyData(Impl::fromGpgmeKey(data)); }
299 
300  PublicKeyData::operator bool() const
301  { return !_pimpl->_fingerprint.empty(); }
302 
303  std::string PublicKeyData::id() const
304  { return _pimpl->_id; }
305 
306  std::string PublicKeyData::name() const
307  { return _pimpl->_name; }
308 
309  std::string PublicKeyData::fingerprint() const
310  { return _pimpl->_fingerprint; }
311 
312  std::string PublicKeyData::algoName() const
313  { return _pimpl->_algoName; }
314 
316  { return _pimpl->_created; }
317 
319  { return _pimpl->_expires; }
320 
322  { return isExpired( _pimpl->_expires ); }
323 
325  { return hasDaysToLive( _pimpl->_expires ); }
326 
327  std::string PublicKeyData::expiresAsString() const
328  { return expiresDetailVerbose( _pimpl->_expires ); }
329 
331  { return _pimpl->_id.empty() ? _pimpl->_id : str::toLower( _pimpl->_id.substr(8,8) ); }
332 
334  { return _pimpl->_created ? str::hexstring( _pimpl->_created ).substr(2) : std::string(); }
335 
336  std::string PublicKeyData::rpmName() const
337  { return str::Format( "gpg-pubkey-%1%-%2%" ) % gpgPubkeyVersion() % gpgPubkeyRelease(); }
338 
339  std::string PublicKeyData::asString() const
340  {
341  str::Str str;
342  str << "[" << _pimpl->_id << "-" << gpgPubkeyRelease();
343  for ( auto && sub : _pimpl->_subkeys )
344  str << ", " << sub.id();
345  return str << "] [" << _pimpl->_name.c_str() << "] [" << expiresDetail( _pimpl->_expires ) << "]";
346  }
347 
349  { return !_pimpl->_subkeys.empty(); }
350 
352  { return makeIterable( &(*_pimpl->_subkeys.begin()), &(*_pimpl->_subkeys.end()) ); }
353 
354  bool PublicKeyData::providesKey( const std::string & id_r ) const
355  {
356  if ( id_r.size() == 8 ) // as a convenience allow to test the 8byte short ID rpm uses as gpg-pubkey version
357  return str::endsWithCI( _pimpl->_id, id_r );
358  return( id_r == _pimpl->_id || _pimpl->hasSubkeyId( id_r ) );
359  }
360 
362  { return AsciiArt( fingerprint(), algoName() ); }
363 
364  std::ostream & dumpOn( std::ostream & str, const PublicKeyData & obj )
365  {
366  str << "[" << obj.name() << "]" << endl;
367  str << " fpr " << obj.fingerprint() << endl;
368  str << " id " << obj.id() << endl;
369  str << " alg " << obj.algoName() << endl;
370  str << " cre " << Date::ValueType(obj.created()) << ' ' << obj.created() << endl;
371  str << " exp " << Date::ValueType(obj.expires()) << ' ' << obj.expiresAsString() << endl;
372  str << " ttl " << obj.daysToLive() << endl;
373  for ( auto && sub : obj._pimpl->_subkeys )
374  str << " sub " << sub << endl;
375  str << " rpm " << obj.gpgPubkeyVersion() << "-" << obj.gpgPubkeyRelease() << endl;
376  return str;
377  }
378 
379  bool operator==( const PublicKeyData & lhs, const PublicKeyData & rhs )
380  { return ( lhs.fingerprint() == rhs.fingerprint() && lhs.created() == rhs.created() ); }
381 
382 
388  {
390  {}
391 
392  Impl( const Pathname & keyFile_r )
393  : _dontUseThisPtrDirectly( new filesystem::TmpFile )
394  {
395  PathInfo info( keyFile_r );
396  MIL << "Taking pubkey from " << keyFile_r << " of size " << info.size() << " and sha1 " << filesystem::checksum(keyFile_r, "sha1") << endl;
397 
398  if ( !info.isExist() )
399  ZYPP_THROW(Exception("Can't read public key from " + keyFile_r.asString() + ", file not found"));
400 
401  if ( filesystem::hardlinkCopy( keyFile_r, path() ) != 0 )
402  ZYPP_THROW(Exception("Can't copy public key data from " + keyFile_r.asString() + " to " + path().asString() ));
403 
404  readFromFile();
405  }
406 
407  Impl( const filesystem::TmpFile & sharedFile_r )
408  : _dontUseThisPtrDirectly( new filesystem::TmpFile( sharedFile_r ) )
409  { readFromFile(); }
410 
411  // private from keyring
412  Impl( const filesystem::TmpFile & sharedFile_r, const PublicKeyData & keyData_r )
413  : _dontUseThisPtrDirectly( new filesystem::TmpFile( sharedFile_r ) )
414  , _keyData( keyData_r )
415  {
416  if ( ! keyData_r )
417  {
418  WAR << "Invalid PublicKeyData supplied: scanning from file" << endl;
419  readFromFile();
420  }
421  }
422 
423  // private from keyring
424  Impl( const PublicKeyData & keyData_r )
425  : _keyData( keyData_r )
426  {}
427 
428  public:
429  const PublicKeyData & keyData() const
430  { return _keyData; }
431 
432  Pathname path() const
433  { return( /*the one and only intended use*/_dontUseThisPtrDirectly ? _dontUseThisPtrDirectly->path() : Pathname() ); }
434 
435  const std::list<PublicKeyData> & hiddenKeys() const
436  { return _hiddenKeys; }
437 
438  protected:
440  {
441  PathInfo info( path() );
442  MIL << "Reading pubkey from " << info.path() << " of size " << info.size() << " and sha1 " << filesystem::checksum(info.path(), "sha1") << endl;
443 
444  std::list<PublicKeyData> keys = KeyManagerCtx::createForOpenPGP().readKeyFromFile( path() );
445  switch ( keys.size() )
446  {
447  case 0:
448  ZYPP_THROW( BadKeyException( "File " + path().asString() + " doesn't contain public key data" , path() ) );
449  break;
450 
451  case 1:
452  // ok.
453  _keyData = keys.back();
454  _hiddenKeys.clear();
455  break;
456 
457  default:
458  WAR << "File " << path().asString() << " contains multiple keys: " << keys << endl;
459  _keyData = keys.back();
460  keys.pop_back();
461  _hiddenKeys.swap( keys );
462  break;
463  }
464 
465  MIL << "Read pubkey from " << info.path() << ": " << _keyData << endl;
466  }
467 
468  private:
469  shared_ptr<filesystem::TmpFile> _dontUseThisPtrDirectly; // shared_ptr ok because TmpFile itself is a refernce type (no COW)
471  std::list<PublicKeyData> _hiddenKeys;
472 
473  public:
475  static shared_ptr<Impl> nullimpl()
476  {
477  static shared_ptr<Impl> _nullimpl( new Impl );
478  return _nullimpl;
479  }
480 
481  private:
482  friend Impl * rwcowClone<Impl>( const Impl * rhs );
484  Impl * clone() const
485  { return new Impl( *this ); }
486  };
488 
490  // class PublicKey
493  : _pimpl( Impl::nullimpl() )
494  {}
495 
497  : _pimpl( new Impl( file ) )
498  {}
499 
501  : _pimpl( new Impl( sharedfile ) )
502  {}
503 
504  PublicKey::PublicKey( const filesystem::TmpFile & sharedfile, const PublicKeyData & keyData_r )
505  : _pimpl( new Impl( sharedfile, keyData_r ) )
506  {}
507 
508  PublicKey::PublicKey( const PublicKeyData & keyData_r )
509  : _pimpl( new Impl( keyData_r ) )
510  {}
511 
513  {}
514 
516  { return _pimpl->keyData(); }
517 
519  { return _pimpl->path(); }
520 
521  const std::list<PublicKeyData> & PublicKey::hiddenKeys() const
522  { return _pimpl->hiddenKeys(); }
523 
524  std::string PublicKey::id() const
525  { return keyData().id(); }
526 
527  std::string PublicKey::name() const
528  { return keyData().name(); }
529 
530  std::string PublicKey::fingerprint() const
531  { return keyData().fingerprint(); }
532 
533  std::string PublicKey::algoName() const
534  { return keyData().algoName(); }
535 
537  { return keyData().created(); }
538 
540  { return keyData().expires(); }
541 
542  bool PublicKey::expired() const
543  { return keyData().expired(); }
544 
546  { return keyData().daysToLive(); }
547 
548  std::string PublicKey::expiresAsString() const
549  { return keyData().expiresAsString(); }
550 
551  std::string PublicKey::gpgPubkeyVersion() const
552  { return keyData().gpgPubkeyVersion(); }
553 
554  std::string PublicKey::gpgPubkeyRelease() const
555  { return keyData().gpgPubkeyRelease(); }
556 
557  std::string PublicKey::asString() const
558  { return keyData().asString(); }
559 
560  std::string PublicKey::rpmName() const
561  { return keyData().rpmName(); }
562 
563  bool PublicKey::operator==( const PublicKey & rhs ) const
564  { return rhs.keyData() == keyData(); }
565 
566  bool PublicKey::operator==( const std::string & sid ) const
567  { return sid == id(); }
568 
569  std::ostream & dumpOn( std::ostream & str, const PublicKey & obj )
570  { return dumpOn( str, obj.keyData() ); }
571 
572 
573 
574 
576 } // namespace zypp
std::string asString() const
Simple string representation.
Definition: PublicKey.cc:187
static const ValueType day
Definition: Date.h:44
Interface to gettext.
static shared_ptr< Impl > nullimpl()
Offer default Impl.
Definition: PublicKey.cc:139
#define MIL
Definition: Logger.h:79
Impl(const filesystem::TmpFile &sharedFile_r, const PublicKeyData &keyData_r)
Definition: PublicKey.cc:412
int daysToLive() const
Number of days (24h) until the key expires (or since it exired).
Definition: PublicKey.cc:184
std::list< PublicKeyData > readKeyFromFile(const Pathname &file)
Returns a list of all PublicKeyData found in file.
Definition: KeyManager.cc:307
Pathname path() const
Definition: PublicKey.cc:432
const Pathname & path() const
Return current Pathname.
Definition: PathInfo.h:246
const std::list< PublicKeyData > & hiddenKeys() const
Additional keys data in case the ASCII armored blob containes multiple keys.
Definition: PublicKey.cc:521
std::list< PublicKeyData > _hiddenKeys
Definition: PublicKey.cc:471
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Definition: Exception.h:392
const PublicKeyData & keyData() const
The public keys data (.
Definition: PublicKey.cc:515
std::string name() const
Definition: PublicKey.cc:527
static shared_ptr< Impl > nullimpl()
Offer default Impl.
Definition: PublicKey.cc:236
RWCOW_pointer< Impl > _pimpl
Definition: PublicKey.h:118
std::string gpgPubkeyRelease() const
Gpg-pubkey release as computed by rpm (hexencoded created)
Definition: PublicKey.cc:333
PublicSubkeyData implementation.
Definition: PublicKey.cc:123
Class representing one GPG Public Keys data.
Definition: PublicKey.h:139
bool expired() const
Whether the key has expired.
Definition: PublicKey.cc:181
std::string asString() const
Simple string representation.
Definition: PublicKey.cc:339
const PublicKeyData & keyData() const
Definition: PublicKey.cc:429
Exception thrown when the supplied key is not a valid gpg key.
Definition: PublicKey.h:47
std::string algoName() const
Key algorithm string like RSA 2048
Definition: PublicKey.cc:312
PublicSubkeyData()
Default constructed: empty data.
Definition: PublicKey.cc:154
std::string id() const
Definition: PublicKey.cc:524
std::string name() const
Key name.
Definition: PublicKey.cc:306
String related utilities and Regular expression matching.
const std::string & asString(const std::string &t)
Global asString() that works with std::string too.
Definition: String.h:136
Date created() const
Creation date.
Definition: PublicKey.cc:175
int daysToLive() const
Definition: PublicKey.cc:545
Convenient building of std::string with boost::format.
Definition: String.h:251
static KeyManagerCtx createForOpenPGP()
Creates a new KeyManagerCtx for PGP using a volatile temp.
Definition: KeyManager.cc:227
bool operator==(const SetRelation::Enum &lhs, const SetCompare &rhs)
Provide a new empty temporary file and delete it when no longer needed.
Definition: TmpPath.h:127
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition: String.cc:36
Iterable< SubkeyIterator > subkeys() const
Iterate any subkeys.
Definition: PublicKey.cc:351
PublicKeyData()
Default constructed: empty data.
Definition: PublicKey.cc:286
#define PL_(MSG1, MSG2, N)
Definition: Gettext.h:40
bool endsWithCI(const C_Str &str_r, const C_Str &prefix_r)
Definition: String.h:1088
std::string expiresAsString() const
Definition: PublicKey.cc:548
std::string gpgPubkeyVersion() const
Gpg-pubkey version as computed by rpm (trailing 8 byte id)
Definition: PublicKey.cc:330
const std::list< PublicKeyData > & hiddenKeys() const
Definition: PublicKey.cc:435
std::string id() const
Subkey ID.
Definition: PublicKey.cc:172
Date expires() const
Definition: PublicKey.cc:539
bool operator==(const PublicKey &rhs) const
Definition: PublicKey.cc:563
std::string expiresAsString() const
Definition: PublicKey.cc:327
int daysToLive() const
Number of days (24h) until the key expires (or since it exired).
Definition: PublicKey.cc:324
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: PublicKey.h:366
std::string rpmName() const
Gpg-pubkey name as computed by rpm.
Definition: PublicKey.cc:336
Store and operate on date (time_t).
Definition: Date.h:32
Date created() const
Creation / last modification date (latest selfsig).
Definition: PublicKey.cc:315
base::DrunkenBishop AsciiArt
Random art fingerprint visualization type (base::DrunkenBishop).
Definition: PublicKey.h:228
PublicKeyData _keyData
Definition: PublicKey.cc:470
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Definition: String.h:210
Impl(const Pathname &keyFile_r)
Definition: PublicKey.cc:392
std::string gpgPubkeyVersion() const
Definition: PublicKey.cc:551
std::string rpmName() const
Definition: PublicKey.cc:560
const std::string & asString() const
String representation.
Definition: Pathname.h:90
bool isExist() const
Return whether valid stat info exists.
Definition: PathInfo.h:281
Impl * clone() const
clone for RWCOW_pointer
Definition: PublicKey.cc:277
#define WAR
Definition: Logger.h:80
int hardlinkCopy(const Pathname &oldpath, const Pathname &newpath)
Create newpath as hardlink or copy of oldpath.
Definition: PathInfo.cc:836
shared_ptr< filesystem::TmpFile > _dontUseThisPtrDirectly
Definition: PublicKey.cc:469
static shared_ptr< Impl > nullimpl()
Offer default Impl.
Definition: PublicKey.cc:475
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
Definition: Capability.cc:444
#define _(MSG)
Definition: Gettext.h:37
std::string toLower(const std::string &s)
Return lowercase version of s.
Definition: String.cc:177
Impl(const PublicKeyData &keyData_r)
Definition: PublicKey.cc:424
PublicKey()
Default ctor.
Definition: PublicKey.cc:492
Impl * clone() const
clone for RWCOW_pointer
Definition: PublicKey.cc:145
PublicKey implementation.
Definition: PublicKey.cc:387
std::string fingerprint() const
Key fingerprint.
Definition: PublicKey.cc:309
bool expired() const
Whether the key has expired.
Definition: PublicKey.cc:321
std::string gpgPubkeyRelease() const
Definition: PublicKey.cc:554
Class representing a GPG Public Keys subkeys.
Definition: PublicKey.h:78
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
Definition: PublicKey.h:275
Date expires() const
Expiry date, or Date() if the key never expires.
Definition: PublicKey.cc:178
AsciiArt asciiArt() const
Random art fingerprint visualization (base::DrunkenBishop).
Definition: PublicKey.cc:361
Date created() const
Definition: PublicKey.cc:536
Base class for Exception.
Definition: Exception.h:145
Pathname path() const
File containig the ASCII armored key.
Definition: PublicKey.cc:518
std::string id() const
Key ID.
Definition: PublicKey.cc:303
Impl(const filesystem::TmpFile &sharedFile_r)
Definition: PublicKey.cc:407
static Date now()
Return the current time.
Definition: Date.h:78
std::string checksum(const Pathname &file, const std::string &algorithm)
Compute a files checksum.
Definition: PathInfo.cc:1004
RWCOW_pointer< Impl > _pimpl
Definition: PublicKey.h:239
std::string fingerprint() const
Definition: PublicKey.cc:530
std::string asString() const
Definition: PublicKey.cc:557
bool expired() const
Definition: PublicKey.cc:542
time_t ValueType
Definition: Date.h:38
PublicKeyData implementation.
Definition: PublicKey.cc:197
Wrapper class for ::stat/::lstat.
Definition: PathInfo.h:220
std::string printDate(DateFormat dateFormat_r=DateFormat::calendar, TimeBase base_r=TB_LOCALTIME) const
Convenience for printing the date only ['2014-02-07'] The default is DateFormat::calendar and TB_LOCA...
Definition: Date.h:192
static shared_ptr< Impl > fromGpgmeKey(gpgme_key_t rawData)
Definition: PublicKey.cc:242
bool hasSubkeyId(const std::string &id_r) const
Definition: PublicKey.cc:222
static PublicKeyData fromGpgmeKey(_gpgme_key *data)
Definition: PublicKey.cc:297
std::vector< PublicSubkeyData > _subkeys
Definition: PublicKey.cc:206
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
bool providesKey(const std::string &id_r) const
Whether id_r is the id of the primary key or of a subkey.
Definition: PublicKey.cc:354
Date expires() const
Expiry date, or Date() if the key never expires.
Definition: PublicKey.cc:318
std::string hexstring(char n, int w=4)
Definition: String.h:323
std::string algoName() const
Definition: PublicKey.cc:533
bool hasSubkeys() const
Whether subkeys is not empty.
Definition: PublicKey.cc:348
Impl * clone() const
clone for RWCOW_pointer
Definition: PublicKey.cc:484
Random art fingerprint visualization Visualize fingerprint data on a [17x9] (SSH) or [19x11] (GPG) or...
Definition: DrunkenBishop.h:61