Improve code reusability
Signed-off-by: renxiangyu_yewu <renxiangyu_yewu@cmss.chinamobile.com>
This commit is contained in:
parent
992802084f
commit
11f8fe3161
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue