aboutsummaryrefslogtreecommitdiff
path: root/tools/sshkey2nacl.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/sshkey2nacl.py')
-rwxr-xr-xtools/sshkey2nacl.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/sshkey2nacl.py b/tools/sshkey2nacl.py
new file mode 100755
index 0000000..c109a3c
--- /dev/null
+++ b/tools/sshkey2nacl.py
@@ -0,0 +1,20 @@
+#! /usr/bin/env python3
+
+import sys
+from libsigntools import C25519
+from nacl.encoding import HexEncoder
+
+def main():
+ input_fn = sys.argv[1]
+ output_fn = sys.argv[2]
+
+ sk = C25519.signingKey(input_fn)
+ with open('{}.sk'.format(output_fn), 'w') as f:
+ f.write(sk.encode(HexEncoder).decode('ascii'))
+
+ vk = C25519.verifyKey('{}.pub'.format(input_fn))
+ with open('{}.vk'.format(output_fn), 'w') as f:
+ f.write(vk.encode(HexEncoder).decode('ascii'))
+
+if __name__ == '__main__':
+ main()