Skip to content

Commit 24dba0c

Browse files
nanotechtiennou
authored andcommitted
Sign the dmg content, not its filename
1 parent 036efff commit 24dba0c

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Scripts/helpers.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
#!/usr/bin/env python
22

33
import subprocess
4-
from hashlib import sha1
54
import base64
65

76
class BuildError(RuntimeError):
87
pass
98

109

11-
def sign_file(file, signing_key_file):
12-
hash = sha1(file).digest()
13-
signProc = subprocess.Popen(['openssl',
14-
'dgst',
15-
'-dss1',
16-
'-sign',
17-
signing_key_file],
18-
stdin=subprocess.PIPE,
10+
def sign_file(filename, signing_key_file):
11+
hashProc = subprocess.Popen(['openssl', 'dgst', '-sha1', '-binary', filename],
1912
stdout=subprocess.PIPE)
13+
hash = hashProc.communicate()[0]
14+
signProc = subprocess.Popen(['openssl', 'dgst', '-dss1', '-sign', signing_key_file],
15+
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
2016
signProc.stdin.write(hash)
2117
binsig = signProc.communicate()[0]
2218
return base64.b64encode(binsig).decode()

0 commit comments

Comments
 (0)