Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE Added ability to get Ecdsa Root CA content #11

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions wfe2/wfe.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const (
newAcctPath = "/acme/new-acct"
acctPath = "/acme/acct/"
caRootPath = "/ca-root"
caEcdsaRootPath = "/ca-ecdsa-root"
// When we moved to authzv2, we used a "-v3" suffix to avoid confusion
// regarding ACMEv2.
authzPath = "/acme/authz-v3/"
Expand Down Expand Up @@ -435,6 +436,7 @@ func (wfe *WebFrontEndImpl) Handler(stats prometheus.Registerer, oTelHTTPOptions
wfe.HandleFunc(m, directoryPath, wfe.Directory, "GET", "POST")
wfe.HandleFunc(m, newNoncePath, wfe.Nonce, "GET", "POST")
wfe.HandleFunc(m, caRootPath, wfe.CARoot, "GET")
wfe.HandleFunc(m, caEcdsaRootPath, wfe.CAEcdsaRoot, "GET")
// POST-as-GETable ACME endpoints
// TODO(@cpu): After November 1st, 2020 support for "GET" to the following
// endpoints will be removed, leaving only POST-as-GET support.
Expand Down Expand Up @@ -527,6 +529,24 @@ func (wfe *WebFrontEndImpl) CARoot(
response.Write(caRoot)
}

// CAEcdsaRoot returns ecdsa Root CA content
func (wfe *WebFrontEndImpl) CAEcdsaRoot(
ctx context.Context,
logEvent *web.RequestEvent,
response http.ResponseWriter,
request *http.Request) {
filePath := "test/certs/webpki/root-ecdsa.cert.pem"
caEcdsaRoot, err := ioutil.ReadFile(filePath)

if err != nil {
prob := probs.ServerInternal(fmt.Sprintf("could not get ecdsa root ca: %v", err))
wfe.sendError(response, logEvent, prob, nil)
return
}

response.Write(caEcdsaRoot)
}

// Directory is an HTTP request handler that provides the directory
// object stored in the WFE's DirectoryEndpoints member with paths prefixed
// using the `request.Host` of the HTTP request.
Expand Down
Loading