X-Git-Url: https://tinc-vpn.org/git/browse?p=fides;a=blobdiff_plain;f=lib%2Fpublickey.h;h=936bc1cf22a40bf76b2c68cbdb8eefac027b1deb;hp=f8aae8360d726a016e6437eeca514a49d1859c4d;hb=fa1153b4c3237d897a871331f0f9c0f8d30ca5a1;hpb=8f104b8742166c41e395375c1e740d7af6224699 diff --git a/lib/publickey.h b/lib/publickey.h index f8aae83..936bc1c 100644 --- a/lib/publickey.h +++ b/lib/publickey.h @@ -18,6 +18,7 @@ #ifndef __FIDES_PUBLICKEY_H__ #define __FIDES_PUBLICKEY_H__ +#ifdef __cplusplus #include #include #include @@ -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