mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 03:42:40 +00:00
Merge branch 'x509-serialnumber-1.0' into x509-serialnumber-2.0
Conflicts: phpseclib/File/X509.php
This commit is contained in:
commit
365c687f04
@ -3242,9 +3242,13 @@ class 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"
|
/* "The serial number MUST be a positive integer"
|
||||||
// "Conforming CAs MUST NOT use serialNumber values longer than 20 octets."
|
"Conforming CAs MUST NOT use serialNumber values longer than 20 octets."
|
||||||
// -- https://tools.ietf.org/html/rfc5280#section-4.1.2.2
|
-- https://tools.ietf.org/html/rfc5280#section-4.1.2.2
|
||||||
|
|
||||||
|
for the integer to be positive the leading bit needs to be 0 hence the
|
||||||
|
application of a bitmap
|
||||||
|
*/
|
||||||
$serialNumber = !empty($this->serialNumber) ?
|
$serialNumber = !empty($this->serialNumber) ?
|
||||||
$this->serialNumber :
|
$this->serialNumber :
|
||||||
new BigInteger(Random::string(20) & ("\x7F" . str_repeat("\xFF", 19)), 256);
|
new BigInteger(Random::string(20) & ("\x7F" . str_repeat("\xFF", 19)), 256);
|
||||||
|
Loading…
Reference in New Issue
Block a user