]>
Raphaƫl G. Git Repositories - youtubedl/blob - devscripts/gh-pages/sign-versions.py
8a824df56fe7677868ca9b03aa24de8d4b6eba76
5 from binascii
import hexlify
12 versions_info
= json
.load(open('update/versions.json'))
13 if 'signature' in versions_info
:
14 del versions_info
['signature']
16 print('Enter the PKCS1 private key, followed by a blank line:')
25 privkey
+= line
.encode('ascii') + b
'\n'
26 privkey
= rsa
.PrivateKey
.load_pkcs1(privkey
)
28 signature
= hexlify(rsa
.pkcs1
.sign(json
.dumps(versions_info
, sort_keys
=True).encode('utf-8'), privkey
, 'SHA-256')).decode()
29 print('signature: ' + signature
)
31 versions_info
['signature'] = signature
32 json
.dump(versions_info
, open('update/versions.json', 'w'), indent
=4, sort_keys
=True)