monotone

monotone Mtn Source Tree

Root/src/key_packet.hh

1// Copyright (C) 2010 Stephen Leake <stephen_leake@stephe-leake.org>
2// Copyright (C) 2002 Graydon Hoare <graydon@pobox.com>
3//
4// This program is made available under the GNU GPL version 2.0 or
5// greater. See the accompanying file COPYING for details.
6//
7// This program is distributed WITHOUT ANY WARRANTY; without even the
8// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9// PURPOSE.
10//
11// This duplicates part of packet.hh; the intent is to deprecate that but
12// keep this.
13
14#ifndef __KEY_PACKET_HH__
15#define __KEY_PACKET_HH__
16
17#include "vocab.hh"
18
19struct cert;
20struct keypair;
21
22// packet streams are ascii text, formatted for comfortable viewing on a
23// terminal or inclusion in an email / netnews post. they can be edited with
24// vi, filtered with grep, and concatenated with cat.
25
26struct key_packet_consumer
27{
28public:
29 virtual ~key_packet_consumer() {}
30 virtual void consume_public_key(key_name const & ident,
31 rsa_pub_key const & k) = 0;
32 virtual void consume_key_pair(key_name const & ident,
33 keypair const & kp) = 0;
34 virtual void consume_old_private_key(key_name const & ident,
35 old_arc4_rsa_priv_key const & k) = 0;
36};
37
38// this writer writes key_packets into a stream
39
40struct key_packet_writer : public key_packet_consumer
41{
42 std::ostream & ost;
43 explicit key_packet_writer(std::ostream & o);
44 virtual ~key_packet_writer() {}
45
46 virtual void consume_public_key(key_name const & ident,
47 rsa_pub_key const & k);
48 virtual void consume_key_pair(key_name const & ident,
49 keypair const & kp);
50 virtual void consume_old_private_key(key_name const & ident,
51 old_arc4_rsa_priv_key const & k);
52};
53
54size_t read_key_packets(std::istream & in, key_packet_consumer & cons);
55
56#endif
57
58// Local Variables:
59// mode: C++
60// fill-column: 76
61// c-file-style: "gnu"
62// indent-tabs-mode: nil
63// End:
64// 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