monotone

monotone Mtn Source Tree

Root/key_store.hh

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

Archive Download this file

Branches

Tags

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