libzypp  17.8.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  } //namespace
107 
108 
113 
115  {
116  std::string _id;
119 
120  public:
122  static shared_ptr<Impl> nullimpl();
123 
124  private:
125  friend Impl * rwcowClone<Impl>( const Impl * rhs );
127  Impl * clone() const;
128  };
129 
130  shared_ptr<zypp::PublicSubkeyData::Impl> PublicSubkeyData::Impl::nullimpl()
131  {
132  static shared_ptr<Impl> _nullimpl( new Impl );
133  return _nullimpl;
134  }
135 
137  {
138  return new Impl( *this );
139  }
140 
144 
146  : _pimpl( Impl::nullimpl() )
147  {}
148 
149  PublicSubkeyData::PublicSubkeyData(const _gpgme_subkey *rawSubKeyData)
150  : _pimpl (new Impl)
151  {
152  _pimpl->_created = zypp::Date(rawSubKeyData->timestamp);
153  _pimpl->_expires = zypp::Date(rawSubKeyData->expires);
154  _pimpl->_id = str::asString(rawSubKeyData->keyid);
155  }
156 
158  {}
159 
160  PublicSubkeyData::operator bool() const
161  { return !_pimpl->_id.empty(); }
162 
163  std::string PublicSubkeyData::id() const
164  { return _pimpl->_id; }
165 
167  { return _pimpl->_created; }
168 
170  { return _pimpl->_expires; }
171 
173  { return isExpired( _pimpl->_expires ); }
174 
176  { return hasDaysToLive( _pimpl->_expires ); }
177 
178  std::string PublicSubkeyData::asString() const
179  {
180  return str::Str() << id() << " " << created().printDate() << " [" << expiresDetail( expires() ) << "]";
181  }
182 
189  {
190  std::string _id;
191  std::string _name;
192  std::string _fingerprint;
195 
196  std::vector<PublicSubkeyData> _subkeys;
197 
198  public:
199  bool hasSubkeyId( const std::string & id_r ) const;
200 
201  public:
203  static shared_ptr<Impl> nullimpl();
204  static shared_ptr<Impl> fromGpgmeKey(gpgme_key_t rawData);
205 
206  private:
207  friend Impl * rwcowClone<Impl>( const Impl * rhs );
209  Impl * clone() const;
210  };
211 
212  bool PublicKeyData::Impl::hasSubkeyId(const std::string &id_r) const
213  {
214  bool ret = false;
215  for ( const PublicSubkeyData & sub : _subkeys )
216  {
217  if ( sub.id() == id_r )
218  {
219  ret = true;
220  break;
221  }
222  }
223  return ret;
224  }
225 
226  shared_ptr<PublicKeyData::Impl> PublicKeyData::Impl::nullimpl()
227  {
228  static shared_ptr<Impl> _nullimpl( new Impl );
229  return _nullimpl;
230  }
231 
232  shared_ptr<PublicKeyData::Impl> PublicKeyData::Impl::fromGpgmeKey(gpgme_key_t rawData)
233  {
234  //gpgpme stores almost nothing in the top level key
235  //the information we look for is stored in the subkey, where subkey[0]
236  //is always the primary key
237  gpgme_subkey_t sKey = rawData->subkeys;
238  if (sKey) {
239  shared_ptr<PublicKeyData::Impl> data(new Impl);
240  //libzypp expects the date of the first signature on the first uid
241  if(rawData->uids && rawData->uids->signatures)
242  data->_created = zypp::Date(rawData->uids->signatures->timestamp);
243  else
244  data->_created = zypp::Date(sKey->timestamp);
245 
246  data->_expires = zypp::Date(sKey->expires);
247  data->_fingerprint = str::asString(sKey->fpr);
248  data->_id = str::asString(sKey->keyid);
249 
250  //get the primary user ID
251  if (rawData->uids) {
252  data->_name = str::asString(rawData->uids->uid);
253  }
254 
255  //the rest of the keys
256  sKey = sKey->next;
257  while (sKey) {
258  data->_subkeys.push_back( PublicSubkeyData(sKey) );
259  sKey = sKey->next;
260  }
261  return data;
262  }
263  return nullimpl();
264  }
265 
267  {
268  return new Impl( *this );
269  }
270 
274 
276  : _pimpl( Impl::nullimpl() )
277  {}
278 
279  PublicKeyData::PublicKeyData(shared_ptr<Impl> data)
280  : _pimpl( data )
281  {}
282 
284  {}
285 
287  { return PublicKeyData(Impl::fromGpgmeKey(data)); }
288 
289  PublicKeyData::operator bool() const
290  { return !_pimpl->_fingerprint.empty(); }
291 
292  std::string PublicKeyData::id() const
293  { return _pimpl->_id; }
294 
295  std::string PublicKeyData::name() const
296  { return _pimpl->_name; }
297 
298  std::string PublicKeyData::fingerprint() const
299  { return _pimpl->_fingerprint; }
300 
302  { return _pimpl->_created; }
303 
305  { return _pimpl->_expires; }
306 
308  { return isExpired( _pimpl->_expires ); }
309 
311  { return hasDaysToLive( _pimpl->_expires ); }
312 
313  std::string PublicKeyData::expiresAsString() const
314  { return expiresDetailVerbose( _pimpl->_expires ); }
315 
317  { return _pimpl->_id.empty() ? _pimpl->_id : str::toLower( _pimpl->_id.substr(8,8) ); }
318 
320  { return _pimpl->_created ? str::hexstring( _pimpl->_created ).substr(2) : std::string(); }
321 
322  std::string PublicKeyData::rpmName() const
323  { return str::Format( "gpg-pubkey-%1%-%2%" ) % gpgPubkeyVersion() % gpgPubkeyRelease(); }
324 
325  std::string PublicKeyData::asString() const
326  {
327  str::Str str;
328  str << "[" << _pimpl->_id << "-" << gpgPubkeyRelease();
329  for ( auto && sub : _pimpl->_subkeys )
330  str << ", " << sub.id();
331  return str << "] [" << _pimpl->_name.c_str() << "] [" << expiresDetail( _pimpl->_expires ) << "]";
332  }
333 
335  { return !_pimpl->_subkeys.empty(); }
336 
338  { return makeIterable( &(*_pimpl->_subkeys.begin()), &(*_pimpl->_subkeys.end()) ); }
339 
340  bool PublicKeyData::providesKey( const std::string & id_r ) const
341  {
342  if ( id_r.size() == 8 ) // as a convenience allow to test the 8byte short ID rpm uses as gpg-pubkey version
343  return str::endsWithCI( _pimpl->_id, id_r );
344  return( id_r == _pimpl->_id || _pimpl->hasSubkeyId( id_r ) );
345  }
346 
348  { return AsciiArt( fingerprint() /* TODO: key algorithm could be added as top tile. */ ); }
349 
350  std::ostream & dumpOn( std::ostream & str, const PublicKeyData & obj )
351  {
352  str << "[" << obj.name() << "]" << endl;
353  str << " fpr " << obj.fingerprint() << endl;
354  str << " id " << obj.id() << endl;
355  str << " cre " << Date::ValueType(obj.created()) << ' ' << obj.created() << endl;
356  str << " exp " << Date::ValueType(obj.expires()) << ' ' << obj.expiresAsString() << endl;
357  str << " ttl " << obj.daysToLive() << endl;
358  for ( auto && sub : obj._pimpl->_subkeys )
359  str << " sub " << sub << endl;
360  str << " rpm " << obj.gpgPubkeyVersion() << "-" << obj.gpgPubkeyRelease() << endl;
361  return str;
362  }
363 
364  bool operator==( const PublicKeyData & lhs, const PublicKeyData & rhs )
365  { return ( lhs.fingerprint() == rhs.fingerprint() && lhs.created() == rhs.created() ); }
366 
367 
373  {
375  {}
376 
377  Impl( const Pathname & keyFile_r )
378  : _dontUseThisPtrDirectly( new filesystem::TmpFile )
379  {
380  PathInfo info( keyFile_r );
381  MIL << "Taking pubkey from " << keyFile_r << " of size " << info.size() << " and sha1 " << filesystem::checksum(keyFile_r, "sha1") << endl;
382 
383  if ( !info.isExist() )
384  ZYPP_THROW(Exception("Can't read public key from " + keyFile_r.asString() + ", file not found"));
385 
386  if ( filesystem::hardlinkCopy( keyFile_r, path() ) != 0 )
387  ZYPP_THROW(Exception("Can't copy public key data from " + keyFile_r.asString() + " to " + path().asString() ));
388 
389  readFromFile();
390  }
391 
392  Impl( const filesystem::TmpFile & sharedFile_r )
393  : _dontUseThisPtrDirectly( new filesystem::TmpFile( sharedFile_r ) )
394  { readFromFile(); }
395 
396  Impl( const filesystem::TmpFile & sharedFile_r, const PublicKeyData & keyData_r )
397  : _dontUseThisPtrDirectly( new filesystem::TmpFile( sharedFile_r ) )
398  , _keyData( keyData_r )
399  {
400  if ( ! keyData_r )
401  {
402  WAR << "Invalid PublicKeyData supplied: scanning from file" << endl;
403  readFromFile();
404  }
405  }
406 
407  Impl( const PublicKeyData & keyData_r )
408  : _keyData( keyData_r )
409  {}
410 
411  public:
412  const PublicKeyData & keyData() const
413  { return _keyData; }
414 
415  Pathname path() const
416  { return( /*the one and only intended use*/_dontUseThisPtrDirectly ? _dontUseThisPtrDirectly->path() : Pathname() ); }
417 
418  const std::list<PublicKeyData> & hiddenKeys() const
419  { return _hiddenKeys; }
420 
421  protected:
422  std::string _initHomeDir()
423  { Pathname ret( zypp::myTmpDir() / "PublicKey" ); filesystem::assert_dir( ret ); return ret.asString(); }
424 
426  {
427  PathInfo info( path() );
428  MIL << "Reading pubkey from " << info.path() << " of size " << info.size() << " and sha1 " << filesystem::checksum(info.path(), "sha1") << endl;
429 
430  //@TODO is this still required? KeyManagerCtx creates a homedir on the fly
431  static std::string tmppath( _initHomeDir() );
432 
434  if (!ctx || !ctx->setHomedir(tmppath)) {
435  ZYPP_THROW( Exception( std::string("Can't read public key data: Setting the keyring path failed!")) );
436  }
437 
438  std::list<PublicKeyData> keys = ctx->readKeyFromFile(path());
439  switch ( keys.size() )
440  {
441  case 0:
442  ZYPP_THROW( BadKeyException( "File " + path().asString() + " doesn't contain public key data" , path() ) );
443  break;
444 
445  case 1:
446  // ok.
447  _keyData = keys.back();
448  _hiddenKeys.clear();
449  break;
450 
451  default:
452  WAR << "File " << path().asString() << " contains multiple keys: " << keys << endl;
453  _keyData = keys.back();
454  keys.pop_back();
455  _hiddenKeys.swap( keys );
456  break;
457  }
458 
459  MIL << "Read pubkey from " << info.path() << ": " << _keyData << endl;
460  }
461 
462  private:
463  shared_ptr<filesystem::TmpFile> _dontUseThisPtrDirectly; // shared_ptr ok because TmpFile itself is a refernce type (no COW)
465  std::list<PublicKeyData> _hiddenKeys;
466 
467  public:
469  static shared_ptr<Impl> nullimpl()
470  {
471  static shared_ptr<Impl> _nullimpl( new Impl );
472  return _nullimpl;
473  }
474 
475  private:
476  friend Impl * rwcowClone<Impl>( const Impl * rhs );
478  Impl * clone() const
479  { return new Impl( *this ); }
480  };
482 
484  // class PublicKey
487  : _pimpl( Impl::nullimpl() )
488  {}
489 
491  : _pimpl( new Impl( file ) )
492  {}
493 
495  : _pimpl( new Impl( sharedfile ) )
496  {}
497 
498  PublicKey::PublicKey( const filesystem::TmpFile & sharedfile, const PublicKeyData & keyData_r )
499  : _pimpl( new Impl( sharedfile, keyData_r ) )
500  {}
501 
502  PublicKey::PublicKey( const PublicKeyData & keyData_r )
503  : _pimpl( new Impl( keyData_r ) )
504  {}
505 
507  {}
508 
510  { return _pimpl->keyData(); }
511 
513  { return _pimpl->path(); }
514 
515  const std::list<PublicKeyData> & PublicKey::hiddenKeys() const
516  { return _pimpl->hiddenKeys(); }
517 
518  std::string PublicKey::id() const
519  { return keyData().id(); }
520 
521  std::string PublicKey::name() const
522  { return keyData().name(); }
523 
524  std::string PublicKey::fingerprint() const
525  { return keyData().fingerprint(); }
526 
528  { return keyData().created(); }
529 
531  { return keyData().expires(); }
532 
533  bool PublicKey::expired() const
534  { return keyData().expired(); }
535 
537  { return keyData().daysToLive(); }
538 
539  std::string PublicKey::expiresAsString() const
540  { return keyData().expiresAsString(); }
541 
542  std::string PublicKey::gpgPubkeyVersion() const
543  { return keyData().gpgPubkeyVersion(); }
544 
545  std::string PublicKey::gpgPubkeyRelease() const
546  { return keyData().gpgPubkeyRelease(); }
547 
548  std::string PublicKey::asString() const
549  { return keyData().asString(); }
550 
551  std::string PublicKey::rpmName() const
552  { return keyData().rpmName(); }
553 
554  bool PublicKey::operator==( const PublicKey & rhs ) const
555  { return rhs.keyData() == keyData(); }
556 
557  bool PublicKey::operator==( const std::string & sid ) const
558  { return sid == id(); }
559 
560  std::ostream & dumpOn( std::ostream & str, const PublicKey & obj )
561  { return dumpOn( str, obj.keyData() ); }
562 
563 
564 
565 
567 } // namespace zypp
std::string asString() const
Simple string representation.
Definition: PublicKey.cc:178
static const ValueType day
Definition: Date.h:44
int assert_dir(const Pathname &path, unsigned mode)
Like &#39;mkdir -p&#39;.
Definition: PathInfo.cc:320
Interface to gettext.
static shared_ptr< Impl > nullimpl()
Offer default Impl.
Definition: PublicKey.cc:130
static Ptr createForOpenPGP()
Creates a new KeyManagerCtx for PGP.
Definition: KeyManager.cc:193
#define MIL
Definition: Logger.h:79
Impl(const filesystem::TmpFile &sharedFile_r, const PublicKeyData &keyData_r)
Definition: PublicKey.cc:396
int daysToLive() const
Number of days (24h) until the key expires (or since it exired).
Definition: PublicKey.cc:175
Pathname path() const
Definition: PublicKey.cc:415
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:515
std::list< PublicKeyData > _hiddenKeys
Definition: PublicKey.cc:465
#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:509
std::string _initHomeDir()
Definition: PublicKey.cc:422
std::string name() const
Definition: PublicKey.cc:521
static shared_ptr< Impl > nullimpl()
Offer default Impl.
Definition: PublicKey.cc:226
RWCOW_pointer< Impl > _pimpl
Definition: PublicKey.h:118
std::string gpgPubkeyRelease() const
Gpg-pubkey release as computed by rpm (hexencoded created)
Definition: PublicKey.cc:319
PublicSubkeyData implementation.
Definition: PublicKey.cc:114
Class representing one GPG Public Keys data.
Definition: PublicKey.h:139
bool expired() const
Whether the key has expired.
Definition: PublicKey.cc:172
std::string asString() const
Simple string representation.
Definition: PublicKey.cc:325
const PublicKeyData & keyData() const
Definition: PublicKey.cc:412
Exception thrown when the supplied key is not a valid gpg key.
Definition: PublicKey.h:47
PublicSubkeyData()
Default constructed: empty data.
Definition: PublicKey.cc:145
std::string id() const
Definition: PublicKey.cc:518
std::string name() const
Key name.
Definition: PublicKey.cc:295
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:166
int daysToLive() const
Definition: PublicKey.cc:536
Convenient building of std::string with boost::format.
Definition: String.h:251
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:337
PublicKeyData()
Default constructed: empty data.
Definition: PublicKey.cc:275
#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:539
std::string gpgPubkeyVersion() const
Gpg-pubkey version as computed by rpm (trailing 8 byte id)
Definition: PublicKey.cc:316
const std::list< PublicKeyData > & hiddenKeys() const
Definition: PublicKey.cc:418
std::string id() const
Subkey ID.
Definition: PublicKey.cc:163
Date expires() const
Definition: PublicKey.cc:530
bool operator==(const PublicKey &rhs) const
Definition: PublicKey.cc:554
std::string expiresAsString() const
Definition: PublicKey.cc:313
int daysToLive() const
Number of days (24h) until the key expires (or since it exired).
Definition: PublicKey.cc:310
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: PublicKey.h:362
std::string rpmName() const
Gpg-pubkey name as computed by rpm.
Definition: PublicKey.cc:322
Store and operate on date (time_t).
Definition: Date.h:32
Date created() const
Creation / last modification date (latest selfsig).
Definition: PublicKey.cc:301
base::DrunkenBishop AsciiArt
Random art fingerprint visualization type (base::DrunkenBishop).
Definition: PublicKey.h:225
PublicKeyData _keyData
Definition: PublicKey.cc:464
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:377
std::string gpgPubkeyVersion() const
Definition: PublicKey.cc:542
std::string rpmName() const
Definition: PublicKey.cc:551
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:266
#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
Pathname myTmpDir()
Global access to the zypp.TMPDIR (created on demand, deleted when libzypp is unloaded) ...
Definition: ZYppImpl.cc:223
shared_ptr< filesystem::TmpFile > _dontUseThisPtrDirectly
Definition: PublicKey.cc:463
static shared_ptr< Impl > nullimpl()
Offer default Impl.
Definition: PublicKey.cc:469
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:175
Impl(const PublicKeyData &keyData_r)
Definition: PublicKey.cc:407
PublicKey()
Default ctor.
Definition: PublicKey.cc:486
Impl * clone() const
clone for RWCOW_pointer
Definition: PublicKey.cc:136
PublicKey implementation.
Definition: PublicKey.cc:372
std::string fingerprint() const
Key fingerprint.
Definition: PublicKey.cc:298
bool expired() const
Whether the key has expired.
Definition: PublicKey.cc:307
std::string gpgPubkeyRelease() const
Definition: PublicKey.cc:545
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:272
Date expires() const
Expiry date, or Date() if the key never expires.
Definition: PublicKey.cc:169
AsciiArt asciiArt() const
Random art fingerprint visualization (base::DrunkenBishop).
Definition: PublicKey.cc:347
Date created() const
Definition: PublicKey.cc:527
Base class for Exception.
Definition: Exception.h:145
Pathname path() const
File containig the ASCII armored key.
Definition: PublicKey.cc:512
std::string id() const
Key ID.
Definition: PublicKey.cc:292
Impl(const filesystem::TmpFile &sharedFile_r)
Definition: PublicKey.cc:392
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:236
std::string fingerprint() const
Definition: PublicKey.cc:524
std::string asString() const
Definition: PublicKey.cc:548
bool expired() const
Definition: PublicKey.cc:533
time_t ValueType
Definition: Date.h:38
PublicKeyData implementation.
Definition: PublicKey.cc:188
shared_ptr< KeyManagerCtx > Ptr
Definition: KeyManager.h:34
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 [&#39;2014-02-07&#39;] The default is DateFormat::calendar and TB_LOCA...
Definition: Date.h:192
static shared_ptr< Impl > fromGpgmeKey(gpgme_key_t rawData)
Definition: PublicKey.cc:232
bool hasSubkeyId(const std::string &id_r) const
Definition: PublicKey.cc:212
static PublicKeyData fromGpgmeKey(_gpgme_key *data)
Definition: PublicKey.cc:286
std::vector< PublicSubkeyData > _subkeys
Definition: PublicKey.cc:196
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:340
Date expires() const
Expiry date, or Date() if the key never expires.
Definition: PublicKey.cc:304
std::string hexstring(char n, int w=4)
Definition: String.h:323
bool hasSubkeys() const
Whether subkeys is not empty.
Definition: PublicKey.cc:334
Impl * clone() const
clone for RWCOW_pointer
Definition: PublicKey.cc:478
Random art fingerprint visualization Visualize fingerprint data on a [17x9] (SSH) or [19x11] (GPG) or...
Definition: DrunkenBishop.h:61