aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-23 01:40:50 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-23 01:40:50 +0100
commita6164ce0b210aaafff25dafbaee191bdf95628e2 (patch)
tree86a163fce423ebbe620820027ecf5c07c595e81b
parent88c842be07c221f962edcedfdf5cd0c53b2700e7 (diff)
Use PublicKey
-rw-r--r--client.go5
-rw-r--r--crypto.go2
-rw-r--r--messages.go2
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"`