Improve code reusability

Signed-off-by: renxiangyu_yewu <renxiangyu_yewu@cmss.chinamobile.com>
This commit is contained in:
renxiangyu_yewu 2024-07-01 15:38:24 +08:00
parent 992802084f
commit 11f8fe3161
1 changed files with 1 additions and 5 deletions

View File

@ -347,10 +347,6 @@ func NewSignedCert(cc *CertConfig, key crypto.Signer, caCert *x509.Certificate,
}
RemoveDuplicateAltNames(&cc.Config.AltNames)
notAfter := time.Now().Add(constants.CertificateValidity).UTC()
if cc.NotAfter != nil {
notAfter = *cc.NotAfter
}
certTmpl := x509.Certificate{
Subject: pkix.Name{
@ -361,7 +357,7 @@ func NewSignedCert(cc *CertConfig, key crypto.Signer, caCert *x509.Certificate,
IPAddresses: cc.Config.AltNames.IPs,
SerialNumber: serial,
NotBefore: caCert.NotBefore,
NotAfter: notAfter,
NotAfter: cc.NotAfter.UTC(),
KeyUsage: keyUsage,
ExtKeyUsage: cc.Config.Usages,
BasicConstraintsValid: true,