forked from diladele/squid-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsign.py
37 lines (32 loc) · 1.08 KB
/
sign.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os
import argparse
import subprocess
def sign(file, pfx):
cmd = " ".join(
[
"c:/Program Files (x86)/Windows Kits/8.1/bin/x64/signtool.exe",
"sign",
"/ph",
"/v",
#"/ac " + os.path.abspath("contrib/certificates/production/After_10-10-10_MSCV-VSClass3.cer"),
"/f " + pfx,
"/p " + os.environ['DILADELE_B_V_CERTIFICATE_PASSWORD'],
"/d", '"Squid Proxy for Windows"',
"/t", "http://timestamp.verisign.com/scripts/timestamp.dll", "\"" + os.path.abspath(file) + "\""
]
)
if 0 != subprocess.call(cmd) :
raise Exception("can not sign file " + cmd)
#
# code
#
def main():
parser = argparse.ArgumentParser(description='Signs MSI installer.')
parser.add_argument("--msi", help="full path to MSI to sign", required=True)
parser.add_argument("--pfx", help="full path to PFX encoded certificate", required=True)
args = parser.parse_args()
sign(args.msi, args.pfx)
#
# entry point
#
main()