aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/pubkey.hpp
diff options
context:
space:
mode:
authorflu0r1ne <flu0r1ne@flu0r1ne.net>2023-08-27 04:17:54 -0500
committerflu0r1ne <flu0r1ne@flu0r1ne.net>2023-08-27 15:35:13 -0500
commit7605b2ab5ea2cdd619fafbe5eea981f689865676 (patch)
tree1bcd75bfe08fd60fed60a6f2f558ccfa2f8c4a30 /src/crypto/pubkey.hpp
parent0e8737b3afe1dc5410b45761b7c9e38e022292f6 (diff)
downloadwg2nd-7605b2ab5ea2cdd619fafbe5eea981f689865676.tar.xz
wg2nd-7605b2ab5ea2cdd619fafbe5eea981f689865676.zip
Encode key in base32 to exclude the Unix path sep
Diffstat (limited to 'src/crypto/pubkey.hpp')
-rw-r--r--src/crypto/pubkey.hpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/crypto/pubkey.hpp b/src/crypto/pubkey.hpp
index 8596431..cb1f794 100644
--- a/src/crypto/pubkey.hpp
+++ b/src/crypto/pubkey.hpp
@@ -5,18 +5,21 @@ extern "C" {
#endif
#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1)
+#define WG_KEY_LEN_BASE32 (((WG_KEY_LEN + 4) / 5) * 8 + 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
+ * BASE32: 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);
+int wg_pubkey_base32(char const * privkey, char * base32);
+
+int wg_key_convert_base32(char const * base64, char * base32);
}