libzypp 17.38.5

zypp::PublicKeyData Class Reference

Class representing one GPG Public Keys data. More...

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

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

## Public Types
using | SubkeyIterator = const PublicSubkeyData *
using | KeySignatureIterator = const PublicKeySignatureData *
using | AsciiArt = base::DrunkenBishop
| Random art fingerprint visualization type (base::DrunkenBishop).

## Public Member Functions
| PublicKeyData ()
| Default constructed: empty data.
| ~PublicKeyData ()
| PublicKeyData (const PublicKeyData &)=default
| PublicKeyData (PublicKeyData &&) noexcept=default
PublicKeyData & | operator= (const PublicKeyData &)=default
PublicKeyData & | operator= (PublicKeyData &&) noexcept=default
| operator bool () const
| Whether this contains valid data (not default constructed).
std::string | id () const
| Key ID.
std::string | name () const
| Key name.
std::string | fingerprint () const
| Key fingerprint.
std::string | algoName () const
| Key algorithm string like RSA 2048.
Date | created () const
| Creation / last modification date (latest selfsig).
Date | expires () const
| Expiry date, or `Date()` if the key never expires.
bool | expired () const
| Whether the key has expired.
int | daysToLive () const
| Number of days (24h) until the key expires (or since it exired).
std::string | expiresAsString () const
std::string | gpgPubkeyVersion () const
| Gpg-pubkey version as computed by rpm (trailing 8 byte id).
std::string | gpgPubkeyRelease () const
| Gpg-pubkey release as computed by rpm (hexencoded created).
std::string | rpmName () const
| Gpg-pubkey name as computed by rpm.
Edition | gpgPubkeyEdition () const
| Gpg-pubkey Edition built from version and release.
std::string | asString () const
| Simple string representation.
bool | hasSubkeys () const
| Whether subkeys is not empty.
Iterable< SubkeyIterator > | subkeys () const
| Iterate any subkeys.
Iterable< KeySignatureIterator > | signatures () const
| Iterate all key signatures.
bool | providesKey (const std::string &id_r) const
| Whether id_r is the id or fingerprint of the primary key or of a subkey.
bool | hasSignatures () const
| Whether signatures is not empty.
AsciiArt | asciiArt () const
| Random art fingerprint visualization (base::DrunkenBishop).

## Static Public Member Functions
static bool | isSafeKeyId (const std::string &id_r)
| Whether this is a long id (64bit/16byte) or even better a fingerprint.

## Private Member Functions
| PublicKeyData (shared_ptr< Impl > data)

## Static Private Member Functions
static PublicKeyData | fromGpgmeKey (_gpgme_key *data)

## Private Attributes
RWCOW_pointer< Impl > | _pimpl

## Friends
class | KeyManagerCtx
std::ostream & | dumpOn (std::ostream &str, const PublicKeyData &obj)

## Related Symbols
(Note that these are not member symbols.)
std::ostream & | operator<< (std::ostream &str, const PublicKeyData &obj)
| Stream output.
std::ostream & | dumpOn (std::ostream &str, const PublicKeyData &obj) ZYPP_API
| Detailed stream output.
bool | operator== (const PublicKeyData &lhs, const PublicKeyData &rhs) ZYPP_API
| Equal based on fingerprint anf creation date.
bool | operator!= (const PublicKeyData &lhs, const PublicKeyData &rhs)
| NotEqual.

## Detailed Description

Class representing one GPG Public Keys data.

PublicKeyData are provided e.g. by a PublicKey or a KeyRing. PublicKeyData are usually easier to retrieve and sufficient unless you actually need an ASCII armored version of the key placed in a tempfile. In this case use PublicKey.

Definition at line 200 of file PublicKey.h.

## Member Typedef Documentation

## ◆ SubkeyIterator

using zypp::PublicKeyData::SubkeyIterator = const PublicSubkeyData *

Definition at line 281 of file PublicKey.h.

## ◆ KeySignatureIterator

using zypp::PublicKeyData::KeySignatureIterator = const PublicKeySignatureData *

Definition at line 282 of file PublicKey.h.

