From 7576a1ebd03e1d7e68bd1701b8bff8159230fe19 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Wed, 8 Dec 2021 09:55:37 +0100 Subject: add tooling for signing There's tools for key generation and conversion and there's tools for signing and verifying a tree leaf. Note that the leaf signing tools use the yet to be decided about SSH signing format, with message (ie signers checksum) being hashed with SHA-512 to match SSH tooling (ssh-keygen -Y). --- tools/sshkey2nacl.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 tools/sshkey2nacl.py (limited to 'tools/sshkey2nacl.py') 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() -- cgit v1.2.3