-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for cross-signing new certs during ca rotation
We need to send the full chain in order for cross-signing to work properly during switchover to a new root. Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
- Loading branch information
Showing
4 changed files
with
41 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package util | ||
|
||
import ( | ||
"crypto/x509" | ||
|
||
certutil "github.com/rancher/dynamiclistener/cert" | ||
) | ||
|
||
// EncodeCertsPEM is a wrapper around the EncodeCertPEM function to return the | ||
// PEM encoding of a cert and chain, instead of just a single cert. | ||
func EncodeCertsPEM(cert *x509.Certificate, caCerts []*x509.Certificate) []byte { | ||
pemBytes := certutil.EncodeCertPEM(cert) | ||
for _, caCert := range caCerts { | ||
pemBytes = append(pemBytes, certutil.EncodeCertPEM(caCert)...) | ||
} | ||
return pemBytes | ||
} |