mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-27 00:58:25 +00:00
Ignore white spaces in CSRs and X.509 certs
This commit is contained in:
parent
13eed6147a
commit
076050cc19
@ -1203,7 +1203,7 @@ class File_X509 {
|
|||||||
subject=/O=organization/OU=org unit/CN=common name
|
subject=/O=organization/OU=org unit/CN=common name
|
||||||
issuer=/O=organization/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;
|
$cert = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $cert) ? base64_decode($cert) : false;
|
||||||
|
|
||||||
if ($cert === false) {
|
if ($cert === false) {
|
||||||
@ -2113,7 +2113,7 @@ class File_X509 {
|
|||||||
|
|
||||||
$asn1 = new File_ASN1();
|
$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;
|
$orig = $csr = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $csr) ? base64_decode($csr) : false;
|
||||||
|
|
||||||
if ($csr === false) {
|
if ($csr === false) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user