aboutsummaryrefslogtreecommitdiff
path: root/challenge.go
diff options
context:
space:
mode:
Diffstat (limited to 'challenge.go')
-rw-r--r--challenge.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/challenge.go b/challenge.go
index e7b28c2..abc35ef 100644
--- a/challenge.go
+++ b/challenge.go
@@ -1,6 +1,10 @@
package acme
-import "time"
+import (
+ "crypto/sha256"
+ "encoding/hex"
+ "time"
+)
// Challege ...
type Challenge struct {
@@ -14,6 +18,15 @@ type Challenge struct {
Err *Problem `json:"error,omitempty"`
}
+const AcmeInvalid = `.acme.invalid`
+
+// SNIName returns a new SNI name based on KeyAuthorization
+func (c Challenge) SNIName() string {
+ hash := sha256.Sum256([]byte(c.KeyAuthorization))
+ z := hex.EncodeToString(hash[:])
+ return z[:32] + "." + z[32:] + AcmeInvalid
+}
+
// Status of request
type Status string