aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2009-09-29 22:41:06 +0000
committerRob Austein <sra@hactrn.net>2009-09-29 22:41:06 +0000
commitaf8e4e951f9e395e7b9d65a4bd6975295a771872 (patch)
tree9b4f8b9104097ec2ab72b519e225b36d0ad3dd17
parentc652b25fa1e33741aaf6d9879204cef93d34f4ad (diff)
Allow OpenSSL's normal explanatory text in PEM files, to make it
easier for users to keep track of which BPKI certificate is which. svn path=/myrpki/myrpki.py; revision=2797
-rw-r--r--myrpki/myrpki.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/myrpki/myrpki.py b/myrpki/myrpki.py
index f894a92d..7937521d 100644
--- a/myrpki/myrpki.py
+++ b/myrpki/myrpki.py
@@ -376,8 +376,14 @@ def PEMElement(e, tag, filename):
Create an XML element containing Base64 encoded data taken from a
PEM file.
"""
- e = SubElement(e, tag)
- e.text = "".join(p.strip() for p in open(filename).readlines()[1:-1])
+ lines = open(filename).readlines()
+ while lines:
+ if lines.pop(0).startswith("-----BEGIN "):
+ break
+ while lines:
+ if lines.pop(-1).startswith("-----END "):
+ break
+ SubElement(e, tag).text = "".join(line.strip() for line in lines)
class CA(object):
"""
@@ -410,7 +416,7 @@ class CA(object):
Run OpenSSL "ca" command with tailored environment variables and common initial
arguments.
"""
- cmd = (openssl, "ca", "-notext", "-batch", "-config", self.cfg) + args
+ cmd = (openssl, "ca", "-batch", "-config", self.cfg) + args
subprocess.check_call(cmd, env = self.env)
def run_req(self, key_file, req_file):