diff options
author | Linus Nordberg <linus@nordberg.se> | 2021-12-08 09:55:37 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2021-12-08 09:55:37 +0100 |
commit | 7576a1ebd03e1d7e68bd1701b8bff8159230fe19 (patch) | |
tree | 34a6b53a432b842c5aa93fdb97cb17971515280e /tools/sshkey2nacl.py | |
parent | b06f07550957ba8ba4ff237332f16147a29a6dd2 (diff) |
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).
Diffstat (limited to 'tools/sshkey2nacl.py')
-rwxr-xr-x | tools/sshkey2nacl.py | 20 |
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() |