Clean up the namespace.
[fides] / lib / publickey.h
1 /* fides.h - Light-weight, decentralised trust and authorisation management
2    Copyright (C) 2008-2009  Guus Sliepen <guus@tinc-vpn.org>
3   
4    Fides is free software; you can redistribute it and/or modify
5    it under the terms of the GNU Lesser General Public License as
6    published by the Free Software Foundation; either version 2.1 of
7    the License, or (at your option) any later version.
8   
9    Fides is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12    GNU Lesser General Public License for more details.
13   
14    You should have received a copy of the GNU Lesser General Public
15    License along with this program; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef __FIDES_PUBLICKEY_H__
19 #define __FIDES_PUBLICKEY_H__
20
21 #include <string>
22 #include <iostream>
23 #include <botan/botan.h>
24 #include <botan/ecdsa.h>
25         
26 namespace Fides {
27         class PublicKey {
28                 protected:
29                 Botan::ECDSA_PublicKey *pub;
30
31                 public:
32                 PublicKey();
33                 ~PublicKey();
34
35                 int trust;
36                 void load(std::istream &in);
37                 void save(std::ostream &out) const;
38                 void load(const std::string &filename);
39                 void save(const std::string &filename) const;
40                 bool verify(const std::string &data, const std::string &signature) const;
41                 std::string to_string() const;
42                 void from_string(const std::string &in);
43                 std::string fingerprint(unsigned int bits = 64) const;
44         };
45 }
46
47 #endif