diff options
author | Michael Shuler <michael@pbandjelly.org> | 2014-02-23 17:39:56 -0600 |
---|---|---|
committer | Michael Shuler <michael@pbandjelly.org> | 2014-02-23 17:39:56 -0600 |
commit | 813fc23d8ab0ff02f4612a6e647ec8b4d9a955d6 (patch) | |
tree | 2b8ecd6fe1317ca409464226002cac85a7a9b856 /mozilla/certdata2pem.py | |
parent | 490b8b38b4b76edf879cc38ffe98011fb5f8a1c1 (diff) | |
download | ca-certificates-813fc23d8ab0ff02f4612a6e647ec8b4d9a955d6.tar.gz |
Fix certdata2pem.py for multiple CAs using the same CKA_LABEL
Diffstat (limited to 'mozilla/certdata2pem.py')
-rw-r--r-- | mozilla/certdata2pem.py | 10 |
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))) |