forked from TrueCloudLab/certificates
Make clear what's a template/unsigned certificate.
This commit is contained in:
parent
4d375a06f5
commit
cef0475e71
1 changed files with 7 additions and 7 deletions
|
@ -378,19 +378,19 @@ func (a *Authority) GetTLSCertificate() (*tls.Certificate, error) {
|
||||||
return fatal(err)
|
return fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate certificate directly from the certificate request.
|
// Generate certificate template directly from the certificate request.
|
||||||
certificate, err := x509util.NewCertificate(cr)
|
template, err := x509util.NewCertificate(cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fatal(err)
|
return fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get certificate template, set validity and sign it.
|
// Get x509 certificate template, set validity and sign it.
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
template := certificate.GetCertificate()
|
certTpl := template.GetCertificate()
|
||||||
template.NotBefore = now.Add(-1 * time.Minute)
|
certTpl.NotBefore = now.Add(-1 * time.Minute)
|
||||||
template.NotAfter = now.Add(24 * time.Hour)
|
certTpl.NotAfter = now.Add(24 * time.Hour)
|
||||||
|
|
||||||
cert, err := x509util.CreateCertificate(template, a.x509Issuer, cr.PublicKey, a.x509Signer)
|
cert, err := x509util.CreateCertificate(certTpl, a.x509Issuer, cr.PublicKey, a.x509Signer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fatal(err)
|
return fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue