mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-02-04 12:58:28 +00:00
X509: move where Crypt/Random loading is done
This commit is contained in:
parent
374f8db2e3
commit
693804e62a
@ -317,10 +317,6 @@ class File_X509
|
|||||||
include_once 'Math/BigInteger.php';
|
include_once 'Math/BigInteger.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('crypt_random_string')) {
|
|
||||||
include_once 'Crypt/Random.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Explicitly Tagged Module, 1988 Syntax
|
// Explicitly Tagged Module, 1988 Syntax
|
||||||
// http://tools.ietf.org/html/rfc5280#appendix-A.1
|
// http://tools.ietf.org/html/rfc5280#appendix-A.1
|
||||||
|
|
||||||
@ -3281,12 +3277,17 @@ class File_X509
|
|||||||
|
|
||||||
$startDate = !empty($this->startDate) ? $this->startDate : @date('D, d M Y H:i:s O');
|
$startDate = !empty($this->startDate) ? $this->startDate : @date('D, d M Y H:i:s O');
|
||||||
$endDate = !empty($this->endDate) ? $this->endDate : @date('D, d M Y H:i:s O', strtotime('+1 year'));
|
$endDate = !empty($this->endDate) ? $this->endDate : @date('D, d M Y H:i:s O', strtotime('+1 year'));
|
||||||
// "The serial number MUST be a positive integer"
|
if (!empty($this->serialNumber)) {
|
||||||
// "Conforming CAs MUST NOT use serialNumber values longer than 20 octets."
|
$serialNumber = $this->serialNumber;
|
||||||
// -- https://tools.ietf.org/html/rfc5280#section-4.1.2.2
|
} else {
|
||||||
$serialNumber = !empty($this->serialNumber) ?
|
if (!function_exists('crypt_random_string')) {
|
||||||
$this->serialNumber :
|
include_once 'Crypt/Random.php';
|
||||||
new Math_BigInteger(crypt_random_string(20) & ("\x7F" . str_repeat("\xFF", 19)), 256);
|
}
|
||||||
|
// "The serial number MUST be a positive integer"
|
||||||
|
// "Conforming CAs MUST NOT use serialNumber values longer than 20 octets."
|
||||||
|
// -- https://tools.ietf.org/html/rfc5280#section-4.1.2.2
|
||||||
|
$serialNumber = new Math_BigInteger(crypt_random_string(20) & ("\x7F" . str_repeat("\xFF", 19)), 256);
|
||||||
|
}
|
||||||
|
|
||||||
$this->currentCert = array(
|
$this->currentCert = array(
|
||||||
'tbsCertificate' =>
|
'tbsCertificate' =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user