libzypp 17.38.15

keyring_p.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12
13#include "keyring_p.h"
14#include "zypp/ZConfig.h"
15
16#include <iostream>
17#include <fstream>
18#include <optional>
19#include <sys/file.h>
20#include <unistd.h>
21
22#include <zypp-core/fs/TmpPath.h>
23#include <zypp/ZYppFactory.h>
24#include <zypp/ZYpp.h>
25
26#include <zypp-core/base/LogTools.h>
27#include <zypp-core/base/IOStream.h>
28#include <zypp-core/base/String.h>
29#include <zypp-core/base/Regex.h>
30#include <zypp-core/base/Gettext.h>
31#include <zypp-core/fs/WatchFile>
32#include <zypp-core/fs/PathInfo.h>
33#include <zypp-core/ExternalProgram.h>
34#include <zypp-core/fs/TmpPath.h>
35#include <zypp-common/KeyManager.h>
36#include <zypp-common/KeyRingException.h>
37
38 using std::endl;
39
40#undef ZYPP_BASE_LOGGER_LOGGROUP
41#define ZYPP_BASE_LOGGER_LOGGROUP "zypp::KeyRing"
42
44 namespace zypp
45{
46 CachedPublicKeyData::Manip::Manip(CachedPublicKeyData &cache_r, filesystem::Pathname keyring_r)
47 : _cache { cache_r }
48 , _keyring { std::move(keyring_r) }
49 {}
50
51 KeyManagerCtx &CachedPublicKeyData::Manip::keyManagerCtx() {
52 if ( not _context ) {
53 _context = KeyManagerCtx::createForOpenPGP( _keyring );
54 }
55 // frankly: don't remember why an explicit setDirty was introduced and
56 // why WatchFile was not enough. Maybe some corner case when the keyrings
57 // are created?
58 _cache.setDirty( _keyring );
59 return _context.value();
60 }
61
62 CachedPublicKeyData::Cache::Cache() {}
63
64 void CachedPublicKeyData::Cache::setDirty()
65 {
66 _keyringK.reset();
67 _keyringP.reset();
68 }
69
70 void CachedPublicKeyData::Cache::assertCache(const filesystem::Pathname &keyring_r)
71 {
72 // .kbx since gpg2-2.1
73 if ( !_keyringK )
74 _keyringK.reset( new WatchFile( keyring_r/"pubring.kbx", WatchFile::NO_INIT ) );
75 if ( !_keyringP )
76 _keyringP.reset( new WatchFile( keyring_r/"pubring.gpg", WatchFile::NO_INIT ) );
77 }
78
79 bool CachedPublicKeyData::Cache::hasChanged() const
80 {
81 bool k = _keyringK->hasChanged(); // be sure both files are checked
82 bool p = _keyringP->hasChanged();
83 return k || p;
84 }
85
86 const std::list<PublicKeyData> &CachedPublicKeyData::operator()(const filesystem::Pathname &keyring_r) const
87 { return getData( keyring_r ); }
88
89 void CachedPublicKeyData::setDirty(const filesystem::Pathname &keyring_r)
90 { _cacheMap[keyring_r].setDirty(); }
91
92 CachedPublicKeyData::Manip CachedPublicKeyData::manip(filesystem::Pathname keyring_r) { return Manip( *this, std::move(keyring_r) ); }
93
94 const std::list<PublicKeyData> &CachedPublicKeyData::getData(const filesystem::Pathname &keyring_r) const
95 {
96 Cache & cache( _cacheMap[keyring_r] );
97 // init new cache entry
98 cache.assertCache( keyring_r );
99 return getData( keyring_r, cache );
100 }
101
102 const std::list<PublicKeyData> &CachedPublicKeyData::getData(const filesystem::Pathname &keyring_r, Cache &cache_r) const
103 {
104 if ( cache_r.hasChanged() ) {
105 cache_r._data = KeyManagerCtx::createForOpenPGP( keyring_r ).listKeys();
106 pMIL( keyring_r, cache_r._data );
107 }
108 return cache_r._data;
109 }
110
111
112 KeyRingImpl::SendKeys::SendKeys( KeyRingImpl & keyRing, const Pathname & source, const Pathname & target )
113 : _source( KeyManagerCtx::createForOpenPGP( source ) )
114 , _target( keyRing.keyRingManip( target ) )
115 {}
116
117 KeyRingImpl::SendKeys::SendKeys( KeyRingImpl & keyRing, const Ring source, const Ring target )
118 : SendKeys( keyRing, keyRing.keyRingPath( source ), keyRing.keyRingPath( target ) )
119 {}
120
121 void KeyRingImpl::SendKeys::operator()( const std::string & id )
122 {
123 ByteArray keydata;
124 if ( ! _source.exportKey( id, keydata ) )
125 ZYPP_THROW(KeyRingException(_("Failed to export key.")));
126
127 if ( ! _target.keyManagerCtx().importKey( keydata ) )
128 ZYPP_THROW(KeyRingException(_("Failed to import key.")));
129 }
130
131
132 KeyRingImpl::KeyRingImpl(const filesystem::Pathname &baseTmpDir)
133 : _trusted_tmp_dir( baseTmpDir, "zypp-trusted-kr" )
134 , _general_tmp_dir( baseTmpDir, "zypp-general-kr" )
135 , _base_dir( baseTmpDir )
136 {
137 }
138
139
140 void KeyRingImpl::importKey( const PublicKey & key, const Ring ring )
141 {
142 if ( not key.isValid() ) {
143 pDBG( "Import empty key to", ring, "skipped" );
144 return;
145 }
146 // bsc#1259706: When importing keys to the general ring also update
147 // renewed trusted keys. Previously this was done only if the renewed
148 // trusted key was used to sign repo metadata.
149 if ( ring == Ring::Trusted )
150 {
151 auto myMustUpdateData = [this]( std::string_view prefix, const PublicKeyData & keyData ) -> bool {
152 MustUpdate fate = this->mustUpdateData( keyData, Ring::Trusted );
153 pMIL( prefix, fate, keyData, "to", Ring::Trusted );
154 if ( fate == MustUpdate::Present ) {
155 return false; // already in Ring::Trusted
156 }
157 return true; // new or update in Ring::Trusted
158 };
159
160 bool mustUpdate = myMustUpdateData( "Import Tkey", key.keyData() );
161 for ( const PublicKeyData & hkeyData : key.hiddenKeys() ) {
162 mustUpdate |= myMustUpdateData( " ", hkeyData );
163 }
164
165 if ( mustUpdate ) {
166 importKey( key.path(), keyRingPath( Ring::Trusted ) ); // this imports all in the file
167
168 if ( key.hiddenKeys().empty() ) {
169 _sigTrustedKeyAdded.emit( key );
170 } else {
171 // multiple keys: Export individual keys ascii armored to import in rpmdb
172 _sigTrustedKeyAdded.emit( exportKey( key, Ring::Trusted ) );
173 for ( const PublicKeyData & hkey : key.hiddenKeys() )
174 _sigTrustedKeyAdded.emit( exportKey( hkey, Ring::Trusted ) );
175 }
176 }
177 }
178 else // ring == Ring::General
179 {
180 // If all included keydata (incl. hidden keys) are already in the ring
181 // we can skip an update. Otherwise import the key into the general ring.
182 // On the fly check for each key whether it updates a trusted key and remember
183 // the id for a later update. To have proper data in the log, we report
184 // the fate of all hidden keys.
185 std::vector<PublicKeyData> trustedToUpdate;
186 auto myMustUpdateData = [this,&trustedToUpdate]( std::string_view prefix, const PublicKeyData & keyData ) -> bool {
187 MustUpdate fate = this->mustUpdateData( keyData, Ring::General );
188 if ( fate == MustUpdate::Present ) {
189 pMIL( prefix, fate, keyData, "to", Ring::General );
190 return false; // already in Ring::General
191 } else if ( this->mustUpdateData( keyData, Ring::Trusted ) == MustUpdate::Update ) {
192 pMIL( prefix, "U", keyData, "to", Ring::General ); // and later to trusted
193 trustedToUpdate.push_back( keyData );
194 } else {
195 pMIL( prefix, fate, keyData, "to", Ring::General );
196 }
197 return true; // new or update in Ring::General
198 };
199
200 bool mustUpdate = myMustUpdateData( "Import Gkey", key.keyData() );
201 for ( const PublicKeyData & hkeyData : key.hiddenKeys() ) {
202 mustUpdate |= myMustUpdateData( " ", hkeyData );
203 }
204
205 if ( mustUpdate ) {
206 importKey( key.path(), keyRingPath( Ring::General ) ); // this imports all in the file
207 SendKeys toTrusted { *this, Ring::General, Ring::Trusted };
208 for ( const PublicKeyData & keyData : trustedToUpdate ) {
209 // transfer the individual keys only! Never the complete file.
210 toTrusted( keyData.id() );
211 }
212 }
213 }
214 }
215
216 // TODO: (ma) check for a workflow where one context imports multiple keys.
217 void KeyRingImpl::importKeys( const std::list<PublicKey> & keys, const Ring ring )
218 {
219 pDBG( "Import", keys.size(), "keys to", ring );
220 for ( const PublicKey & key : keys )
221 importKey( key, ring );
222 }
223
224 void KeyRingImpl::multiKeyImport( const Pathname & keyfile_r, const Ring ring )
225 {
226 importKey( keyfile_r, keyRingPath( ring ) );
227 }
228
229
230 void KeyRingImpl::deleteKey( const std::string & id, const Ring ring )
231 {
232 PublicKeyData keyDataToDel( publicKeyData( id, ring ) );
233 if ( ! keyDataToDel )
234 {
235 WAR << "Key to delete [" << id << "] is not in " << ring << endl;
236 return;
237 }
238
239 deleteKey( id, keyRingPath( ring ) );
240 MIL << "Deleted key [" << id << "] from " << ring << endl;
241
242 if ( ring == Ring::Trusted ) {
243 _sigTrustedKeyAdded.emit ( PublicKey( keyDataToDel ) );
244 }
245 }
246
247 void KeyRingImpl::importKey( const Pathname & keyfile, const Pathname & keyring )
248 {
249 if ( ! PathInfo( keyfile ).isExist() )
250 // TranslatorExplanation first %s is key name, second is keyring name
251 ZYPP_THROW(KeyRingException( str::Format(_("Tried to import not existent key %s into keyring %s"))
252 % keyfile.asString()
253 % keyring.asString() ));
254
255 CachedPublicKeyData::Manip manip { keyRingManip( keyring ) }; // Provides the context if we want to manip a cached keyring.
256 if ( ! manip.keyManagerCtx().importKey( keyfile ) )
257 ZYPP_THROW(KeyRingException(_("Failed to import key.")));
258 }
259
260 PublicKey KeyRingImpl::exportKey( const PublicKeyData & keyData, const Pathname & keyring ) const
261 {
262 return PublicKey( dumpPublicKeyToTmp( keyData.id(), keyring ), keyData );
263 }
264
265 // TODO: (ma) not obvious why "exportKey id" checks validity, but "exportKey keyData" does not
266 PublicKey KeyRingImpl::exportKey( const std::string & id, const Pathname & keyring ) const
267 {
268 PublicKeyData keyData( publicKeyData( id, keyring ) );
269 if ( keyData )
270 return PublicKey( dumpPublicKeyToTmp( keyData.id(), keyring ), keyData );
271
272 // Here: key not found
273 WAR << "No key [" << id << "] to export from " << keyring << endl;
274 return PublicKey();
275 }
276
277 void KeyRingImpl::deleteKey( const std::string & id, const Pathname & keyring )
278 {
279 CachedPublicKeyData::Manip manip { keyRingManip( keyring ) }; // Provides the context if we want to manip a cached keyring.
280 if ( ! manip.keyManagerCtx().deleteKey( id ) )
281 ZYPP_THROW(KeyRingException(_("Failed to delete key.")));
282 }
283
284
285 PublicKeyData KeyRingImpl::publicKeyData( const std::string & id, const Pathname & keyring ) const
286 {
287 PublicKeyData ret;
288 for ( const PublicKeyData & key : publicKeyData( keyring ) )
289 {
290 if ( key.providesKey( id ) )
291 {
292 ret = key;
293 break;
294 }
295 }
296 //DBG << (ret ? "Found" : "No") << " key [" << id << "] in keyring " << keyring << endl;
297 return ret;
298 }
299
300 std::list<PublicKey> KeyRingImpl::publicKeys( const Pathname & keyring ) const
301 {
302 const std::list<PublicKeyData> & keys( publicKeyData( keyring ) );
303 std::list<PublicKey> ret;
304
305 for ( const PublicKeyData& keyData : keys )
306 {
307 PublicKey key( exportKey( keyData, keyring ) );
308 ret.push_back( key );
309 MIL << "Found key " << key << endl;
310 }
311 return ret;
312 }
313
314
315 void KeyRingImpl::dumpPublicKey( const std::string & id, const Pathname & keyring, std::ostream & stream ) const
316 {
317 KeyManagerCtx::createForOpenPGP( keyring ).exportKey(id, stream);
318 }
319
320 filesystem::TmpFile KeyRingImpl::dumpPublicKeyToTmp( const std::string & id, const Pathname & keyring ) const
321 {
322 filesystem::TmpFile tmpFile( _base_dir, "pubkey-"+id+"-" );
323 MIL << "Going to export key [" << id << "] from " << keyring << " to " << tmpFile.path() << endl;
324
325 std::ofstream os( tmpFile.path().c_str() );
326 dumpPublicKey( id, keyring, os );
327 os.close();
328 return tmpFile;
329 }
330
331 std::string KeyRingImpl::readSignatureKeyId( const Pathname & signature )
332 {
333 if ( ! PathInfo( signature ).isFile() )
334 ZYPP_THROW(KeyRingException( str::Format(_("Signature file %s not found")) % signature.asString() ));
335
336 MIL << "Determining key id of signature " << signature << endl;
337
338 std::list<std::string> fprs = KeyManagerCtx::createForOpenPGP().readSignatureFingerprints( signature );
339 if ( ! fprs.empty() ) {
340 std::string &id = fprs.back();
341 MIL << "Determined key id [" << id << "] for signature " << signature << endl;
342 return id;
343 }
344 return std::string();
345 }
346
347 bool KeyRingImpl::verifyFile( const Pathname & file, const Pathname & signature, const Pathname & keyring )
348 { return KeyManagerCtx::createForOpenPGP( keyring ).verify( file, signature ); }
349
350
351 void KeyRingImpl::preloadCachedKeys()
352 {
353 BLOCKTRACE("preloadCachedKeys");
354 // For now just load the 'gpg-pubkey-*.{asc,key}' files into the general keyring.
355 // TODO: Head for a persistent general keyring.
356 std::set<Pathname> cachedirs;
357 ZConfig & conf { ZConfig::instance() };
358 cachedirs.insert( conf.pubkeyCachePath() );
359 cachedirs.insert( "/usr/lib/rpm/gnupg/keys" );
360 if ( Pathname r = conf.systemRoot(); r != "/" && not r.empty() ) {
361 cachedirs.insert( r / conf.pubkeyCachePath() );
362 cachedirs.insert( r / "/usr/lib/rpm/gnupg/keys" );
363 }
364 if ( Pathname r = conf.repoManagerRoot(); r != "/" && not r.empty() ) {
365 cachedirs.insert( r / conf.pubkeyCachePath() );
366 cachedirs.insert( r / "/usr/lib/rpm/gnupg/keys" );
367 }
368
369 // We load all the matching files. Although the key-id embedded in the filename
370 // suggests there's just one key inside, this must not be true. There may be
371 // more keys hidden in the file (see PublicKey::hiddenKeys). And more important,
372 // there my be trusted keys with with an extended lifetime. They need to be updated
373 // on the fly in the trusteddb.
374 std::list<PublicKey> newkeys;
375 for ( const auto & cache : cachedirs ) {
376 dirForEach( cache,
377 [&newkeys]( const Pathname & dir_r, const char *const file_r )->bool {
378 static const str::regex rx { "^gpg-pubkey-([[:xdigit:]]{8,})(-[[:xdigit:]]{8,})?\\.(asc|key)$" };
379 str::smatch what;
380 if ( str::regex_match( file_r, what, rx ) ) {
381 newkeys.push_back( PublicKey( dir_r / file_r ) );
382 }
383 return true;
384 }
385 );
386 }
387 if ( not newkeys.empty() ) {
388 MIL << "Preload cached keys..." << endl;
389 importKeys( newkeys, Ring::General );
390 }
391 }
392
393} // namespace zypp
394
ZYPP_THROW
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Definition Exception.h:459
ExternalProgram.h
Gettext.h
_
#define _(MSG)
Definition Gettext.h:39
IOStream.h
KeyManager.h
KeyRingException.h
LogTools.h
pMIL
#define pMIL
Definition LogTools.h:315
pDBG
#define pDBG
Definition LogTools.h:314
MIL
#define MIL
Definition Logger.h:130
WAR
#define WAR
Definition Logger.h:131
BLOCKTRACE
#define BLOCKTRACE(M)
Definition Logger.h:51
Regex.h
String.h
ZConfig.h
ZYppFactory.h
ZYpp.h
zypp::ByteArray
Definition ByteArray.h:20
zypp::KeyManagerCtx
Definition KeyManager.h:32
zypp::KeyManagerCtx::exportKey
bool exportKey(const std::string &id, std::ostream &stream)
Exports the key with id into the given stream, returns true on success.
Definition KeyManager.cc:531
zypp::KeyManagerCtx::listKeys
std::list< PublicKeyData > listKeys()
Returns a list of all public keys found in the current keyring.
Definition KeyManager.cc:467
zypp::KeyManagerCtx::verify
bool verify(const Pathname &file, const Pathname &signature)
Tries to verify file using signature, returns true on success.
Definition KeyManager.cc:526
zypp::KeyManagerCtx::createForOpenPGP
static KeyManagerCtx createForOpenPGP()
Creates a new KeyManagerCtx for PGP using a volatile temp.
Definition KeyManager.cc:403
zypp::KeyManagerCtx::readSignatureFingerprints
std::list< std::string > readSignatureFingerprints(const Pathname &signature)
Reads all fingerprints from the signature file , returns a list of all found fingerprints.
Definition KeyManager.cc:650
zypp::KeyManagerCtx::deleteKey
bool deleteKey(const std::string &id)
Tries to delete a key specified by id, returns true on success.
Definition KeyManager.cc:622
zypp::KeyManagerCtx::importKey
bool importKey(const Pathname &keyfile)
Tries to import a key from keyfile, returns true on success.
Definition KeyManager.cc:546
zypp::KeyRingException::KeyRingException
KeyRingException()
Ctor taking message.
Definition KeyRingException.h:26
zypp::KeyRingImpl::SendKeys
Helper for in-memory key transfer between two keyrings.
Definition keyring_p.h:184
zypp::KeyRingImpl::SendKeys::operator()
void operator()(const std::string &id)
Transfer key with id from source to target keyring.
Definition keyring_p.cc:121
zypp::KeyRingImpl::SendKeys::_source
KeyManagerCtx _source
Definition keyring_p.h:201
zypp::KeyRingImpl::SendKeys::SendKeys
SendKeys(KeyRingImpl &keyRing, const Pathname &source, const Pathname &target)
Ctor creates the context for reading source and writing target.
Definition keyring_p.cc:112
zypp::KeyRingImpl::SendKeys::_target
CachedPublicKeyData::Manip _target
Definition keyring_p.h:202
zypp::KeyRingImpl::_sigTrustedKeyAdded
zyppng::Signal< void(const PublicKey &)> _sigTrustedKeyAdded
Definition keyring_p.h:257
zypp::KeyRingImpl::publicKeys
std::list< PublicKey > publicKeys(const Ring ring) const
Definition keyring_p.h:177
zypp::KeyRingImpl::MustUpdate
MustUpdate
Definition keyring_p.h:143
zypp::KeyRingImpl::MustUpdate::Update
@ Update
old version of Key is in Ring
Definition keyring_p.h:146
zypp::KeyRingImpl::MustUpdate::Present
@ Present
Key is in Ring.
Definition keyring_p.h:144
zypp::KeyRingImpl::importKey
void importKey(const PublicKey &key, const Ring ring)
Import PublicKeys into a Ring.
Definition keyring_p.cc:140
zypp::KeyRingImpl::dumpPublicKeyToTmp
filesystem::TmpFile dumpPublicKeyToTmp(const std::string &id, const Pathname &keyring) const
Definition keyring_p.cc:320
zypp::KeyRingImpl::mustUpdateData
MustUpdate mustUpdateData(const PublicKeyData &keyData, const Ring ring) const
Helper computing PublicKeyData's status in a Ring.
Definition keyring_p.h:149
zypp::KeyRingImpl::_general_tmp_dir
filesystem::TmpDir _general_tmp_dir
Definition keyring_p.h:246
zypp::KeyRingImpl::verifyFile
bool verifyFile(const Pathname &file, const Pathname &signature, const Ring ring)
Definition keyring_p.h:130
zypp::KeyRingImpl::KeyRingImpl
KeyRingImpl(const Pathname &baseTmpDir)
Definition keyring_p.cc:132
zypp::KeyRingImpl::publicKeyData
PublicKeyData publicKeyData(const std::string &id, const Ring ring) const
Definition keyring_p.h:167
zypp::KeyRingImpl::preloadCachedKeys
void preloadCachedKeys()
Load key files cached on the system into the generalKeyRing.
Definition keyring_p.cc:351
zypp::KeyRingImpl::multiKeyImport
void multiKeyImport(const Pathname &keyfile_r, const Ring ring)
Used by RpmDB to import the trusted keys.
Definition keyring_p.cc:224
zypp::KeyRingImpl::keyRingPath
const Pathname keyRingPath(const Ring ring) const
Definition keyring_p.h:206
zypp::KeyRingImpl::deleteKey
void deleteKey(const std::string &id, const Ring ring)
Definition keyring_p.cc:230
zypp::KeyRingImpl::exportKey
PublicKey exportKey(const std::string &id, const Ring ring) const
Definition keyring_p.h:118
zypp::KeyRingImpl::Ring
Ring
Definition keyring_p.h:93
zypp::KeyRingImpl::_base_dir
Pathname _base_dir
Definition keyring_p.h:247
zypp::KeyRingImpl::readSignatureKeyId
std::string readSignatureKeyId(const Pathname &signature)
Definition keyring_p.cc:331
zypp::KeyRingImpl::importKeys
void importKeys(const std::list< PublicKey > &keys, const Ring ring)
Definition keyring_p.cc:217
zypp::KeyRingImpl::keyRingManip
CachedPublicKeyData::Manip keyRingManip(const Pathname &keyring)
Impl helper providing on demand a KeyManagerCtx to manip a cached keyring.
Definition keyring_p.h:240
zypp::KeyRingImpl::dumpPublicKey
void dumpPublicKey(const std::string &id, const Ring ring, std::ostream &stream)
Definition keyring_p.h:127
zypp::KeyRingImpl::_trusted_tmp_dir
filesystem::TmpDir _trusted_tmp_dir
Definition keyring_p.h:245
zypp::PathInfo::PathInfo
PathInfo()
Definition PathInfo.cc:131
zypp::PublicKeyData
Class representing one GPG Public Keys data.
Definition PublicKey.h:201
zypp::PublicKeyData::id
std::string id() const
Key ID.
Definition PublicKey.cc:412
zypp::PublicKey
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
Definition PublicKey.h:378
zypp::PublicKey::path
Pathname path() const
File containing the ASCII armored key.
Definition PublicKey.cc:643
zypp::PublicKey::PublicKey
PublicKey()
Default ctor.
Definition PublicKey.cc:614
zypp::PublicKey::hiddenKeys
const std::list< PublicKeyData > & hiddenKeys() const
Additional keys data in case the ASCII armored blob contains multiple keys.
Definition PublicKey.cc:646
zypp::PublicKey::keyData
const PublicKeyData & keyData() const
The public keys data (.
Definition PublicKey.cc:640
zypp::PublicKey::isValid
bool isValid() const
Definition PublicKey.h:416
zypp::WatchFile::WatchFile
WatchFile(const Pathname &path_r=Pathname(), Initial mode=INIT)
Definition watchfile.h:56
zypp::WatchFile::NO_INIT
@ NO_INIT
Definition watchfile.h:52
zypp::ZConfig
Interim helper class to collect global options and settings.
Definition ZConfig.h:82
zypp::ZConfig::repoManagerRoot
Pathname repoManagerRoot() const
The RepoManager root directory.
Definition ZConfig.cc:834
zypp::ZConfig::systemRoot
Pathname systemRoot() const
The target root directory.
Definition ZConfig.cc:831
zypp::ZConfig::instance
static ZConfig & instance()
Singleton ctor.
Definition ZConfig.cc:794
zypp::ZConfig::pubkeyCachePath
Pathname pubkeyCachePath() const
Path where the pubkey caches.
Definition ZConfig.cc:928
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zypp::filesystem::Pathname::c_str
const char * c_str() const
String representation.
Definition Pathname.h:113
zypp::filesystem::Pathname::asString
const std::string & asString() const
String representation.
Definition Pathname.h:94
zypp::filesystem::Pathname::empty
bool empty() const
Test for an empty path.
Definition Pathname.h:117
zypp::filesystem::TmpFile
Provide a new empty temporary file and delete it when no longer needed.
Definition TmpPath.h:118
zypp::filesystem::TmpPath::path
Pathname path() const
Definition TmpPath.cc:124
zypp::str::regex
Regular expression.
Definition Regex.h:95
zypp::str::smatch
Regular expression match result.
Definition Regex.h:168
zypp::str::regex_match
bool regex_match(const char *s, smatch &matches, const regex &regex) ZYPP_API
Regular expression matching.
Definition Regex.cc:80
std
Definition ansi.h:855
zypp::keyring
Definition KeyRingContexts.cc:18
zypp::target
Definition KeyRing.h:325
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::CachedPublicKeyData::Cache
Definition keyring_p.h:61
zypp::CachedPublicKeyData::Cache::_keyringP
scoped_ptr< WatchFile > _keyringP
Definition keyring_p.h:75
zypp::CachedPublicKeyData::Cache::setDirty
void setDirty()
Definition keyring_p.cc:64
zypp::CachedPublicKeyData::Cache::assertCache
void assertCache(const Pathname &keyring_r)
Definition keyring_p.cc:70
zypp::CachedPublicKeyData::Cache::hasChanged
bool hasChanged() const
Definition keyring_p.cc:79
zypp::CachedPublicKeyData::Cache::_data
std::list< PublicKeyData > _data
Definition keyring_p.h:70
zypp::CachedPublicKeyData::Cache::Cache
Cache()
Definition keyring_p.cc:62
zypp::CachedPublicKeyData::Cache::_keyringK
scoped_ptr< WatchFile > _keyringK
Definition keyring_p.h:74
zypp::CachedPublicKeyData::Manip
Helper providing on demand a KeyManagerCtx to manip the cached keyring.
Definition keyring_p.h:44
zypp::CachedPublicKeyData::Manip::_context
std::optional< KeyManagerCtx > _context
Definition keyring_p.h:52
zypp::CachedPublicKeyData::Manip::_keyring
Pathname _keyring
Definition keyring_p.h:51
zypp::CachedPublicKeyData::Manip::keyManagerCtx
KeyManagerCtx & keyManagerCtx()
Definition keyring_p.cc:51
zypp::CachedPublicKeyData::Manip::Manip
Manip(CachedPublicKeyData &cache_r, Pathname keyring_r)
Definition keyring_p.cc:46
zypp::CachedPublicKeyData::Manip::_cache
CachedPublicKeyData & _cache
Definition keyring_p.h:50
zypp::CachedPublicKeyData
Functor returning the keyrings data (cached).
Definition keyring_p.h:33
zypp::CachedPublicKeyData::setDirty
void setDirty(const Pathname &keyring_r)
Definition keyring_p.cc:89
zypp::CachedPublicKeyData::_cacheMap
CacheMap _cacheMap
Definition keyring_p.h:84
zypp::CachedPublicKeyData::operator()
const std::list< PublicKeyData > & operator()(const Pathname &keyring_r) const
Definition keyring_p.cc:86
zypp::CachedPublicKeyData::getData
const std::list< PublicKeyData > & getData(const Pathname &keyring_r) const
Definition keyring_p.cc:94
zypp::CachedPublicKeyData::manip
Manip manip(Pathname keyring_r)
Helper providing on demand a KeyManagerCtx to manip the cached keyring.
Definition keyring_p.cc:92
zypp::str::Format
Convenient building of std::string with boost::format.
Definition String.h:254
keyring_p.h
PathInfo.h
TmpPath.h