Use subprocess.check_call() so we don't silently ignore errors and only produce ASCII filenames by using urllib.parse.quote().
34 lines
1.5 KiB
Diff
34 lines
1.5 KiB
Diff
--- certdata2pem.py 2019-10-25 21:30:36.106307900 +0200
|
|
+++ certdata2pem_new.py 2019-10-25 21:31:02.041144900 +0200
|
|
@@ -126,7 +126,7 @@
|
|
continue
|
|
label = labelbytes.decode('utf-8')
|
|
serial = printable_serial(obj)
|
|
- return label + ":" + serial
|
|
+ return urllib.parse.quote(label + "_" + serial)
|
|
|
|
def write_cert_ext_to_file(f, oid, value, public_key):
|
|
f.write("[p11-kit-object-v1]\n")
|
|
@@ -268,7 +268,7 @@
|
|
pk_fname = "pubkey-" + fname
|
|
fpkout = open(pk_fname, "w")
|
|
dump_pk_command = ["openssl", "x509", "-in", cert_fname, "-noout", "-pubkey"]
|
|
- subprocess.call(dump_pk_command, stdout=fpkout)
|
|
+ subprocess.check_call(dump_pk_command, stdout=fpkout)
|
|
fpkout.close()
|
|
with open (pk_fname, "r") as myfile:
|
|
pk=myfile.read()
|
|
@@ -276,10 +276,10 @@
|
|
comment_fname = "comment-" + fname
|
|
fcout = open(comment_fname, "w")
|
|
comment_command = ["openssl", "x509", "-in", cert_fname, "-noout", "-text"]
|
|
- subprocess.call(comment_command, stdout=fcout)
|
|
+ subprocess.check_call(comment_command, stdout=fcout)
|
|
fcout.close()
|
|
sed_command = ["sed", "--in-place", "s/^/#/", comment_fname]
|
|
- subprocess.call(sed_command)
|
|
+ subprocess.check_call(sed_command)
|
|
with open (comment_fname, "r", errors = 'replace') as myfile:
|
|
cert_comment=myfile.read()
|
|
|