aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'client.go')
-rw-r--r--client.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/client.go b/client.go
index 867c500..7a1de7c 100644
--- a/client.go
+++ b/client.go
@@ -4,6 +4,7 @@ import (
"crypto/rsa"
"encoding/json"
"errors"
+ "io/ioutil"
"log"
"net/http"
"net/url"
@@ -303,21 +304,21 @@ func (c *Client) Status(url string, n int, done chan bool) error {
return nil
}
-func (c *Client) CSR(s Signer, altnames []string, key *rsa.PrivateKey) error {
+func (c *Client) Cert(s Signer, altnames []string, key *rsa.PrivateKey) ([]byte, error) {
csr, err := NewCSR(altnames, key)
if err != nil {
- return err
+ return nil, err
}
r := &CSR{
Resource: ResNewCert,
CSR: csr,
}
- _, err = c.post(c.NewCert, s, r)
+ resp, err := c.post(c.NewCert, s, r)
if err != nil {
- return err
+ return nil, err
}
-
- return nil
+ defer resp.Body.Close()
+ return ioutil.ReadAll(resp.Body)
}
////////////////////////////////////////////////////////////////////////