1
0
mirror of https://github.com/danog/tgseclib.git synced 2025-01-22 05:51:20 +01:00

Ignore white spaces in CSRs and X.509 certs

This commit is contained in:
terrafrost 2012-09-26 00:34:37 -05:00
parent 13eed6147a
commit 076050cc19

View File

@ -1203,7 +1203,7 @@ class File_X509 {
subject=/O=organization/OU=org unit/CN=common name
issuer=/O=organization/CN=common name
*/
$cert = preg_replace('#^(?:[^-].+[\r\n]+)+|-.+-|[\r\n]#', '', $cert);
$cert = preg_replace('#^(?:[^-].+[\r\n]+)+|-.+-|[\r\n]| #', '', $cert);
$cert = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $cert) ? base64_decode($cert) : false;
if ($cert === false) {
@ -2113,7 +2113,7 @@ class File_X509 {
$asn1 = new File_ASN1();
$csr = preg_replace('#^(?:[^-].+[\r\n]+)+|-.+-|[\r\n]#', '', $csr);
$csr = preg_replace('#^(?:[^-].+[\r\n]+)+|-.+-|[\r\n]| #', '', $csr);
$orig = $csr = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $csr) ? base64_decode($csr) : false;
if ($csr === false) {