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.hh"
6#include "vocab.hh"
7#include "paths.hh"
8
9class app_state;
10struct globish;
11
12class key_store
13{
14private:
15 system_path key_dir;
16 bool have_read;
17 app_state & app;
18 std::map<rsa_keypair_id, keypair> keys;
19 std::map<hexenc<id>, rsa_keypair_id> hashes;
20
21 void get_key_file(rsa_keypair_id const & ident, system_path & file);
22 void write_key(rsa_keypair_id const & ident);
23 void read_key_dir();
24 void maybe_read_key_dir();
25public:
26 key_store(app_state & a);
27 void set_key_dir(system_path const & kd);
28 system_path const & get_key_dir();
29
30 void ensure_in_database(rsa_keypair_id const & ident);
31 bool try_ensure_in_db(hexenc<id> const & hash);
32
33 void get_key_ids(std::vector<rsa_keypair_id> & priv);
34 void get_key_ids(globish const & pattern,
35 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