summaryrefslogtreecommitdiff
path: root/includes/account.php
diff options
context:
space:
mode:
authorFelix Dörre <felix@dogcraft.de>2014-09-24 00:20:37 +0200
committerFelix Dörre <felix@dogcraft.de>2014-10-07 22:08:44 +0200
commitc980e162027731dfb6d869ea34d79f973ef70ec9 (patch)
tree47c428354af3ab36e4f46b1ae9a8816a9275a334 /includes/account.php
parentb7c215b0e5cf6866eef99545da0f2d5baae8cb75 (diff)
downloadcacert-devel-c980e162027731dfb6d869ea34d79f973ef70ec9.tar.gz
cacert-devel-c980e162027731dfb6d869ea34d79f973ef70ec9.tar.xz
cacert-devel-c980e162027731dfb6d869ea34d79f973ef70ec9.zip
bug-790: change PEM-Armor-striping code to not break correct CSRs
(copied from somewhere above)
Diffstat (limited to 'includes/account.php')
-rw-r--r--includes/account.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/includes/account.php b/includes/account.php
index a713f09..97d38ac 100644
--- a/includes/account.php
+++ b/includes/account.php
@@ -1570,7 +1570,12 @@ function buildSubjectFromSession() {
}
mysql_query("update `orgemailcerts` set `csr_name`='$CSRname' where `id`='$emailid'");
} else if($_REQUEST['keytype'] == "MS" || $_REQUEST['keytype']=="VI") {
- $csr = "-----BEGIN CERTIFICATE REQUEST-----\n".clean_csr($_REQUEST['CSR'])."\n-----END CERTIFICATE REQUEST-----\n";
+ $csr = clean_csr($_REQUEST['CSR']);
+ if(strpos($csr,"---BEGIN") === FALSE)
+ {
+ // In case the CSR is missing the ---BEGIN lines, add them automatically:
+ $csr = "-----BEGIN CERTIFICATE REQUEST-----\n".$csr."\n-----END CERTIFICATE REQUEST-----\n";
+ }
if (($weakKey = checkWeakKeyCSR($csr)) !== "")
{