monotone

monotone Mtn Source Tree

Root/keys.hh

1#ifndef __KEYS_HH__
2#define __KEYS_HH__
3
4// copyright (C) 2002, 2003, 2004 graydon hoare <graydon@pobox.com>
5// all rights reserved.
6// licensed to the public under the terms of the GNU GPL (>= 2)
7// see the file COPYING for details
8
9#include "vocab.hh"
10#include <string>
11
12// keys.{hh,cc} does all the "delicate" crypto (meaning: that which needs
13// to read passphrases and manipulate raw, decrypted private keys). it
14// could in theory be in transforms.cc too, but that file's already kinda
15// big and this stuff "feels" different, imho.
16
17struct lua_hooks;
18
19void generate_key_pair(lua_hooks & lua, // to hook for phrase
20 rsa_keypair_id const & id, // to prompting user for phrase
21 base64<rsa_pub_key> & pub,
22 base64< arc4<rsa_priv_key> > & priv,
23 // Used for unit tests only:
24 std::string const unit_test_passphrase = std::string());
25
26void change_key_passphrase(lua_hooks & lua, // to hook for phrase
27 rsa_keypair_id const & id, // to prompting user for phrase
28 base64< arc4<rsa_priv_key> > & encoded_key);
29
30void make_signature(lua_hooks & lua, // to hook for phrase
31 rsa_keypair_id const & id, // to prompting user for phrase
32 base64< arc4<rsa_priv_key> > const & priv,
33 std::string const & tosign,
34 base64<rsa_sha1_signature> & signature);
35
36bool check_signature(lua_hooks & lua,
37 rsa_keypair_id const & id,
38 base64<rsa_pub_key> const & pub,
39 std::string const & alleged_text,
40 base64<rsa_sha1_signature> const & signature);
41
42void require_password(rsa_keypair_id const & id,
43 app_state & app);
44
45// netsync stuff
46
47void read_pubkey(std::string const & in,
48 rsa_keypair_id & id,
49 base64<rsa_pub_key> & pub);
50
51void write_pubkey(rsa_keypair_id const & id,
52 base64<rsa_pub_key> const & pub,
53 std::string & out);
54
55void key_hash_code(rsa_keypair_id const & id,
56 base64<rsa_pub_key> const & pub,
57 hexenc<id> & out);
58
59void key_hash_code(rsa_keypair_id const & id,
60 base64< arc4<rsa_priv_key> > const & priv,
61 hexenc<id> & out);
62
63
64
65#endif // __KEYS_HH__

Archive Download this file

Branches

Tags

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