Pathname path() const
{ return _dataFile.path(); }
+ const std::list<PublicKeyData> & hiddenKeys() const
+ { return _hiddenKeys; }
+
protected:
void readFromFile()
{
case 1:
// ok.
+ _keyData = scanner._keys.back();
+ _hiddenKeys.clear();
break;
default:
WAR << "File " << _dataFile.path().asString() << " contains multiple keys: " << scanner._keys << endl;
+ _keyData = scanner._keys.back();
+ scanner._keys.pop_back();
+ _hiddenKeys.swap( scanner._keys );
break;
}
- _keyData = scanner._keys.back();
MIL << "Read pubkey from " << info.path() << ": " << _keyData << endl;
}
private:
filesystem::TmpFile _dataFile;
PublicKeyData _keyData;
+ std::list<PublicKeyData> _hiddenKeys;
public:
/** Offer default Impl. */
Pathname PublicKey::path() const
{ return _pimpl->path(); }
+ const std::list<PublicKeyData> & PublicKey::hiddenKeys() const
+ { return _pimpl->hiddenKeys(); }
+
std::string PublicKey::id() const
{ return keyData().id(); }
///////////////////////////////////////////////////////////////////
/// \class PublicKey
/// \brief 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 \ref PublicKeyData might be sufficient.
+ ///
+ /// \note In case the ASCII armored blob actually contains multiple
+ /// keys, the \b last keys data are made available via the API. The
+ /// additional keys data are made available via \ref hiddenKeys.
///////////////////////////////////////////////////////////////////
class PublicKey
{
std::string gpgPubkeyRelease() const; //!< \see \ref PublicKeyData
std::string asString() const; //!< \see \ref PublicKeyData
-
public:
/** File containig the ASCII armored key. */
Pathname path() const;
+ /** Additional keys data in case the ASCII armored blob containes multiple keys. */
+ const std::list<PublicKeyData> & hiddenKeys() const;
+
public:
bool operator==( PublicKey rhs ) const; // FIXME: change arg to const&
bool operator==( std::string sid ) const; // FIXME: change arg to const&