## ◆ AsciiArt

using zypp::PublicKeyData::AsciiArt = base::DrunkenBishop

Random art fingerprint visualization type (base::DrunkenBishop).

Definition at line 310 of file PublicKey.h.

## Constructor & Destructor Documentation

## ◆ PublicKeyData() [1/4]

zypp::PublicKeyData::PublicKeyData | ( |  | ) |

Default constructed: empty data.

class PublicKeyData

Definition at line 395 of file PublicKey.cc.

## ◆ ~PublicKeyData()

zypp::PublicKeyData::~PublicKeyData | ( |  | ) |

Definition at line 403 of file PublicKey.cc.

## ◆ PublicKeyData() [2/4]

zypp::PublicKeyData::PublicKeyData | ( | const PublicKeyData & |  | ) |
| default

## ◆ PublicKeyData() [3/4]

zypp::PublicKeyData::PublicKeyData | ( | PublicKeyData && |  | ) |
| default noexcept

## ◆ PublicKeyData() [4/4]

zypp::PublicKeyData::PublicKeyData | ( | shared_ptr< Impl > | data | ) |
| private

Definition at line 399 of file PublicKey.cc.

## Member Function Documentation

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

PublicKeyData & zypp::PublicKeyData::operator= | ( | const PublicKeyData & |  | ) |
| default

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

PublicKeyData & zypp::PublicKeyData::operator= | ( | PublicKeyData && |  | ) |
| default noexcept

## ◆ operator bool()

zypp::PublicKeyData::operator bool | ( |  | ) | const
| explicit

Whether this contains valid data (not default constructed).

Definition at line 409 of file PublicKey.cc.

## ◆ id()

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

Key ID.

Definition at line 412 of file PublicKey.cc.

## ◆ name()

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

Key name.

Definition at line 415 of file PublicKey.cc.

## ◆ fingerprint()

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

Key fingerprint.

Definition at line 418 of file PublicKey.cc.

## ◆ algoName()

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

Key algorithm string like RSA 2048.

Definition at line 421 of file PublicKey.cc.

## ◆ created()

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

Creation / last modification date (latest selfsig).

Definition at line 424 of file PublicKey.cc.

## ◆ expires()

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

Expiry date, or `Date()` if the key never expires.

Definition at line 427 of file PublicKey.cc.

## ◆ expired()

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

Whether the key has expired.

Definition at line 430 of file PublicKey.cc.

## ◆ daysToLive()

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

Number of days (24h) until the key expires (or since it exired).

A value of `0` means the key will expire within the next 24h. Negative values indicate the key has expired less than `N` days ago. For keys without expiration date `INT_MAX` is returned.

Definition at line 433 of file PublicKey.cc.

## ◆ expiresAsString()

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

- Expiry info in a human readable form. The expiry date plus an annotation if the key has expired, or will expire within 90 days.
  (does not expire)
  Tue May 11 13:37:33 CEST 2010
  Tue May 11 13:37:33 CEST 2010 (expires in 90 days)
  Tue May 11 13:37:33 CEST 2010 (expires in 1 day)
  Tue May 11 13:37:33 CEST 2010 (expires within 24h)
  Tue May 11 13:37:33 CEST 2010 (EXPIRED)
  zypp::PublicKeyData::expires
  Date expires() const
  Expiry date, or Date() if the key never expires.
  Definition PublicKey.cc:427

Definition at line 436 of file PublicKey.cc.

## ◆ gpgPubkeyVersion()

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

Gpg-pubkey version as computed by rpm (trailing 8 byte id).

Definition at line 439 of file PublicKey.cc.

## ◆ gpgPubkeyRelease()

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

Gpg-pubkey release as computed by rpm (hexencoded created).

Definition at line 442 of file PublicKey.cc.

## ◆ rpmName()

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

Gpg-pubkey name as computed by rpm.

Definition at line 445 of file PublicKey.cc.

## ◆ gpgPubkeyEdition()

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

Gpg-pubkey Edition built from version and release.

Definition at line 269 of file PublicKey.h.

## ◆ asString()

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

Simple string representation.

