aboutsummaryrefslogtreecommitdiff
path: root/tools/sshkey2nacl.py
blob: c109a3cb9bab0c0ac5b0da2d535f3fdeed479930 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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()