wg genkey
qJvFeHHuffBaPWx4veJGQqXw6j5zdo5cSOaBd1Z0Km4=
echo 'qJvFeHHuffBaPWx4veJGQqXw6j5zdo5cSOaBd1Z0Km4=' | wg pubkey
knL56pMLtyQVyZXOd9m2vEeOopPtbv4tMSU0ctBvGQo=
wg genkey: /dev/urandom (on Linux)
https://github.com/WireGuard/WireGuard/blob/master/src/tools/genkey.c#L69
fd = open("/dev/urandom", O_RDONLY);
if (fd < 0)
return fd;
ret = read(fd, out, len);
close(fd);
src/uapi/wireguard.h
135:#define WG_KEY_LEN 32
Pubkey: https://github.com/WireGuard/WireGuard/blob/master/src/tools/pubkey.c#L46
irb(main):014:0> require 'rb-pure25519'
=> false
irb(main):015:0> require 'base64'
=> false
irb(main):016:0>
irb(main):017:0> priv_base64 = "qJvFeHHuffBaPWx4veJGQqXw6j5zdo5cSOaBd1Z0Km4="
=> "qJvFeHHuffBaPWx4veJGQqXw6j5zdo5cSOaBd1Z0Km4="
irb(main):018:0> priv = Base64.strict_decode64(priv)
=> "\xA8\x9B\xC5xq\xEE}\xF0Z=lx\xBD\xE2FB\xA5\xF0\xEA>sv\x8E\\H\xE6\x81wVt*n"
irb(main):019:0> pub = Rb25519.public_key_str(priv)
=> "\x92r\xF9\xEA\x93\v\xB7$\x15\xC9\x95\xCEw\xD9\xB6\xBCG\x8E\xA2\x93\xEDn\xFE-1%4r\xD0o\x19\n"
irb(main):020:0> pub_base64 = Base64.strict_encode64(pub)
=> "knL56pMLtyQVyZXOd9m2vEeOopPtbv4tMSU0ctBvGQo="
Need to fix:
instead of