monotone

monotone Mtn Source Tree

Root/key_store.hh

1#ifndef __KEY_STORE_H__
2#define __KEY_STORE_H__
3
4#include <map>
5#include <vector>
6#include "vocab.hh"
7#include "paths.hh"
8
9class app_state;
10
11class key_store
12{
13private:
14 system_path key_dir;
15 bool have_read;
16 app_state & app;
17 std::map<rsa_keypair_id, keypair> keys;
18 std::map<hexenc<id>, rsa_keypair_id> hashes;
19
20 void get_key_file(rsa_keypair_id const & ident, system_path & file);
21 void write_key(rsa_keypair_id const & ident);
22 void read_key_dir();
23 void maybe_read_key_dir();
24public:
25 key_store(app_state & a);
26 void set_key_dir(system_path const & kd);
27 system_path const & get_key_dir();
28
29 void ensure_in_database(rsa_keypair_id const & ident);
30 bool try_ensure_in_db(hexenc<id> const & hash);
31
32 void get_key_ids(std::string const & pattern,
33 std::vector<rsa_keypair_id> & priv);
34
35 void get_keys(std::vector<rsa_keypair_id> & priv);
36
37 bool key_pair_exists(rsa_keypair_id const & ident);
38
39 void get_key_pair(rsa_keypair_id const & ident,
40 keypair & kp);
41
42 bool put_key_pair(rsa_keypair_id const & ident,
43 keypair const & kp);
44
45 // just like put_key_pair except that the key is _not_ written to disk.
46 // primarily for internal use in reading keys back from disk.
47 bool put_key_pair_memory(rsa_keypair_id const & ident,
48 keypair const & kp);
49
50
51 void delete_key(rsa_keypair_id const & ident);
52};
53
54// Local Variables:
55// mode: C++
56// fill-column: 76
57// c-file-style: "gnu"
58// indent-tabs-mode: nil
59// End:
60// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
61
62#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status