summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acme.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/acme.hs b/acme.hs
index 2f8138c..f8e92e3 100644
--- a/acme.hs
+++ b/acme.hs
@@ -17,6 +17,7 @@ import qualified Data.ByteString.Lazy as LB
17import qualified Data.ByteString.Base64.URL as Base64 17import qualified Data.ByteString.Base64.URL as Base64
18import Data.Digest.Pure.SHA (bytestringDigest, sha256) 18import Data.Digest.Pure.SHA (bytestringDigest, sha256)
19import Data.Text.Encoding (decodeUtf8) 19import Data.Text.Encoding (decodeUtf8)
20import qualified Data.Text as T
20import OpenSSL.EVP.PKey 21import OpenSSL.EVP.PKey
21import OpenSSL.PEM (readPublicKey) 22import OpenSSL.PEM (readPublicKey)
22import OpenSSL.RSA 23import OpenSSL.RSA
@@ -31,6 +32,9 @@ main = do
31 case toPublicKey userKey_ of 32 case toPublicKey userKey_ of
32 Nothing -> error "Not a public RSA key." 33 Nothing -> error "Not a public RSA key."
33 Just (userKey :: RSAPubKey) -> do 34 Just (userKey :: RSAPubKey) -> do
35
36 nonce_ <- view (responseHeader "Replay-Nonce" . to (T.unpack . decodeUtf8)) <$> get "https://acme-v01.api.letsencrypt.org/directory"
37
34 let protected = b64 (header userKey nonce_) 38 let protected = b64 (header userKey nonce_)
35 39
36 -- Create user account 40 -- Create user account
@@ -65,9 +69,6 @@ main = do
65 domain :: String 69 domain :: String
66 domain = "aaa.reesd.com" 70 domain = "aaa.reesd.com"
67 71
68 nonce_ :: String
69 nonce_ = "ckYlMQ7BflfUb7HmxipdSpnkFle83-8lUkn50U-X97Q"
70
71 terms :: String 72 terms :: String
72 terms = "https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf" 73 terms = "https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf"
73 74