mirror of
https://github.com/docker/docs.git
synced 2026-10-31 10:34:26 +03:00
Fix computation of certificate expiration
Instead of 3650 days, actually use 10 years (i.e. take into account leap days). Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
@@ -145,7 +145,7 @@ func (r *NotaryRepository) Initialize(rootKeyID string) error {
|
||||
|
||||
// Hard-coded policy: the generated certificate expires in 10 years.
|
||||
startTime := time.Now()
|
||||
rootCert, err := cryptoservice.GenerateCertificate(privKey, r.gun, startTime, startTime.Add(time.Hour*24*365*10))
|
||||
rootCert, err := cryptoservice.GenerateCertificate(privKey, r.gun, startTime, startTime.AddDate(10, 0, 0))
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -220,7 +220,7 @@ func addECDSAKey(
|
||||
|
||||
// Hard-coded policy: the generated certificate expires in 10 years.
|
||||
startTime := time.Now()
|
||||
template, err := trustmanager.NewCertificate(role, startTime, startTime.Add(time.Hour*24*365*10))
|
||||
template, err := trustmanager.NewCertificate(role, startTime, startTime.AddDate(10, 0, 0))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create the certificate template: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user