From a6164ce0b210aaafff25dafbaee191bdf95628e2 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Wed, 23 Dec 2015 01:40:50 +0100 Subject: Use PublicKey --- client.go | 5 ++--- crypto.go | 2 +- messages.go | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/client.go b/client.go index 170f007..4816c0b 100644 --- a/client.go +++ b/client.go @@ -217,12 +217,11 @@ func (c *Client) Authorize(a *Account, domain []string) error { case http.StatusCreated: for _, ch := range r.Challenges { if canSolve[ch.Type] { - t, _ := Thumb(ch.Token, a.PrivKey) + ka, _ := Thumb(ch.Token, a.PrivKey.Public()) ans := &Challenge{ Resource: ResChallenge, Type: ch.Type, - Token: ch.Token, - KeyAuthorization: t, + KeyAuthorization: ka, } _, err = c.post(ch.URI, a, ans) } diff --git a/crypto.go b/crypto.go index 9fda3e7..619cccc 100644 --- a/crypto.go +++ b/crypto.go @@ -47,7 +47,7 @@ func NewCSR(altnames []string, key *rsa.PrivateKey) ([]byte, error) { return x509.CreateCertificateRequest(rand.Reader, &tmpl, key) } -func Thumb(token string, key *rsa.PrivateKey) (string, error) { +func Thumb(token string, key crypto.PublicKey) (string, error) { k := &jose.JsonWebKey{Key: key, Algorithm: "RSA"} t, err := k.Thumbprint(crypto.SHA256) if err != nil { diff --git a/messages.go b/messages.go index 3933592..1be7c42 100644 --- a/messages.go +++ b/messages.go @@ -57,7 +57,7 @@ type Identifier struct { type Challenge struct { Resource Resource `json:"resource"` // challenge Type ChallengeType `json:"type"` - Token string `json:"token"` + Token string `json:"token,omitempty"` Status Status `json:"status,omitempty"` // e.g. valid URI string `json:"uri,omitempty"` Validated *time.Time `json:"validated,omitempty"` -- cgit v1.2.3