Skip to content

Commit

Permalink
Don't use PEM to initialize CT client (letsencrypt#7297)
Browse files Browse the repository at this point in the history
We can base64 and pass in DER instead of constructing PEM
  • Loading branch information
mcpherrinm authored Feb 1, 2024
1 parent 14a8378 commit 8b532f1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions publisher/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,15 @@ func NewLog(uri, b64PK, userAgent string, logger blog.Logger) (*Log, error) {
}
url.Path = strings.TrimSuffix(url.Path, "/")

pemPK := fmt.Sprintf("-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----",
b64PK)
derPK, err := base64.StdEncoding.DecodeString(b64PK)
if err != nil {
return nil, err
}

opts := jsonclient.Options{
Logger: logAdaptor{logger},
PublicKey: pemPK,
UserAgent: userAgent,
Logger: logAdaptor{logger},
PublicKeyDER: derPK,
UserAgent: userAgent,
}
httpClient := &http.Client{
// We set the HTTP client timeout to about half of what we expect
Expand Down

0 comments on commit 8b532f1

Please sign in to comment.