X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=lib%2Fcertificate.h;h=02775225b04a5400e341a781d818b20267871801;hb=fa1153b4c3237d897a871331f0f9c0f8d30ca5a1;hp=ff8c452803c98d5c928bb32e45738f844aa9eb60;hpb=401e0b5e1d97ded0e2c7415c6dd0f94ee6bfb470;p=fides diff --git a/lib/certificate.h b/lib/certificate.h index ff8c452..0277522 100644 --- a/lib/certificate.h +++ b/lib/certificate.h @@ -1,4 +1,4 @@ -/* certificate.h - Fides certificate class +/* Certificate.h - Fides Certificate class Copyright (C) 2008-2009 Guus Sliepen Fides is free software; you can redistribute it and/or modify @@ -18,24 +18,26 @@ #ifndef __FIDES_CERTIFICATE_H__ #define __FIDES_CERTIFICATE_H__ -#include #include #include "publickey.h" #include "privatekey.h" -namespace fides { - class certificate { - friend class fides; +#ifdef __cplusplus +#include + +namespace Fides { + class Certificate { + friend class Manager; /// Public key that signed this certificate. - const publickey *signer; + 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); + 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; @@ -43,4 +45,22 @@ namespace fides { }; } +extern "C" { +typedef Fides::Certificate fides_certificate; +#else +typedef struct fides_certificate fides_certificate; +#endif + +extern fides_certificate *fides_certificate_new(const fides_publickey *pub, struct timeval timestamp, const char *statement, const char *signature); +extern fides_certificate *fides_certificate_new_priv(const fides_privatekey *priv, struct timeval timestamp, const char *statement); +extern void fides_certificate_free(fides_certificate *c); + +extern char *fides_certificate_to_string(fides_certificate *c); +extern char *fides_certificate_fingerprint(fides_certificate *c, unsigned int bits); +extern bool fides_certificate_validate(fides_certificate *c); + +#ifdef __cplusplus +} +#endif + #endif