Added der support and a sample der cert in the certs folder.

This commit is contained in:
Christopher Denny
2016-06-07 14:18:23 -07:00
parent 5cab7d141c
commit 46170e7bf2
2 changed files with 8 additions and 0 deletions
BIN
View File
Binary file not shown.
+8
View File
@@ -45,6 +45,8 @@ var fileExtToFormat = map[string]string{
".p12": "PKCS12",
".pfx": "PKCS12",
".jceks": "JCEKS",
".jks": "JCEKS",
".der": "DER",
}
type certWithAlias struct {
@@ -105,6 +107,12 @@ func getCerts(file, format string) ([]certWithAlias, error) {
certs = append(certs, certWithAlias{cert: cert})
block, data = pem.Decode(data)
}
case "DER":
cert, err := x509.ParseCertificate(data)
if err != nil {
return nil, err
}
certs = append(certs, certWithAlias{cert: cert})
case "PKCS12":
scanner := bufio.NewReader(os.Stdin)
fmt.Print("Enter password: ")