1
0
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:
Miloslav Trmač
2015-12-02 17:13:57 +01:00
parent 3c6335c572
commit bd6d937f43
2 changed files with 2 additions and 2 deletions

View File

@@ -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

View File

@@ -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)
}