Clean up the namespace.
[fides] / lib / certificate.h
1 /* Certificate.h - Fides Certificate class
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_CERTIFICATE_H__
19 #define __FIDES_CERTIFICATE_H__
20
21 #include <string>
22 #include <sys/time.h>
23 #include "publickey.h"
24 #include "privatekey.h"
25
26 namespace Fides {
27         class Certificate {
28                 friend class Manager;
29
30                 /// Public key that signed this certificate.
31                 const PublicKey *signer;
32                 struct timeval timestamp;
33                 std::string statement;
34                 std::string signature;
35
36                 public:
37                 Certificate(const PublicKey *pub, struct timeval timestamp, const std::string &statement, const std::string &signature);
38                 Certificate(const PrivateKey *priv, struct timeval timestamp, const std::string &statement);
39
40                 std::string to_string() const;
41                 std::string fingerprint(unsigned int bits = 64) const;
42                 bool validate() const;
43         };
44 }
45
46 #endif