Skip to content

Commit

Permalink
Check private/public key pair match for parent cert
Browse files Browse the repository at this point in the history
  • Loading branch information
phanhoc committed Apr 12, 2021
1 parent 6256203 commit 8b84ad0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Binary file modified bin/dcm
Binary file not shown.
7 changes: 6 additions & 1 deletion commands/certificate/renew/renew.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ func (c *ReNewCommand) Run() error {
return err
}

// verify private/public key pair of parent cert
if err := utilities.VerifyKey(parentPrivKey, parentCert.PublicKey); err != nil {
return err
}

// parse old certificate information
privateKey, err := utilities.ParsePrivateKey(c.PrivKeyOldCertPath)
if err != nil {
Expand All @@ -103,7 +108,7 @@ func (c *ReNewCommand) Run() error {
// renew certificate
oldCert.NotAfter = time.Now().AddDate(0, 0, c.Day)

// verify private/public key pair
// verify private/public key pair of children cert
if err := utilities.VerifyKey(privateKey, oldCert.PublicKey); err != nil {
return err
}
Expand Down

0 comments on commit 8b84ad0

Please sign in to comment.