blob: 233a26d292fbd7392e0c642e11c5f2e2ee17705b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)
}
|