libzypp: zypp::PublicKey Class Reference

libzypp 17.38.10

zypp::PublicKey Class Reference

Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile). More...

`#include <zypp-common/PublicKey.h>`

## Classes
class | Impl
| PublicKey implementation. More...

## Public Types
using | SubkeyIterator = PublicKeyData::SubkeyIterator
using | AsciiArt = PublicKeyData::AsciiArt

## Public Member Functions
| PublicKey ()
| Default ctor.
| PublicKey (const Pathname &keyFile_r)
| Ctor taking the key from a file.
| PublicKey (const filesystem::TmpFile &sharedFile_r)
| Ctor reading the key from a TmpFile.
| ~PublicKey ()
const PublicKeyData & | keyData () const
| The public keys data (.
bool | isValid () const
std::string | id () const
std::string | name () const
std::string | fingerprint () const
std::string | algoName () const
Date | created () const
Date | expires () const
std::string | expiresAsString () const
bool | expired () const
int | daysToLive () const
std::string | gpgPubkeyVersion () const
std::string | gpgPubkeyRelease () const
std::string | asString () const
std::string | rpmName () const
Edition | gpgPubkeyEdition () const
| !<
bool | hasSubkeys () const
| !<
Iterable< SubkeyIterator > | subkeys () const
| !<
bool | providesKey (const std::string &id_r) const
| !<
AsciiArt | asciiArt () const
| !<
Pathname | path () const
| File containing the ASCII armored key.
bool | hasHiddenKeys () const
const std::list< PublicKeyData > & | hiddenKeys () const
| Additional keys data in case the ASCII armored blob contains multiple keys.
bool | fileProvidesKey (const std::string &id_r) const
| Extends providesKey to look at the hidden keys too.
bool | operator== (const PublicKey &rhs) const
bool | operator!= (const PublicKey &rhs) const
bool | operator== (const std::string &sid) const
bool | operator!= (const std::string &sid) const

## Static Public Member Functions
static PublicKey | noThrow (const Pathname &keyFile_r)
| Static ctor returning an empty PublicKey rather than throwing.
static bool | isSafeKeyId (const std::string &id_r)
| !<

## Private Member Functions
| PublicKey (const filesystem::TmpFile &sharedFile_r, const PublicKeyData &keyData_r)
| KeyRing ctor: No need to parse file if KeyRing already had valid KeyData.
| PublicKey (const PublicKeyData &keyData_r)
| KeyRing ctor: Legacy callback APIs take PublicKey, but just need the PublicKeyData No need to export to file.

## Private Attributes
RWCOW_pointer< Impl > | _pimpl
| Pointer to implementation.

## Friends
class | KeyRingImpl

## Detailed Description

Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).

If you don't need the ASCII armored version of the key stored in a tempfile, using PublicKeyData might be sufficient.

Note
  In case the ASCII armored blob actually contains multiple keys, the last keys data are made available via the API. The additional keys data are made available via hiddenKeys.

Definition at line 374 of file PublicKey.h.

## Member Typedef Documentation

## ◆ SubkeyIterator

using zypp::PublicKey::SubkeyIterator = PublicKeyData::SubkeyIterator

Definition at line 411 of file PublicKey.h.

## ◆ AsciiArt

using zypp::PublicKey::AsciiArt = PublicKeyData::AsciiArt

Definition at line 446 of file PublicKey.h.

## Constructor & Destructor Documentation

## ◆ PublicKey() [1/5]

zypp::PublicKey::PublicKey | ( |  | ) |

Default ctor.

Definition at line 611 of file PublicKey.cc.

## ◆ PublicKey() [2/5]

zypp::PublicKey::PublicKey | ( | const Pathname & | keyFile_r | ) |
| explicit

Ctor taking the key from a file.

This is quite expensive, as a copy of the file is created and used. If you can construct PublicKey from a filesystem::TmpFile, this prevents copying.

Exceptions

  when | data does not make a key

Definition at line 615 of file PublicKey.cc.

## ◆ PublicKey() [3/5]

zypp::PublicKey::PublicKey | ( | const filesystem::TmpFile & | sharedFile_r | ) |
| explicit

Ctor reading the key from a TmpFile.

PublicKey holds a reference on the TmpFile providing the key.

Exceptions

  when | data does not make a key

Definition at line 619 of file PublicKey.cc.

## ◆ ~PublicKey()

zypp::PublicKey::~PublicKey | ( |  | ) |

Definition at line 631 of file PublicKey.cc.

## ◆ PublicKey() [4/5]

zypp::PublicKey::PublicKey | ( | const filesystem::TmpFile & | sharedFile_r,
|  | const PublicKeyData & | keyData_r )
| private

KeyRing ctor: No need to parse file if KeyRing already had valid KeyData.

Definition at line 623 of file PublicKey.cc.

## ◆ PublicKey() [5/5]

zypp::PublicKey::PublicKey | ( | const PublicKeyData & | keyData_r | ) |
| explicitprivate

KeyRing ctor: Legacy callback APIs take PublicKey, but just need the PublicKeyData No need to export to file.

Definition at line 627 of file PublicKey.cc.

## Member Function Documentation

## ◆ noThrow()

PublicKey zypp::PublicKey::noThrow | ( | const Pathname & | keyFile_r | ) |
| static

Static ctor returning an empty PublicKey rather than throwing.

Definition at line 634 of file PublicKey.cc.

## ◆ keyData()

const PublicKeyData & zypp::PublicKey::keyData | ( |  | ) | const

The public keys data (.

See also
  PublicKeyData).

Definition at line 637 of file PublicKey.cc.

## ◆ isValid()

bool zypp::PublicKey::isValid | ( |  | ) | const
| inline

Definition at line 413 of file PublicKey.h.

