summaryrefslogtreecommitdiff
path: root/mozilla
diff options
context:
space:
mode:
authorMichael Shuler <michael@pbandjelly.org>2014-03-30 18:00:52 -0500
committerMichael Shuler <michael@pbandjelly.org>2014-03-30 18:00:52 -0500
commitc2d7b74733500f0390df0eb6bdb1ade2bb3615f4 (patch)
tree0c411ecbe30080836b06e1d785145bc00dfdf36f /mozilla
parent4771bbe5031368ee37952bcf8576c30cc6f4cf94 (diff)
downloadca-certificates-c2d7b74733500f0390df0eb6bdb1ade2bb3615f4.tar.gz
Fix certdata2pem.py for multiple CAs using the same CKA_LABEL
Diffstat (limited to 'mozilla')
-rw-r--r--mozilla/certdata2pem.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/mozilla/certdata2pem.py b/mozilla/certdata2pem.py
index 5cc8f4c..0482894 100644
--- a/mozilla/certdata2pem.py
+++ b/mozilla/certdata2pem.py
@@ -116,12 +116,16 @@ for obj in objects:
if obj['CKA_CLASS'] == 'CKO_CERTIFICATE':
if not obj['CKA_LABEL'] in trust or not trust[obj['CKA_LABEL']]:
continue
- fname = obj['CKA_LABEL'][1:-1].replace('/', '_')\
+ bname = obj['CKA_LABEL'][1:-1].replace('/', '_')\
.replace(' ', '_')\
.replace('(', '=')\
.replace(')', '=')\
- .replace(',', '_') + '.crt'
- fname = fname.decode('string_escape')
+ .replace(',', '_')
+ bname = bname.decode('string_escape')
+ fname = bname + '.crt'
+ if os.path.exists(fname):
+ print "Found duplicate certificate name %s, renaming." % bname
+ fname = bname + '_2.crt'
f = open(fname, 'w')
f.write("-----BEGIN CERTIFICATE-----\n")
f.write("\n".join(textwrap.wrap(base64.b64encode(obj['CKA_VALUE']), 64)))