diff options
author | Kali Kaneko <kali@leap.se (leap communications)> | 2019-06-13 12:03:27 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se (leap communications)> | 2019-06-13 12:03:27 +0200 |
commit | 3ef5a67efc3115983142ae53eb4c75dec54e9a4f (patch) | |
tree | e447607aba625da4c9df1166e1a694e3a293a36b /main.go |
initial commit
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -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) +} |