Put PKCS#12 behind a flag, and check in the vendored dependency

This commit is contained in:
Filippo Valsorda
2018-08-12 23:21:46 -04:00
parent 6be76ae477
commit 060fcce2db
14 changed files with 1491 additions and 17 deletions

View File

@@ -34,6 +34,9 @@ const usage = `Usage of mkcert:
$ mkcert '*.example.com'
Generate "_wildcard.example.com.pem" and "_wildcard.example.com-key.pem".
$ mkcert -pkcs12 example.com
Generate "example.com.p12" instead of a PEM file.
$ mkcert -uninstall
Uninstall the local CA (but do not delete it).
@@ -45,6 +48,7 @@ func main() {
log.SetFlags(0)
var installFlag = flag.Bool("install", false, "install the local root CA in the system trust store")
var uninstallFlag = flag.Bool("uninstall", false, "uninstall the local root CA from the system trust store")
var pkcs12Flag = flag.Bool("pkcs12", false, "generate PKCS#12 instead of PEM")
var carootFlag = flag.Bool("CAROOT", false, "print the CAROOT path")
flag.Usage = func() { fmt.Fprintf(flag.CommandLine.Output(), usage) }
flag.Parse()
@@ -59,7 +63,7 @@ func main() {
log.Fatalln("ERROR: you can't set -install and -uninstall at the same time")
}
(&mkcert{
installMode: *installFlag, uninstallMode: *uninstallFlag,
installMode: *installFlag, uninstallMode: *uninstallFlag, pkcs12: *pkcs12Flag,
}).Run(flag.Args())
}
@@ -68,6 +72,7 @@ const keyName = "rootCA-key.pem"
type mkcert struct {
installMode, uninstallMode bool
pkcs12 bool
CAROOT string
caCert *x509.Certificate