summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se (leap communications)>2019-06-13 12:03:27 +0200
committerKali Kaneko <kali@leap.se (leap communications)>2019-06-13 12:03:27 +0200
commit3ef5a67efc3115983142ae53eb4c75dec54e9a4f (patch)
treee447607aba625da4c9df1166e1a694e3a293a36b /main.go
initial commit
Diffstat (limited to 'main.go')
-rw-r--r--main.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..233a26d
--- /dev/null
+++ b/main.go
@@ -0,0 +1,30 @@
+package main
+
+import (
+ "flag"
+ "net/http"
+)
+
+const keySize = 2048
+const expiryDays = 28
+
+type certHandler struct {
+ cainfo caInfo
+}
+
+func (ch *certHandler) certResponder(w http.ResponseWriter, r *http.Request) {
+ ch.cainfo.CertWriter(w)
+}
+
+func main() {
+ var caCrt = flag.String("caCrt", "", "path to the CA public key")
+ var caKey = flag.String("caKey", "", "path to the CA private key")
+
+ flag.Parse()
+
+ ci := newCaInfo(*caCrt, *caKey)
+ ch := certHandler{ci}
+
+ http.HandleFunc("/cert", ch.certResponder)
+ http.ListenAndServe(":8000", nil)
+}