11#include <zypp/base/String.h>
12#include <zypp/base/Logger.h>
13#include <zypp/base/Gettext.h>
60 if ( keyhints.empty() )
62 DBG <<
"Check keyhints: " << keyhints.size() << endl;
64 auto keyRing { getZYpp()->keyRing() };
65 for (
const auto & p : keyhints )
try {
66 const std::string & file { p.first };
67 const std::string & keyid { p.second };
69 if ( keyRing->trustedPublicKeyData( keyid ) ) {
70 DBG <<
"Keyhint is already trusted: " << keyid <<
" (" << file <<
")" << endl;
74 DBG <<
"Keyhint search key " << keyid <<
" (" << file <<
")" << endl;
84 if ( not key.fileProvidesKey( keyid ) ) {
87 if ( not key.fileProvidesKey( keyid ) ) {
89 WAR <<
"Keyhint " << file <<
" does not contain a key with id " << keyid <<
". Skipping it." << endl;
96 keyRing->importKey( key,
false );
97 keyData = keyRing->publicKeyData( keyid );
101 WAR <<
"Keyhint " << keyid <<
" for " << keyData <<
" is not strong enough for auto import. Just caching it." << endl;
105 DBG <<
"Keyhint remember buddy " << keyData << endl;
110 catch (
const std::exception & exp )
113 {
INT <<
"Oops!" << endl; }
114 MIL <<
"Check keyhints done. Buddy keys: " << sigchecker_r.
buddyKeys().size() << endl;
130 WAR <<
"Non implemented" << endl;
138 WAR <<
"Non implemented" << endl;
155 Pathname sigpathLocal { destdir_r/sigpath };
156 Pathname keypathLocal { destdir_r/keypath };
168 if ( isSigned ||
repoInfo().repoGpgCheckIsMandatory() )
175 if (
PathInfo(keypathLocal).isExist() )
183 if ( masterIndex_r.
basename() ==
"repomd.xml" ) {
191 catch (
const std::exception & exp )
194 {
INT <<
"Oops!" << endl; }
197 checkers.
add( std::ref(sigchecker) );
201 WAR <<
"Accept unsigned repository because repoGpgCheck is not mandatory for " <<
repoInfo().
alias() << endl;
206 WAR <<
"Signature checking disabled in config of repository " <<
repoInfo().
alias() << endl;
210 start( destdir_r, media_r );
Interface of repomd.xml file reader.
Store and operate with byte count.
static const Unit MB
1000^2 Byte
Checker composed of more checkers.
void add(const FileChecker &checker)
Base class for Exception.
void start(const Pathname &dest_dir, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
start the transfer to a destination directory dest_dir The media has to be provides with setMediaSetA...
void reset()
Reset the transfer (jobs) list.
void enqueue(const OnMediaLocation &resource, const FileChecker &checker=FileChecker())
Enqueue a object for transferal, they will not be transferred until start() is called.
void setMediaSetAccess(MediaSetAccess &media)
Sets the media set access that will be used to precache and to download the files when start is calle...
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
Class representing one GPG Public Keys data.
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
static bool isSafeKeyId(const std::string &id_r)
!<
static PublicKey noThrow(const Pathname &keyFile_r)
Static ctor returning an empty PublicKey rather than throwing.
What is known about a repository.
void setValidRepoSignature(TriBool value_r)
Set the value for validRepoSignature (or indeterminate if unsigned).
void setMetadataPath(const Pathname &path)
Set the path where the local metadata is stored.
Track changing files or directories.
Checks for the validity of a signature.
void operator()(const Pathname &file_r) const
Call KeyRing::verifyFileSignatureWorkflow to verify the file.
void addPublicKey(const PublicKey &publickey_r)
Add a public key to the list of known keys.
Interim helper class to collect global options and settings.
Pathname repoManagerRoot() const
The RepoManager root directory.
static ZConfig & instance()
Singleton ctor.
Pathname pubkeyCachePath() const
Path where the pubkey caches.
Wrapper class for stat/lstat.
bool isExist() const
Return whether valid stat info exists.
Pathname extend(const std::string &r) const
Append string r to the last component of the path.
std::string basename() const
Return the last component of this path.
bool fileValidated() const
Whether the signature was actually successfully verified.
const KeyContext & keyContext() const
KeyContext passed to callbacks
const BuddyKeys & buddyKeys() const
const Pathname & signature() const
Detached signature or empty.
void addBuddyKey(std::string sid_r)
Reads through a repomd.xml file and collects type, location, checksum and other data about metadata f...
std::vector< std::pair< std::string, std::string > > keyhints() const
gpg key hits shipped in keywords (bsc#1184326)
virtual void download(MediaSetAccess &media, const Pathname &dest_dir, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Download metadata to a local directory.
std::optional< PluginRepoverification > _pluginRepoverification
const RepoInfo & repoInfo() const
void defaultDownloadMasterIndex(MediaSetAccess &media_r, const Pathname &destdir_r, const Pathname &masterIndex_r)
Common workflow downloading a (signed) master index file.
virtual RepoStatus status(MediaSetAccess &media)
Status of the remote repository.
std::string alias() const
unique identifier for this source.
int hardlinkCopy(const Pathname &oldpath, const Pathname &newpath)
Create newpath as hardlink or copy of oldpath.
void checkExtraKeysInRepomd(MediaSetAccess &media_r, const Pathname &destdir_r, const Pathname &repomd_r, SignatureFileChecker &sigchecker_r)
Easy-to use interface to the ZYPP dependency resolver.
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).