libzypp: zypp::SignatureFileChecker Class Reference

libzypp 17.25.10

Public Types | Public Member Functions | Protected Attributes | List of all members
zypp::SignatureFileChecker Class Reference

Checks for the validity of a signature. More...

`#include <FileChecker.h>`

## Public Types
typedef SignatureCheckException | ExceptionType

## Public Member Functions
| SignatureFileChecker (const Pathname &signature)
| Constructor. More...
| SignatureFileChecker ()
| Default Constructor. More...
void | setKeyContext (const KeyContext &keycontext)
| Set context for this checker. More...
const KeyContext & | keyContext () const
| Return the current context. More...
bool | fileAccepted () const
| Return whether the last file passed to operator() was accepted. More...
bool | fileValidated () const
| Return whether the last file passed to operator() was actually sucessfully verified. More...
void | addPublicKey (const PublicKey &publickey, const KeyContext &keycontext=KeyContext())
| add a public key to the list of known keys More...
void | addPublicKey (const Pathname &publickey, const KeyContext &keycontext=KeyContext())
void | operator() (const Pathname &file) const
| Calls KeyRing::verifyFileSignatureWorkflow to verify the file. More...

## Protected Attributes
Pathname | _signature
KeyContext | _context
DefaultIntegral< bool, false > | _fileAccepted
DefaultIntegral< bool, false > | _fileValidated

## Detailed Description

Checks for the validity of a signature.

Definition at line 93 of file FileChecker.h.

## Member Typedef Documentation

## ◆ ExceptionType

typedef SignatureCheckException zypp::SignatureFileChecker::ExceptionType

Definition at line 96 of file FileChecker.h.

## Constructor & Destructor Documentation

## ◆ SignatureFileChecker() [1/2]

zypp::SignatureFileChecker::SignatureFileChecker | ( | const Pathname & | signature | ) |

Constructor.

Parameters

  signature | Signature that validates the file

Definition at line 112 of file FileChecker.cc.

## ◆ SignatureFileChecker() [2/2]

zypp::SignatureFileChecker::SignatureFileChecker | ( |  | ) |

Default Constructor.

Signature for unsigned files Use it when you dont have a signature but you want to check the user to accept an unsigned file.

Definition at line 116 of file FileChecker.cc.

## Member Function Documentation

## ◆ setKeyContext()

void zypp::SignatureFileChecker::setKeyContext | ( | const KeyContext & | keycontext | ) |

Set context for this checker.

Use this method if you're not adding the key (with context) via one of the addPublicKey methods. The addPublicKey method overwrites the context.

Definition at line 119 of file FileChecker.cc.

## ◆ keyContext()

const KeyContext& zypp::SignatureFileChecker::keyContext | ( |  | ) | const
| inline

Return the current context.

Definition at line 123 of file FileChecker.h.

## ◆ fileAccepted()

bool zypp::SignatureFileChecker::fileAccepted | ( |  | ) | const
| inline

Return whether the last file passed to operator() was accepted.

If this is false operator() was not invoked or threw a SignatureCheckException.

Definition at line 130 of file FileChecker.h.

## ◆ fileValidated()

bool zypp::SignatureFileChecker::fileValidated | ( |  | ) | const
| inline

Return whether the last file passed to operator() was actually sucessfully verified.

If this is `false` but fileAccepted, the file was accepted due to user interaction or global settings, but the signature was not verified.

Definition at line 137 of file FileChecker.h.

## ◆ addPublicKey() [1/2]

void zypp::SignatureFileChecker::addPublicKey | ( | const PublicKey & | publickey,
|  | const KeyContext & | keycontext = `KeyContext()`
| ) |  |

add a public key to the list of known keys

Definition at line 125 of file FileChecker.cc.

## ◆ addPublicKey() [2/2]

void zypp::SignatureFileChecker::addPublicKey | ( | const Pathname & | publickey,
|  | const KeyContext & | keycontext = `KeyContext()`
| ) |  |

Definition at line 122 of file FileChecker.cc.

## ◆ operator()()

void zypp::SignatureFileChecker::operator() | ( | const Pathname & | file | ) | const

Calls KeyRing::verifyFileSignatureWorkflow to verify the file.

Keep in mind the the workflow may return `true` (file accepted) due to user interaction or global defaults even if a signature was not actually sucessfully verified. Whether a signature was actually sucessfully verified can be determined by checking fileValidated which is invokes IFF a signature for this file actually validated.

Parameters

  file | File to validate.fileValidated

Exceptions

  SignatureCheckException | if validation fails

Definition at line 131 of file FileChecker.cc.

## Member Data Documentation

## ◆ _signature

Pathname zypp::SignatureFileChecker::_signature
| protected

Definition at line 162 of file FileChecker.h.

## ◆ _context

KeyContext zypp::SignatureFileChecker::_context
| protected

Definition at line 163 of file FileChecker.h.

## ◆ _fileAccepted

DefaultIntegral<bool,false> zypp::SignatureFileChecker::_fileAccepted
| mutableprotected

Definition at line 164 of file FileChecker.h.

## ◆ _fileValidated

DefaultIntegral<bool,false> zypp::SignatureFileChecker::_fileValidated
| mutableprotected

Definition at line 165 of file FileChecker.h.

The documentation for this class was generated from the following files:

- zypp/FileChecker.h
- zypp/FileChecker.cc