X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=lib%2Fpublickey.h;h=936bc1cf22a40bf76b2c68cbdb8eefac027b1deb;hb=HEAD;hp=ad7993c6ab730b0512372c6c9fd8b6b9cdcbeda6;hpb=401e0b5e1d97ded0e2c7415c6dd0f94ee6bfb470;p=fides diff --git a/lib/publickey.h b/lib/publickey.h index ad7993c..936bc1c 100644 --- a/lib/publickey.h +++ b/lib/publickey.h @@ -18,19 +18,20 @@ #ifndef __FIDES_PUBLICKEY_H__ #define __FIDES_PUBLICKEY_H__ +#ifdef __cplusplus #include #include #include #include -namespace fides { - class publickey { +namespace Fides { + class PublicKey { protected: Botan::ECDSA_PublicKey *pub; public: - publickey(); - ~publickey(); + PublicKey(); + ~PublicKey(); int trust; void load(std::istream &in); @@ -44,4 +45,28 @@ namespace fides { }; } +extern "C" { +typedef Fides::PublicKey fides_publickey; +#else +#include +typedef struct fides_publickey fides_publickey; +#endif + +extern fides_publickey *fides_publickey_new(); +extern void fides_publickey_free(fides_publickey *k); + +extern void fides_publickey_set_trust(fides_publickey *k, int trust); +extern int fides_publickey_get_trust(fides_publickey *k); + +extern void fides_publickey_load(fides_publickey *k, const char *filename); +extern void fides_publickey_save(fides_publickey *k, const char *filename); +extern bool fides_publickey_verify(fides_publickey *k, const char *data, const char *signature); +extern char *fides_publickey_to_string(fides_publickey *k); +extern void fides_publickey_from_string(fides_publickey *k, const char *in); +extern char *fides_publickey_fingerprint(fides_publickey *k, unsigned int bits); + +#ifdef __cplusplus +} +#endif + #endif