zypp::PublicKey Class Reference

Class representing one GPG Public Key. More...

#include <PublicKey.h>

List of all members.

Classes

class  Impl
 PublicKey implementation. More...

Public Member Functions

 PublicKey ()
 Default ctor.
 PublicKey (const Pathname &file)
 Ctor taking the key from a file.
 PublicKey (const filesystem::TmpFile &sharedfile)
 Ctor reading the key from a TmpFile.
 ~PublicKey ()
bool isValid () const
std::string asString () const
std::string armoredData () const
std::string id () const
std::string name () const
std::string fingerprint () const
std::string gpgPubkeyVersion () const
 Version rpm would assign to this key if imported into the rpm database.
std::string gpgPubkeyRelease () const
 Release rpm would assign to this key if imported into the rpm database.
Date created () const
 Date when the key was created.
Date expires () const
 Date when the key expires.
std::string expiresAsString () const
 Expiry info in a human readable form.
bool expired () const
 Whether the key has expired.
int daysToLive () const
 Number of days (24h) until the key expires (or since it exired).
Pathname path () const
bool operator== (PublicKey b) const
bool operator== (std::string sid) const

Private Attributes

RWCOW_pointer< Impl_pimpl
 Pointer to implementation.

Friends

std::ostream & operator<< (std::ostream &str, const PublicKey &obj)

Related Functions

(Note that these are not member functions.)

std::ostream & dumpOn (std::ostream &str, const PublicKey &obj)


Detailed Description

Class representing one GPG Public Key.

If a key file actually contains multiple keys, the last one is taken.

Definition at line 72 of file PublicKey.h.


Constructor & Destructor Documentation

zypp::PublicKey::PublicKey (  ) 

Default ctor.

Definition at line 304 of file PublicKey.cc.

zypp::PublicKey::PublicKey ( const Pathname &  file  )  [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 308 of file PublicKey.cc.

zypp::PublicKey::PublicKey ( const filesystem::TmpFile sharedfile  )  [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 312 of file PublicKey.cc.

zypp::PublicKey::~PublicKey (  ) 

Definition at line 316 of file PublicKey.cc.


Member Function Documentation

bool zypp::PublicKey::isValid (  )  const [inline]

Definition at line 106 of file PublicKey.h.

References fingerprint(), and path().

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

std::string zypp::PublicKey::armoredData (  )  const

Deprecated:
noop

Definition at line 322 of file PublicKey.cc.

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

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

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

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

Version rpm would assign to this key if imported into the rpm database.

Rpm uses the lowercased trailing 8 byte from id as version, and the creations dates lowercased hexadecimal representation as release.

See also:
gpgPubkeyRelease
 [zypp OBS Project <zypp@build.opensuse.org>]
   fpr 47D7CE1DD600935B3B90365733D38EBC7FB7F464
    id 33D38EBC7FB7F464           <-- trailing 8 byte
   cre Thu Mar 13 19:15:40 2008   <-- converted to hex
   exp Sat May 22 20:15:40 2010
 ]

 Converting the creation date to its hexadecimal representation:
 $ bc <<<"obase=16;$(date -d 'Thu Mar 13 19:15:40 2008' +%s)"
 47D96F4C

 Rpms name for this key: gpg-pubkey-7fb7f464-47d96f4c

Definition at line 334 of file PublicKey.cc.

References _pimpl.

Referenced by zypp::dumpOn().

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

Release rpm would assign to this key if imported into the rpm database.

This is the creations dates hexadecimal representation as release lowercased.

See also:
gpgPubkeyVersion

Definition at line 337 of file PublicKey.cc.

References _pimpl.

Referenced by zypp::dumpOn().

Date zypp::PublicKey::created (  )  const

Date when the key was created.

Definition at line 340 of file PublicKey.cc.

References _pimpl.

Referenced by zypp::dumpOn(), zypp::target::rpm::RpmDb::importPubkey(), operator==(), and zypp::KeyRing::Impl::verifyFileSignatureWorkflow().

Date zypp::PublicKey::expires (  )  const

Date when the key expires.

If the key never expires the date is Date() (i.e. 0 seconds since the epoch (1.1.1970))

Definition at line 343 of file PublicKey.cc.

References _pimpl.

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

Expiry info in a human readable form.

The exipry daye 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)

Definition at line 346 of file PublicKey.cc.

References _pimpl.

Referenced by zypp::dumpOn().

bool zypp::PublicKey::expired (  )  const

Whether the key has expired.

Definition at line 349 of file PublicKey.cc.

References _pimpl.

int zypp::PublicKey::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 352 of file PublicKey.cc.

References _pimpl.

Referenced by zypp::dumpOn().

Pathname zypp::PublicKey::path (  )  const

bool zypp::PublicKey::operator== ( PublicKey  b  )  const

Definition at line 358 of file PublicKey.cc.

References created(), fingerprint(), and id().

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

Definition at line 365 of file PublicKey.cc.

References id().


Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  str,
const PublicKey obj 
) [friend]

Stream output

Definition at line 190 of file PublicKey.h.

std::ostream & dumpOn ( std::ostream &  str,
const PublicKey obj 
) [related]

Detailed stream output

Definition at line 370 of file PublicKey.cc.


Member Data Documentation

Pointer to implementation.

Definition at line 185 of file PublicKey.h.

Referenced by asString(), created(), daysToLive(), expired(), expires(), expiresAsString(), fingerprint(), gpgPubkeyRelease(), gpgPubkeyVersion(), id(), name(), and path().


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

doxygen