aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-31 01:24:02 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-31 01:24:02 +0100
commitf7a6acda0e7d04c3fd98e72c6089ba4cfad74ddf (patch)
tree13d089204bd0d5b22208185ba75429a7a01292b8 /client.go
parentf1387fc588b5943c276770d56ec7e1cef3cecaa1 (diff)
Encapsulate desire
Diffstat (limited to 'client.go')
-rw-r--r--client.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/client.go b/client.go
index c14d188..eae9f30 100644
--- a/client.go
+++ b/client.go
@@ -2,6 +2,7 @@ package acme
import (
"crypto/rsa"
+ "crypto/x509"
"encoding/json"
"errors"
"io/ioutil"
@@ -297,7 +298,7 @@ func (c *Client) queryStatus(url string, n int, done chan bool) error {
return nil
}
-func (c *Client) Cert(s Signer, altnames []string, key *rsa.PrivateKey) ([]byte, error) {
+func (c *Client) Cert(s Signer, altnames []string, key *rsa.PrivateKey) (*x509.Certificate, error) {
csr, err := NewCSR(altnames, key)
if err != nil {
return nil, err
@@ -311,5 +312,11 @@ func (c *Client) Cert(s Signer, altnames []string, key *rsa.PrivateKey) ([]byte,
return nil, err
}
defer resp.Body.Close()
- return ioutil.ReadAll(resp.Body)
+ ns := parseHeader(resp)
+ log.Println(ansi.Color("NEXT", "green"), ns)
+ der, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return nil, err
+ }
+ return x509.ParseCertificate(der)
}