monotone

monotone Mtn Source Tree

Root/src/keys.hh

1// Copyright (C) 2002 Graydon Hoare <graydon@pobox.com>
2//
3// This program is made available under the GNU GPL version 2.0 or
4// greater. See the accompanying file COPYING for details.
5//
6// This program is distributed WITHOUT ANY WARRANTY; without even the
7// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8// PURPOSE.
9
10#ifndef __KEYS_HH__
11#define __KEYS_HH__
12
13#include "vocab.hh"
14
15struct options;
16class project_t;
17class lua_hooks;
18class key_store;
19class database;
20struct keypair;
21class globish;
22
23class netsync_connection_info;
24typedef boost::shared_ptr<netsync_connection_info> shared_conn_info;
25
26enum key_cache_flag { cache_disable, cache_enable };
27enum key_requiredness_flag {key_optional, key_required};
28
29// keys.{hh,cc} does all the "delicate" crypto (meaning: that which needs
30// to read passphrases and manipulate raw, decrypted private keys). it
31// could in theory be in transforms.cc too, but that file's already kinda
32// big and this stuff "feels" different, imho.
33
34// Find the key to be used for signing certs. If possible, ensure the
35// database and the key_store agree on that key, and optionally cache it in
36// decrypted form, so as not to bother the user for their passphrase later.
37void
38get_user_key(options const & opts, lua_hooks & lua,
39 database & db, key_store & keys,
40 project_t & project, key_id & key,
41 key_cache_flag const cache = cache_enable);
42
43// As above, but does not report which key has been selected; for use when
44// the important thing is to have selected one and cached the decrypted key.
45void
46cache_user_key(options const & opts,
47 project_t & project,
48 key_store & keys,
49 lua_hooks & lua);
50
51// Find the key to be used for netsync authentication. If possible, ensure the
52// database and the key_store agree on that key, and cache it in decrypted
53// form, so as not to bother the user for their passphrase later.
54void
55cache_netsync_key(options const & opts,
56 project_t & project,
57 key_store & keys,
58 lua_hooks & lua,
59 shared_conn_info const & info,
60 key_requiredness_flag key_requiredness);
61
62void
63load_key_pair(key_store & keys,
64 key_id const & id);
65
66void
67load_key_pair(key_store & keys,
68 key_id const & id,
69 keypair & kp);
70
71// netsync stuff
72
73void
74key_hash_code(key_name const & ident,
75 rsa_pub_key const & pub,
76 key_id & out);
77
78bool
79keys_match(key_name const & id1,
80 rsa_pub_key const & key1,
81 key_name const & id2,
82 rsa_pub_key const & key2);
83
84#endif // __KEYS_HH__
85
86// Local Variables:
87// mode: C++
88// fill-column: 76
89// c-file-style: "gnu"
90// indent-tabs-mode: nil
91// End:
92// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:

Archive Download this file

Branches

Tags

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