mirror of
https://github.com/avwo/whistle.git
synced 2026-10-26 12:02:30 +08:00
fix: set certificate validity period to 24 months
This commit is contained in:
+4
-3
@@ -119,7 +119,7 @@ function createCertificate(hostname) {
|
||||
|
||||
var serialNumber = crypto.createHash('sha1')
|
||||
.update(hostname + RANDOM_SERIAL, 'binary').digest('hex');
|
||||
cert = createCert(pki.setRsaPublicKey(ROOT_KEY.n, ROOT_KEY.e), serialNumber, 2);
|
||||
cert = createCert(pki.setRsaPublicKey(ROOT_KEY.n, ROOT_KEY.e), serialNumber, true);
|
||||
|
||||
cert.setSubject([{
|
||||
name: 'commonName',
|
||||
@@ -319,7 +319,7 @@ function createCACert() {
|
||||
};
|
||||
}
|
||||
|
||||
function createCert(publicKey, serialNumber, expiryPeriod) {
|
||||
function createCert(publicKey, serialNumber, isShortPeriod) {
|
||||
var cert = pki.createCertificate();
|
||||
cert.publicKey = publicKey;
|
||||
cert.serialNumber = serialNumber || '01';
|
||||
@@ -327,7 +327,8 @@ function createCert(publicKey, serialNumber, expiryPeriod) {
|
||||
cert.validity.notBefore = new Date();
|
||||
cert.validity.notAfter = new Date();
|
||||
cert.validity.notBefore.setFullYear(curYear - 1);
|
||||
cert.validity.notAfter.setFullYear(curYear + (expiryPeriod || 10));
|
||||
// https://chromium.googlesource.com/chromium/src/+/refs/heads/master/net/cert/cert_verify_proc.cc#900
|
||||
cert.validity.notAfter.setFullYear(curYear + (isShortPeriod ? 1 : 10));
|
||||
return cert;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user