From 3ea044fb59bf6ada2c0e9b507c1d6c4dfd8aaa23 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 3 May 2010 17:38:39 -0400 Subject: Handle CSRs whether they have NEW in the header or not Also consolidate some duplicate code --- ipalib/pkcs10.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ipalib') diff --git a/ipalib/pkcs10.py b/ipalib/pkcs10.py index f3f82c40d..9119d12e2 100644 --- a/ipalib/pkcs10.py +++ b/ipalib/pkcs10.py @@ -372,12 +372,14 @@ def strip_header(csr): """ Remove the header and footer from a CSR. """ + headerlen = 40 s = csr.find("-----BEGIN NEW CERTIFICATE REQUEST-----") if s == -1: + headerlen = 36 s = csr.find("-----BEGIN CERTIFICATE REQUEST-----") if s >= 0: e = csr.find("-----END") - csr = csr[s+40:e] + csr = csr[s+headerlen:e] return csr -- cgit