Encodes id, gpgPubkeyRelease, name and fingerprint.

[E3A5C360307E3D54-4be01a65] [SuSE Package Signing Key <build@suse.de>] [4E98E67519D98DC7362A5990E3A5C360307E3D54]
zypp::Package
Package interface.
Definition Package.h:34

Definition at line 448 of file PublicKey.cc.

## ◆ hasSubkeys()

bool zypp::PublicKeyData::hasSubkeys | ( |  | ) | const

Whether subkeys is not empty.

Definition at line 460 of file PublicKey.cc.

## ◆ subkeys()

Iterable< PublicKeyData::SubkeyIterator > zypp::PublicKeyData::subkeys | ( |  | ) | const

Iterate any subkeys.

Definition at line 463 of file PublicKey.cc.

## ◆ signatures()

Iterable< PublicKeyData::KeySignatureIterator > zypp::PublicKeyData::signatures | ( |  | ) | const

Iterate all key signatures.

Definition at line 466 of file PublicKey.cc.

## ◆ providesKey()

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

Whether id_r is the id or fingerprint of the primary key or of a subkey.

As a convenience also allows to test the 8byte short ID e.g. rpm uses as version.

Definition at line 469 of file PublicKey.cc.

## ◆ isSafeKeyId()

bool zypp::PublicKeyData::isSafeKeyId | ( | const std::string & | id_r | ) |
| inline static

Whether this is a long id (64bit/16byte) or even better a fingerprint.

A short Id (32bit/8byte) is not considered to be a safe identifier for a key.

Definition at line 301 of file PublicKey.h.

## ◆ hasSignatures()

bool zypp::PublicKeyData::hasSignatures | ( |  | ) | const

Whether signatures is not empty.

## ◆ asciiArt()

PublicKeyData::AsciiArt zypp::PublicKeyData::asciiArt | ( |  | ) | const

Random art fingerprint visualization (base::DrunkenBishop).

PublicKeyData key;
cout << key.asciiArt( PublicKey::AsciiArt::USE_COLOR ) << endl;
zypp::PublicKeyData::PublicKeyData
PublicKeyData()
Default constructed: empty data.
Definition PublicKey.cc:395
zypp::PublicKeyData::asciiArt
AsciiArt asciiArt() const
Random art fingerprint visualization (base::DrunkenBishop).
Definition PublicKey.cc:480
zypp::base::DrunkenBishop::USE_COLOR
@ USE_COLOR
use colors
Definition DrunkenBishop.h:92

Definition at line 480 of file PublicKey.cc.

## ◆ fromGpgmeKey()

PublicKeyData zypp::PublicKeyData::fromGpgmeKey | ( | _gpgme_key * | data | ) |
| static private

Definition at line 406 of file PublicKey.cc.

## Friends And Related Symbol Documentation

## ◆ KeyManagerCtx

friend class KeyManagerCtx
| friend

Definition at line 324 of file PublicKey.h.

## ◆ dumpOn [1/2]

std::ostream & dumpOn | ( | std::ostream & | str,
|  | const PublicKeyData & | obj )
| friend

Definition at line 483 of file PublicKey.cc.

## ◆ operator<<()

std::ostream & operator<< | ( | std::ostream & | str,
|  | const PublicKeyData & | obj )
| related

Stream output.

Definition at line 333 of file PublicKey.h.

## ◆ dumpOn() [2/2]

std::ostream & dumpOn | ( | std::ostream & | str,
|  | const PublicKeyData & | obj )
| related

Detailed stream output.

Definition at line 483 of file PublicKey.cc.

## ◆ operator==()

bool operator== | ( | const PublicKeyData & | lhs,
|  | const PublicKeyData & | rhs )
| related

Equal based on fingerprint anf creation date.

Definition at line 498 of file PublicKey.cc.

## ◆ operator!=()

bool operator!= | ( | const PublicKeyData & | lhs,
|  | const PublicKeyData & | rhs )
| related

NotEqual.

Definition at line 343 of file PublicKey.h.

## Member Data Documentation

## ◆ _pimpl

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

Definition at line 322 of file PublicKey.h.

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

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