X-Git-Url: https://tinc-vpn.org/git/browse?p=fides;a=blobdiff_plain;f=lib%2Fcertificate.h;fp=lib%2Fcertificate.h;h=ff8c452803c98d5c928bb32e45738f844aa9eb60;hp=0000000000000000000000000000000000000000;hb=401e0b5e1d97ded0e2c7415c6dd0f94ee6bfb470;hpb=0f3083b8693bfaddc4bf3fd6ce7174ac06afa958 diff --git a/lib/certificate.h b/lib/certificate.h new file mode 100644 index 0000000..ff8c452 --- /dev/null +++ b/lib/certificate.h @@ -0,0 +1,46 @@ +/* certificate.h - Fides certificate class + Copyright (C) 2008-2009 Guus Sliepen + + Fides is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + Fides is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program; if not, see . +*/ + +#ifndef __FIDES_CERTIFICATE_H__ +#define __FIDES_CERTIFICATE_H__ + +#include +#include +#include "publickey.h" +#include "privatekey.h" + +namespace fides { + class certificate { + friend class fides; + + /// Public key that signed this certificate. + const publickey *signer; + struct timeval timestamp; + std::string statement; + std::string signature; + + public: + certificate(const publickey *pub, struct timeval timestamp, const std::string &statement, const std::string &signature); + certificate(const privatekey *priv, struct timeval timestamp, const std::string &statement); + + std::string to_string() const; + std::string fingerprint(unsigned int bits = 64) const; + bool validate() const; + }; +} + +#endif