libzypp 17.28.8
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
31using std::endl;
32
33#undef ZYPP_BASE_LOGGER_LOGGROUP
34#define ZYPP_BASE_LOGGER_LOGGROUP "zypp::gpg"
35
37namespace 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 inline 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
115 inline bool shorterIsSuffixCI( const std::string & lhs, const std::string & rhs )
116 {
117 if ( lhs.size() >= rhs.size() )
118 return str::endsWithCI( lhs, rhs );
119 return str::endsWithCI( rhs, lhs );
120 }
121 } //namespace
123
124
129
131 {
132 std::string _id;
135
136 public:
138 static shared_ptr<Impl> nullimpl();
139
140 private:
141 friend Impl * rwcowClone<Impl>( const Impl * rhs );
143 Impl * clone() const;
144 };
145
146 shared_ptr<zypp::PublicSubkeyData::Impl> PublicSubkeyData::Impl::nullimpl()
147 {
148 static shared_ptr<Impl> _nullimpl( new Impl );
149 return _nullimpl;
150 }
151
153 {
154 return new Impl( *this );
155 }
156
160
162 : _pimpl( Impl::nullimpl() )
163 {}
164
165 PublicSubkeyData::PublicSubkeyData(const _gpgme_subkey *rawSubKeyData)
166 : _pimpl (new Impl)
167 {
168 _pimpl->_created = zypp::Date(rawSubKeyData->timestamp);
169 _pimpl->_expires = zypp::Date(rawSubKeyData->expires);
170 _pimpl->_id = str::asString(rawSubKeyData->keyid);
171 }
172
174 {}
175
176 PublicSubkeyData::operator bool() const
177 { return !_pimpl->_id.empty(); }
178
179 std::string PublicSubkeyData::id() const
180 { return _pimpl->_id; }
181
183 { return _pimpl->_created; }
184
186 { return _pimpl->_expires; }
187
189 { return isExpired( _pimpl->_expires ); }
190
192 { return hasDaysToLive( _pimpl->_expires ); }
193
194 std::string PublicSubkeyData::asString() const
195 {
196 return str::Str() << id() << " " << created().printDate() << " [" << expiresDetail( expires() ) << "]";
197 }
198
205 {
206 std::string _id;
207 std::string _name;
208 std::string _fingerprint;
209 std::string _algoName;
212
213 std::vector<PublicSubkeyData> _subkeys;
214
215 public:
216 bool hasSubkeyId( const std::string & id_r ) const;
217
218 public:
220 static shared_ptr<Impl> nullimpl();
221 static shared_ptr<Impl> fromGpgmeKey(gpgme_key_t rawData);
222
223 private:
224 friend Impl * rwcowClone<Impl>( const Impl * rhs );
226 Impl * clone() const;
227 };
228
229 bool PublicKeyData::Impl::hasSubkeyId( const std::string &id_r) const
230 {
231 bool ret = false;
232 for ( const PublicSubkeyData & sub : _subkeys ) {
233 if ( shorterIsSuffixCI( sub.id(), id_r ) ) {
234 ret = true;
235 break;
236 }
237 }
238 return ret;
239 }
240
241 shared_ptr<PublicKeyData::Impl> PublicKeyData::Impl::nullimpl()
242 {
243 static shared_ptr<Impl> _nullimpl( new Impl );
244 return _nullimpl;
245 }
246
247 shared_ptr<PublicKeyData::Impl> PublicKeyData::Impl::fromGpgmeKey(gpgme_key_t rawData)
248 {
249 //gpgpme stores almost nothing in the top level key
250 //the information we look for is stored in the subkey, where subkey[0]
251 //is always the primary key
252 gpgme_subkey_t sKey = rawData->subkeys;
253 if (sKey) {
254 shared_ptr<PublicKeyData::Impl> data(new Impl);
255 //libzypp expects the date of the latest signature on the first uid
256 if ( rawData->uids && rawData->uids->signatures ) {
257 data->_created = zypp::Date(rawData->uids->signatures->timestamp);
258 // bsc#1179222: The keyring does not order the signatures when multiple
259 // versions of the same key are imported. We take the last signature here,
260 // the one GPGME_EXPORT_MODE_MINIMAL will later use in export.
261 for ( auto t = rawData->uids->signatures->next; t; t = t->next ) {
262 if ( t->timestamp > data->_created )
263 data->_created = t->timestamp;
264 }
265 }
266 else
267 data->_created = zypp::Date(sKey->timestamp);
268
269 data->_expires = zypp::Date(sKey->expires);
270 data->_fingerprint = str::asString(sKey->fpr);
271 data->_algoName = keyAlgoName( sKey );
272 data->_id = str::asString(sKey->keyid);
273
274 //get the primary user ID
275 if (rawData->uids) {
276 data->_name = str::asString(rawData->uids->uid);
277 }
278
279 //the rest of the keys
280 sKey = sKey->next;
281 while (sKey) {
282 data->_subkeys.push_back( PublicSubkeyData(sKey) );
283 sKey = sKey->next;
284 }
285 return data;
286 }
287 return nullimpl();
288 }
289
291 {
292 return new Impl( *this );
293 }
294
298
300 : _pimpl( Impl::nullimpl() )
301 {}
302
303 PublicKeyData::PublicKeyData(shared_ptr<Impl> data)
304 : _pimpl( data )
305 {}
306
308 {}
309
311 { return PublicKeyData(Impl::fromGpgmeKey(data)); }
312
313 PublicKeyData::operator bool() const
314 { return !_pimpl->_fingerprint.empty(); }
315
316 std::string PublicKeyData::id() const
317 { return _pimpl->_id; }
318
319 std::string PublicKeyData::name() const
320 { return _pimpl->_name; }
321
322 std::string PublicKeyData::fingerprint() const
323 { return _pimpl->_fingerprint; }
324
325 std::string PublicKeyData::algoName() const
326 { return _pimpl->_algoName; }
327
329 { return _pimpl->_created; }
330
332 { return _pimpl->_expires; }
333
335 { return isExpired( _pimpl->_expires ); }
336
338 { return hasDaysToLive( _pimpl->_expires ); }
339
341 { return expiresDetailVerbose( _pimpl->_expires ); }
342
344 { return _pimpl->_id.empty() ? _pimpl->_id : str::toLower( _pimpl->_id.substr(8,8) ); }
345
347 { return _pimpl->_created ? str::hexstring( _pimpl->_created ).substr(2) : std::string(); }
348
349 std::string PublicKeyData::rpmName() const
350 { return str::Format( "gpg-pubkey-%1%-%2%" ) % gpgPubkeyVersion() % gpgPubkeyRelease(); }
351
352 std::string PublicKeyData::asString() const
353 {
354 if ( not *this )
355 return "[NO_KEY]";
356
358 str << "[" << _pimpl->_id << "-" << gpgPubkeyRelease();
359 for ( auto && sub : _pimpl->_subkeys )
360 str << ", " << sub.id();
361 return str << "] [" << _pimpl->_name.c_str() << "] [" << expiresDetail( _pimpl->_expires ) << "]";
362 }
363
365 { return !_pimpl->_subkeys.empty(); }
366
368 { return makeIterable( &(*_pimpl->_subkeys.begin()), &(*_pimpl->_subkeys.end()) ); }
369
370 bool PublicKeyData::providesKey( const std::string & id_r ) const
371 {
372 if ( not isSafeKeyId( id_r ) )
373 return( id_r.size() == 8 && str::endsWithCI( _pimpl->_id, id_r ) );
374
375 if ( str::endsWithCI( _pimpl->_fingerprint, id_r ) )
376 return true;
377
378 return _pimpl->hasSubkeyId( id_r );
379 }
380
382 { return AsciiArt( fingerprint(), algoName() ); }
383
384 std::ostream & dumpOn( std::ostream & str, const PublicKeyData & obj )
385 {
386 str << "[" << obj.name() << "]" << endl;
387 str << " fpr " << obj.fingerprint() << endl;
388 str << " id " << obj.id() << endl;
389 str << " alg " << obj.algoName() << endl;
390 str << " cre " << Date::ValueType(obj.created()) << ' ' << obj.created() << endl;
391 str << " exp " << Date::ValueType(obj.expires()) << ' ' << obj.expiresAsString() << endl;
392 str << " ttl " << obj.daysToLive() << endl;
393 for ( auto && sub : obj._pimpl->_subkeys )
394 str << " sub " << sub << endl;
395 str << " rpm " << obj.gpgPubkeyVersion() << "-" << obj.gpgPubkeyRelease() << endl;
396 return str;
397 }
398
399 bool operator==( const PublicKeyData & lhs, const PublicKeyData & rhs )
400 { return ( lhs.fingerprint() == rhs.fingerprint() && lhs.created() == rhs.created() ); }
401
402
408 {
410 {}
411
412 Impl( const Pathname & keyFile_r )
413 : _dontUseThisPtrDirectly( new filesystem::TmpFile )
414 {
415 PathInfo info( keyFile_r );
416 MIL << "Taking pubkey from " << keyFile_r << " of size " << info.size() << " and sha1 " << filesystem::checksum(keyFile_r, "sha1") << endl;
417
418 if ( !info.isExist() )
419 ZYPP_THROW(Exception("Can't read public key from " + keyFile_r.asString() + ", file not found"));
420
421 if ( filesystem::hardlinkCopy( keyFile_r, path() ) != 0 )
422 ZYPP_THROW(Exception("Can't copy public key data from " + keyFile_r.asString() + " to " + path().asString() ));
423
424 readFromFile();
425 }
426
427 Impl( const filesystem::TmpFile & sharedFile_r )
428 : _dontUseThisPtrDirectly( new filesystem::TmpFile( sharedFile_r ) )
429 { readFromFile(); }
430
431 // private from keyring
432 Impl( const filesystem::TmpFile & sharedFile_r, const PublicKeyData & keyData_r )
433 : _dontUseThisPtrDirectly( new filesystem::TmpFile( sharedFile_r ) )
434 , _keyData( keyData_r )
435 {
436 if ( ! keyData_r )
437 {
438 WAR << "Invalid PublicKeyData supplied: scanning from file" << endl;
439 readFromFile();
440 }
441 }
442
443 // private from keyring
444 Impl( const PublicKeyData & keyData_r )
445 : _keyData( keyData_r )
446 {}
447
448 public:
449 const PublicKeyData & keyData() const
450 { return _keyData; }
451
453 { return( /*the one and only intended use*/_dontUseThisPtrDirectly ? _dontUseThisPtrDirectly->path() : Pathname() ); }
454
455 const std::list<PublicKeyData> & hiddenKeys() const
456 { return _hiddenKeys; }
457
458 protected:
460 {
461 PathInfo info( path() );
462 MIL << "Reading pubkey from " << info.path() << " of size " << info.size() << " and sha1 " << filesystem::checksum(info.path(), "sha1") << endl;
463
464 std::list<PublicKeyData> keys = KeyManagerCtx::createForOpenPGP().readKeyFromFile( path() );
465 switch ( keys.size() )
466 {
467 case 0:
468 ZYPP_THROW( BadKeyException( "File " + path().asString() + " doesn't contain public key data" , path() ) );
469 break;
470
471 case 1:
472 // ok.
473 _keyData = keys.back();
474 _hiddenKeys.clear();
475 break;
476
477 default:
478 WAR << "File " << path().asString() << " contains multiple keys: " << keys << endl;
479 _keyData = keys.back();
480 keys.pop_back();
481 _hiddenKeys.swap( keys );
482 break;
483 }
484
485 MIL << "Read pubkey from " << info.path() << ": " << _keyData << endl;
486 }
487
488 private:
489 shared_ptr<filesystem::TmpFile> _dontUseThisPtrDirectly; // shared_ptr ok because TmpFile itself is a refernce type (no COW)
491 std::list<PublicKeyData> _hiddenKeys;
492
493 public:
495 static shared_ptr<Impl> nullimpl()
496 {
497 static shared_ptr<Impl> _nullimpl( new Impl );
498 return _nullimpl;
499 }
500
501 private:
502 friend Impl * rwcowClone<Impl>( const Impl * rhs );
504 Impl * clone() const
505 { return new Impl( *this ); }
506 };
508
510 // class PublicKey
513 : _pimpl( Impl::nullimpl() )
514 {}
515
517 : _pimpl( new Impl( file ) )
518 {}
519
521 : _pimpl( new Impl( sharedfile ) )
522 {}
523
524 PublicKey::PublicKey( const filesystem::TmpFile & sharedfile, const PublicKeyData & keyData_r )
525 : _pimpl( new Impl( sharedfile, keyData_r ) )
526 {}
527
529 : _pimpl( new Impl( keyData_r ) )
530 {}
531
533 {}
534
536 try { return PublicKey( keyFile_r ); } catch(...) { return PublicKey(); }
537
539 { return _pimpl->keyData(); }
540
542 { return _pimpl->path(); }
543
544 const std::list<PublicKeyData> & PublicKey::hiddenKeys() const
545 { return _pimpl->hiddenKeys(); }
546
547 bool PublicKey::fileProvidesKey( const std::string & id_r ) const
548 {
549 if ( providesKey( id_r ) )
550 return true;
551 for ( const auto & keydata : hiddenKeys() ) {
552 if ( keydata.providesKey( id_r ) )
553 return true;
554 }
555 return false;
556 }
557
558 std::string PublicKey::id() const
559 { return keyData().id(); }
560
561 std::string PublicKey::name() const
562 { return keyData().name(); }
563
564 std::string PublicKey::fingerprint() const
565 { return keyData().fingerprint(); }
566
567 std::string PublicKey::algoName() const
568 { return keyData().algoName(); }
569
571 { return keyData().created(); }
572
574 { return keyData().expires(); }
575
577 { return keyData().expired(); }
578
580 { return keyData().daysToLive(); }
581
582 std::string PublicKey::expiresAsString() const
583 { return keyData().expiresAsString(); }
584
585 std::string PublicKey::gpgPubkeyVersion() const
586 { return keyData().gpgPubkeyVersion(); }
587
588 std::string PublicKey::gpgPubkeyRelease() const
589 { return keyData().gpgPubkeyRelease(); }
590
591 std::string PublicKey::asString() const
592 { return keyData().asString(); }
593
594 std::string PublicKey::rpmName() const
595 { return keyData().rpmName(); }
596
597 bool PublicKey::operator==( const PublicKey & rhs ) const
598 { return rhs.keyData() == keyData(); }
599
600 bool PublicKey::operator==( const std::string & sid ) const
601 { return ( isSafeKeyId( sid ) || sid.size() == 8 ) && str::endsWithCI( fingerprint(), sid ); }
602
603 std::ostream & dumpOn( std::ostream & str, const PublicKey & obj )
604 { return dumpOn( str, obj.keyData() ); }
605
606
607
608
610} // namespace zypp
Exception thrown when the supplied key is not a valid gpg key.
Definition: PublicKey.h:48
Store and operate on date (time_t).
Definition: Date.h:33
static const ValueType day
Definition: Date.h:44
time_t ValueType
Definition: Date.h:38
static Date now()
Return the current time.
Definition: Date.h:78
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
Base class for Exception.
Definition: Exception.h:146
static KeyManagerCtx createForOpenPGP()
Creates a new KeyManagerCtx for PGP using a volatile temp.
Definition: KeyManager.cc:270
std::list< PublicKeyData > readKeyFromFile(const Pathname &file)
Returns a list of all PublicKeyData found in file.
Definition: KeyManager.cc:350
Class representing one GPG Public Keys data.
Definition: PublicKey.h:140
Date created() const
Creation / last modification date (latest selfsig).
Definition: PublicKey.cc:328
bool expired() const
Whether the key has expired.
Definition: PublicKey.cc:334
std::string name() const
Key name.
Definition: PublicKey.cc:319
Iterable< SubkeyIterator > subkeys() const
Iterate any subkeys.
Definition: PublicKey.cc:367
int daysToLive() const
Number of days (24h) until the key expires (or since it exired).
Definition: PublicKey.cc:337
std::string rpmName() const
Gpg-pubkey name as computed by rpm.
Definition: PublicKey.cc:349
bool hasSubkeys() const
Whether subkeys is not empty.
Definition: PublicKey.cc:364
PublicKeyData()
Default constructed: empty data.
Definition: PublicKey.cc:299
Date expires() const
Expiry date, or Date() if the key never expires.
Definition: PublicKey.cc:331
std::string algoName() const
Key algorithm string like RSA 2048
Definition: PublicKey.cc:325
static bool isSafeKeyId(const std::string &id_r)
Whether this is a long id (64bit/16byte) or even better a fingerprint.
Definition: PublicKey.h:231
RWCOW_pointer< Impl > _pimpl
Definition: PublicKey.h:247
bool providesKey(const std::string &id_r) const
Whether id_r is the id or fingerprint of the primary key or of a subkey.
Definition: PublicKey.cc:370
std::string id() const
Key ID.
Definition: PublicKey.cc:316
std::string fingerprint() const
Key fingerprint.
Definition: PublicKey.cc:322
std::string gpgPubkeyRelease() const
Gpg-pubkey release as computed by rpm (hexencoded created)
Definition: PublicKey.cc:346
std::string gpgPubkeyVersion() const
Gpg-pubkey version as computed by rpm (trailing 8 byte id)
Definition: PublicKey.cc:343
static PublicKeyData fromGpgmeKey(_gpgme_key *data)
Definition: PublicKey.cc:310
std::string expiresAsString() const
Definition: PublicKey.cc:340
base::DrunkenBishop AsciiArt
Random art fingerprint visualization type (base::DrunkenBishop).
Definition: PublicKey.h:236
AsciiArt asciiArt() const
Random art fingerprint visualization (base::DrunkenBishop).
Definition: PublicKey.cc:381
std::string asString() const
Simple string representation.
Definition: PublicKey.cc:352
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
Definition: PublicKey.h:284
Pathname path() const
File containing the ASCII armored key.
Definition: PublicKey.cc:541
std::string expiresAsString() const
Definition: PublicKey.cc:582
bool fileProvidesKey(const std::string &id_r) const
Extends providesKey to look at the hidden keys too.
Definition: PublicKey.cc:547
bool operator==(const PublicKey &rhs) const
Definition: PublicKey.cc:597
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: PublicKey.h:389
Date created() const
Definition: PublicKey.cc:570
PublicKey()
Default ctor.
Definition: PublicKey.cc:512
bool expired() const
Definition: PublicKey.cc:576
const std::list< PublicKeyData > & hiddenKeys() const
Additional keys data in case the ASCII armored blob contains multiple keys.
Definition: PublicKey.cc:544
static bool isSafeKeyId(const std::string &id_r)
!<
Definition: PublicKey.h:351
std::string rpmName() const
Definition: PublicKey.cc:594
std::string name() const
Definition: PublicKey.cc:561
Date expires() const
Definition: PublicKey.cc:573
const PublicKeyData & keyData() const
The public keys data (.
Definition: PublicKey.cc:538
std::string gpgPubkeyRelease() const
Definition: PublicKey.cc:588
std::string asString() const
Definition: PublicKey.cc:591
std::string fingerprint() const
Definition: PublicKey.cc:564
std::string id() const
Definition: PublicKey.cc:558
std::string algoName() const
Definition: PublicKey.cc:567
int daysToLive() const
Definition: PublicKey.cc:579
std::string gpgPubkeyVersion() const
Definition: PublicKey.cc:585
static PublicKey noThrow(const Pathname &keyFile_r)
Static ctor returning an empty PublicKey rather than throwing.
Definition: PublicKey.cc:535
bool providesKey(const std::string &id_r) const
!<
Definition: PublicKey.h:348
Class representing a GPG Public Keys subkeys.
Definition: PublicKey.h:79
RWCOW_pointer< Impl > _pimpl
Definition: PublicKey.h:118
std::string id() const
Subkey ID.
Definition: PublicKey.cc:179
PublicSubkeyData()
Default constructed: empty data.
Definition: PublicKey.cc:161
int daysToLive() const
Number of days (24h) until the key expires (or since it exired).
Definition: PublicKey.cc:191
Date expires() const
Expiry date, or Date() if the key never expires.
Definition: PublicKey.cc:185
std::string asString() const
Simple string representation.
Definition: PublicKey.cc:194
Date created() const
Creation date.
Definition: PublicKey.cc:182
bool expired() const
Whether the key has expired.
Definition: PublicKey.cc:188
Random art fingerprint visualization Visualize fingerprint data on a [17x9] (SSH) or [19x11] (GPG) or...
Definition: DrunkenBishop.h:62
Wrapper class for ::stat/::lstat.
Definition: PathInfo.h:221
const Pathname & path() const
Return current Pathname.
Definition: PathInfo.h:246
bool isExist() const
Return whether valid stat info exists.
Definition: PathInfo.h:281
const std::string & asString() const
String representation.
Definition: Pathname.h:91
Provide a new empty temporary file and delete it when no longer needed.
Definition: TmpPath.h:128
String related utilities and Regular expression matching.
std::string checksum(const Pathname &file, const std::string &algorithm)
Compute a files checksum.
Definition: PathInfo.cc:1051
int hardlinkCopy(const Pathname &oldpath, const Pathname &newpath)
Create newpath as hardlink or copy of oldpath.
Definition: PathInfo.cc:883
const std::string & asString(const std::string &t)
Global asString() that works with std::string too.
Definition: String.h:139
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition: String.cc:36
std::string hexstring(char n, int w=4)
Definition: String.h:324
std::string toLower(const std::string &s)
Return lowercase version of s.
Definition: String.cc:177
bool endsWithCI(const C_Str &str_r, const C_Str &prefix_r)
Definition: String.h:1095
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
bool operator==(const Url &lhs, const Url &rhs)
needed for find
Definition: Url.cc:875
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
Definition: Capability.cc:444
PublicKeyData implementation.
Definition: PublicKey.cc:205
static shared_ptr< Impl > fromGpgmeKey(gpgme_key_t rawData)
Definition: PublicKey.cc:247
std::vector< PublicSubkeyData > _subkeys
Definition: PublicKey.cc:213
static shared_ptr< Impl > nullimpl()
Offer default Impl.
Definition: PublicKey.cc:241
Impl * clone() const
clone for RWCOW_pointer
Definition: PublicKey.cc:290
bool hasSubkeyId(const std::string &id_r) const
Definition: PublicKey.cc:229
PublicKey implementation.
Definition: PublicKey.cc:408
Impl(const Pathname &keyFile_r)
Definition: PublicKey.cc:412
Pathname path() const
Definition: PublicKey.cc:452
const PublicKeyData & keyData() const
Definition: PublicKey.cc:449
std::list< PublicKeyData > _hiddenKeys
Definition: PublicKey.cc:491
static shared_ptr< Impl > nullimpl()
Offer default Impl.
Definition: PublicKey.cc:495
Impl(const PublicKeyData &keyData_r)
Definition: PublicKey.cc:444
Impl(const filesystem::TmpFile &sharedFile_r)
Definition: PublicKey.cc:427
Impl(const filesystem::TmpFile &sharedFile_r, const PublicKeyData &keyData_r)
Definition: PublicKey.cc:432
shared_ptr< filesystem::TmpFile > _dontUseThisPtrDirectly
Definition: PublicKey.cc:489
PublicKeyData _keyData
Definition: PublicKey.cc:490
Impl * clone() const
clone for RWCOW_pointer
Definition: PublicKey.cc:504
const std::list< PublicKeyData > & hiddenKeys() const
Definition: PublicKey.cc:455
PublicSubkeyData implementation.
Definition: PublicKey.cc:131
static shared_ptr< Impl > nullimpl()
Offer default Impl.
Definition: PublicKey.cc:146
Impl * clone() const
clone for RWCOW_pointer
Definition: PublicKey.cc:152
Convenient building of std::string with boost::format.
Definition: String.h:253
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Definition: String.h:212
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Definition: Exception.h:392
#define PL_(MSG1, MSG2, N)
Definition: Gettext.h:40
#define _(MSG)
Definition: Gettext.h:37
#define MIL
Definition: Logger.h:96
#define WAR
Definition: Logger.h:97