2018-10-07 18:21:34 -05:00
|
|
|
import hashlib, json
|
2018-08-08 06:12:38 -05:00
|
|
|
|
|
|
|
def H(m):
|
|
|
|
return hashlib.sha512(m).digest()
|
|
|
|
|
|
|
|
import ed25519
|
|
|
|
import os
|
|
|
|
|
2018-10-07 18:21:34 -05:00
|
|
|
# Load signing keys from location outside of repo
|
|
|
|
keys = json.loads(file('../../../misc/config/installer_signing_key.json', 'r').read())
|
2018-08-08 06:12:38 -05:00
|
|
|
|
2018-10-07 18:21:34 -05:00
|
|
|
def tobin(xs):
|
|
|
|
return "".join(chr(x) for x in xs)
|
|
|
|
|
|
|
|
def gen_key():
|
|
|
|
sk = os.urandom(32)
|
|
|
|
pk = ed25519.publickey(sk)
|
|
|
|
print 'sk', [ord(c) for c in sk]
|
|
|
|
print 'pk', [ord(c) for c in pk]
|
2018-08-08 06:12:38 -05:00
|
|
|
|
2018-10-07 18:21:34 -05:00
|
|
|
hash = H(file('../tap/TunSafe-TAP-auto.exe', 'rb').read())
|
|
|
|
print hash.encode('hex'), repr(hash)
|
2018-08-08 06:12:38 -05:00
|
|
|
|
|
|
|
#m = 'test'
|
2018-10-07 18:21:34 -05:00
|
|
|
s = ed25519.signature(hash, tobin(keys['PRIVATE_KEY']), tobin(keys['PUBLIC_KEY']))
|
|
|
|
file('../tap/TunSafe-TAP-auto.exe.sig', 'wb').write(s.encode('hex'))
|