From 3ef5a67efc3115983142ae53eb4c75dec54e9a4f Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 13 Jun 2019 12:03:27 +0200 Subject: initial commit --- main.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 main.go (limited to 'main.go') 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) +} -- cgit v1.2.3