monotone

monotone Mtn Source Tree

Root/keys.hh

1#ifndef __KEYS_HH__
2#define __KEYS_HH__
3
4// copyright (C) 2002, 2003 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
24void make_signature(lua_hooks & lua, // to hook for phrase
25 rsa_keypair_id const & id, // to prompting user for phrase
26 base64< arc4<rsa_priv_key> > const & priv,
27 std::string const & tosign,
28 base64<rsa_sha1_signature> & signature);
29
30bool check_signature(lua_hooks & lua,
31 rsa_keypair_id const & id,
32 base64<rsa_pub_key> const & pub,
33 std::string const & alleged_text,
34 base64<rsa_sha1_signature> const & signature);
35
36// netsync stuff
37
38void read_pubkey(std::string const & in,
39 rsa_keypair_id & id,
40 base64<rsa_pub_key> & pub);
41
42void write_pubkey(rsa_keypair_id const & id,
43 base64<rsa_pub_key> const & pub,
44 std::string & out);
45
46void key_hash_code(rsa_keypair_id const & id,
47 base64<rsa_pub_key> const & pub,
48 hexenc<id> & out);
49
50void key_hash_code(rsa_keypair_id const & id,
51 base64< arc4<rsa_priv_key> > const & priv,
52 hexenc<id> & out);
53
54
55
56#endif // __KEYS_HH__

Archive Download this file

Branches

Tags

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