libzypp  17.38.17
KeyManager.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_KEYMANAGER_H
13 #define ZYPP_KEYMANAGER_H
14 
16 #include <zypp-core/Pathname.h>
17 #include <zypp-common/PublicKey.h>
18 #include <zypp-core/ByteArray.h>
19 #include <iosfwd>
20 
21 namespace zypp
22 {
23 
32 {
33  public:
45 
53  static KeyManagerCtx createForOpenPGP( const Pathname & keyring_r );
54 
56  Pathname homedir() const;
57 
59  std::list<PublicKeyData> listKeys();
60 
62  std::list<PublicKeyData> readKeyFromFile(const Pathname & file);
63 
65  bool verify(const Pathname & file, const Pathname & signature);
66 
68  bool exportKey(const std::string & id, std::ostream & stream);
69 
71  bool exportKey(const std::string & id, ByteArray & keydata);
72 
74  bool importKey(const Pathname & keyfile);
75 
77  bool importKey(std::istream & stream);
78 
80  bool importKey(const ByteArray & keydata);
81 
83  bool deleteKey (const std::string & id);
84 
86  std::list<std::string> readSignatureFingerprints(const Pathname & signature);
87 
89  std::list<std::string> readSignatureFingerprints( const ByteArray & keyData );
90 
91  private:
92  KeyManagerCtx();
93 
94  class Impl;
96 };
97 
98 }
99 
100 
101 #endif
std::list< PublicKeyData > readKeyFromFile(const Pathname &file)
Returns a list of all PublicKeyData found in file.
Definition: KeyManager.cc:497
bool verify(const Pathname &file, const Pathname &signature)
Tries to verify file using signature, returns true on success.
Definition: KeyManager.cc:526
static KeyManagerCtx createForOpenPGP()
Creates a new KeyManagerCtx for PGP using a volatile temp.
Definition: KeyManager.cc:403
bool exportKey(const std::string &id, std::ostream &stream)
Exports the key with id into the given stream, returns true on success.
Definition: KeyManager.cc:531
RW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: KeyManager.h:94
Pathname homedir() const
Return the homedir/keyring.
Definition: KeyManager.cc:459
bool importKey(const Pathname &keyfile)
Tries to import a key from keyfile, returns true on success.
Definition: KeyManager.cc:546
bool deleteKey(const std::string &id)
Tries to delete a key specified by id, returns true on success.
Definition: KeyManager.cc:622
std::list< PublicKeyData > listKeys()
Returns a list of all public keys found in the current keyring.
Definition: KeyManager.cc:467
std::list< std::string > readSignatureFingerprints(const Pathname &signature)
Reads all fingerprints from the signature file , returns a list of all found fingerprints.
Definition: KeyManager.cc:650
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1