2 from __future__ import unicode_literals, with_statement
6 from binascii import hexlify
13 versions_info = json.load(open('update/versions.json'))
14 if 'signature' in versions_info:
15 del versions_info['signature']
17 print('Enter the PKCS1 private key, followed by a blank line:')
26 privkey += line.encode('ascii') + b'\n'
27 privkey = rsa.PrivateKey.load_pkcs1(privkey)
29 signature = hexlify(rsa.pkcs1.sign(json.dumps(versions_info, sort_keys=True).encode('utf-8'), privkey, 'SHA-256')).decode()
30 print('signature: ' + signature)
32 versions_info['signature'] = signature
33 with open('update/versions.json', 'w') as versionsf:
34 json.dump(versions_info, versionsf, indent=4, sort_keys=True)