## ◆ id()

std::string zypp::PublicKey::id | ( |  | ) | const

See also
  PublicKeyData

Definition at line 657 of file PublicKey.cc.

## ◆ name()

std::string zypp::PublicKey::name | ( |  | ) | const

See also
  PublicKeyData

Definition at line 660 of file PublicKey.cc.

## ◆ fingerprint()

std::string zypp::PublicKey::fingerprint | ( |  | ) | const

See also
  PublicKeyData

Definition at line 663 of file PublicKey.cc.

## ◆ algoName()

std::string zypp::PublicKey::algoName | ( |  | ) | const

See also
  PublicKeyData

Definition at line 666 of file PublicKey.cc.

## ◆ created()

Date zypp::PublicKey::created | ( |  | ) | const

See also
  PublicKeyData

Definition at line 669 of file PublicKey.cc.

## ◆ expires()

Date zypp::PublicKey::expires | ( |  | ) | const

See also
  PublicKeyData

Definition at line 672 of file PublicKey.cc.

## ◆ expiresAsString()

std::string zypp::PublicKey::expiresAsString | ( |  | ) | const

See also
  PublicKeyData

Definition at line 681 of file PublicKey.cc.

## ◆ expired()

bool zypp::PublicKey::expired | ( |  | ) | const

See also
  PublicKeyData

Definition at line 675 of file PublicKey.cc.

## ◆ daysToLive()

int zypp::PublicKey::daysToLive | ( |  | ) | const

See also
  PublicKeyData

Definition at line 678 of file PublicKey.cc.

## ◆ gpgPubkeyVersion()

std::string zypp::PublicKey::gpgPubkeyVersion | ( |  | ) | const

See also
  PublicKeyData

Definition at line 684 of file PublicKey.cc.

## ◆ gpgPubkeyRelease()

std::string zypp::PublicKey::gpgPubkeyRelease | ( |  | ) | const

See also
  PublicKeyData

Definition at line 687 of file PublicKey.cc.

## ◆ asString()

std::string zypp::PublicKey::asString | ( |  | ) | const

See also
  PublicKeyData

Definition at line 690 of file PublicKey.cc.

## ◆ rpmName()

std::string zypp::PublicKey::rpmName | ( |  | ) | const

Definition at line 693 of file PublicKey.cc.

## ◆ gpgPubkeyEdition()

Edition zypp::PublicKey::gpgPubkeyEdition | ( |  | ) | const
| inline

!<

See also
  PublicKeyData

Definition at line 430 of file PublicKey.h.

## ◆ hasSubkeys()

bool zypp::PublicKey::hasSubkeys | ( |  | ) | const
| inline

!<

See also
  PublicKeyData

Definition at line 433 of file PublicKey.h.

## ◆ subkeys()

Iterable< SubkeyIterator > zypp::PublicKey::subkeys | ( |  | ) | const
| inline

!<

See also
  PublicKeyData

Definition at line 436 of file PublicKey.h.

## ◆ providesKey()

bool zypp::PublicKey::providesKey | ( | const std::string & | id_r | ) | const
| inline

!<

See also
  PublicKeyData

Definition at line 439 of file PublicKey.h.

## ◆ isSafeKeyId()

bool zypp::PublicKey::isSafeKeyId | ( | const std::string & | id_r | ) |
| inlinestatic

!<

See also
  PublicKeyData

Definition at line 442 of file PublicKey.h.

## ◆ asciiArt()

AsciiArt zypp::PublicKey::asciiArt | ( |  | ) | const
| inline

!<

See also
  PublicKeyData !<
  PublicKeyData

Definition at line 448 of file PublicKey.h.

## ◆ path()

Pathname zypp::PublicKey::path | ( |  | ) | const

File containing the ASCII armored key.

Definition at line 640 of file PublicKey.cc.

## ◆ hasHiddenKeys()

bool zypp::PublicKey::hasHiddenKeys | ( |  | ) | const
| inline

Definition at line 455 of file PublicKey.h.

## ◆ hiddenKeys()

const std::list< PublicKeyData > & zypp::PublicKey::hiddenKeys | ( |  | ) | const

Additional keys data in case the ASCII armored blob contains multiple keys.

Definition at line 643 of file PublicKey.cc.

## ◆ fileProvidesKey()

bool zypp::PublicKey::fileProvidesKey | ( | const std::string & | id_r | ) | const

Extends providesKey to look at the hidden keys too.

Those 'hidden' keys become visible when the file is imported into a keyring.

Definition at line 646 of file PublicKey.cc.

## ◆ operator==() [1/2]

bool zypp::PublicKey::operator== | ( | const PublicKey & | rhs | ) | const

Definition at line 696 of file PublicKey.cc.

## ◆ operator!=() [1/2]

bool zypp::PublicKey::operator!= | ( | const PublicKey & | rhs | ) | const
| inline

Definition at line 468 of file PublicKey.h.

## ◆ operator==() [2/2]

bool zypp::PublicKey::operator== | ( | const std::string & | sid | ) | const

Definition at line 699 of file PublicKey.cc.

## ◆ operator!=() [2/2]

bool zypp::PublicKey::operator!= | ( | const std::string & | sid | ) | const
| inline

Definition at line 471 of file PublicKey.h.

## Friends And Related Symbol Documentation

## ◆ KeyRingImpl

friend class KeyRingImpl
| friend

Definition at line 475 of file PublicKey.h.

## Member Data Documentation

## ◆ _pimpl

RWCOW_pointer<Impl> zypp::PublicKey::_pimpl
| private

Pointer to implementation.

Definition at line 483 of file PublicKey.h.

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

- zypp-common/PublicKey.h
- zypp-common/PublicKey.cc