From ba286e5d624978f4f53ed5f9154790ef3595922e Mon Sep 17 00:00:00 2001 From: flu0r1ne Date: Sat, 26 Aug 2023 20:58:33 -0500 Subject: Store private key in a file with the public keyname, get rid of argon2 --- src/crypto/pubkey.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/crypto/pubkey.hpp (limited to 'src/crypto/pubkey.hpp') diff --git a/src/crypto/pubkey.hpp b/src/crypto/pubkey.hpp new file mode 100644 index 0000000..8596431 --- /dev/null +++ b/src/crypto/pubkey.hpp @@ -0,0 +1,22 @@ +extern "C" { + +#ifndef WG_KEY_LEN +#define WG_KEY_LEN 32 +#endif + +#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1) + +/* + * wg_pubkey_base64 is a C++-compatible wrapper for the curve25519 public-key + * derivation routines used natively in `wg(8)` + * + * PRIVKEY: a c-style string containing the base64-encoded private key + * BASE64: a c-style string of capacity WG_KEY_LEN_BASE64 containing the + * encoded public key + * + * returns: 0 on success + * > 0 when an error occurs (due to improper key formatting) + */ +int wg_pubkey_base64(char const * privkey, char * base64); + +} -- cgit v1.2.3