From ca7e7f10cb9fd9c1a6ff7f60436c086d73714180 Mon Sep 17 00:00:00 2001 From: Alex Vaghin Date: Tue, 25 Oct 2016 14:52:55 +0200 Subject: [PATCH] acme: add v3 implementation to RevokeAuthorization Let's Encrypt apparently implements authorization revocation as specified in the v3 of the spec: https://tools.ietf.org/html/draft-ietf-acme-acme-03#section-6.4.2. See the relevant boulder source code here: https://github.com/letsencrypt/boulder/blob/be01ca17d334f73823a9c69afbcf99d777482547/wfe/wfe.go#L1177-L1213 This change makes RevokeAuthorization compatible with both v2 and v3 versions of the spec, as well as Let's Encrypt staging/production actual implementation. Change-Id: I7e860944005a55b156a45d96e1b8eb41126ce6bb Reviewed-on: https://go-review.googlesource.com/31990 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- acme/acme.go | 2 ++ acme/acme_test.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/acme/acme.go b/acme/acme.go index be18ad7..8aafada 100644 --- a/acme/acme.go +++ b/acme/acme.go @@ -406,9 +406,11 @@ func (c *Client) GetAuthorization(ctx context.Context, url string) (*Authorizati func (c *Client) RevokeAuthorization(ctx context.Context, url string) error { req := struct { Resource string `json:"resource"` + Status string `json:"status"` Delete bool `json:"delete"` }{ Resource: "authz", + Status: "deactivated", Delete: true, } res, err := postJWS(ctx, c.HTTPClient, c.Key, url, req) diff --git a/acme/acme_test.go b/acme/acme_test.go index e552984..4e618f2 100644 --- a/acme/acme_test.go +++ b/acme/acme_test.go @@ -562,12 +562,16 @@ func TestRevokeAuthorization(t *testing.T) { case "/1": var req struct { Resource string + Status string Delete bool } decodeJWSRequest(t, &req, r) if req.Resource != "authz" { t.Errorf("req.Resource = %q; want authz", req.Resource) } + if req.Status != "deactivated" { + t.Errorf("req.Status = %q; want deactivated", req.Status) + } if !req.Delete { t.Errorf("req.Delete is false") }