git://git.onelab.eu
/
sfa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7169162
)
Certificate can now read protogeni style pems which have some text at the top of...
author
Josh Karlin
<jkarlin@bbn.com>
Thu, 7 Oct 2010 14:20:00 +0000
(10:20 -0400)
committer
Josh Karlin
<jkarlin@bbn.com>
Thu, 7 Oct 2010 14:20:00 +0000
(10:20 -0400)
sfa/trust/certificate.py
patch
|
blob
|
history
diff --git
a/sfa/trust/certificate.py
b/sfa/trust/certificate.py
index
64ac865
..
450f14d
100644
(file)
--- a/
sfa/trust/certificate.py
+++ b/
sfa/trust/certificate.py
@@
-299,11
+299,18
@@
class Certificate:
# load it (support for the ---parent--- tag as well as normal chained certs)
string = string.strip()
# load it (support for the ---parent--- tag as well as normal chained certs)
string = string.strip()
-
-
- if
not string.startswith('-----')
:
+
+ # If it's not in proper PEM format, wrap it
+ if
string.count('-----BEGIN CERTIFICATE') == 0
:
string = '-----BEGIN CERTIFICATE-----\n%s\n-----END CERTIFICATE-----' % string
string = '-----BEGIN CERTIFICATE-----\n%s\n-----END CERTIFICATE-----' % string
+ # If there is a PEM cert in there, but there is some other text first
+ # such as the text of the certificate, skip the text
+ beg = string.find('-----BEGIN CERTIFICATE')
+ if beg > 0:
+ # skipping over non cert beginning
+ string = string[beg:]
+
parts = []
if string.count('-----BEGIN CERTIFICATE-----') > 1 and \
parts = []
if string.count('-----BEGIN CERTIFICATE-----') > 1 and \