Skip to content

Commit

Permalink
Merge pull request #11 from plesk/feature-added-endpoint-for-ecdsa
Browse files Browse the repository at this point in the history
FEATURE Added ability to get Ecdsa Root CA content
  • Loading branch information
AlinaADmi authored Aug 1, 2024
2 parents f0d6926 + a73632c commit 1175b6b
Showing 1 changed file with 20 additions and 0 deletions.
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

0 comments on commit 1175b6b

Please sign in to comment.