aboutsummaryrefslogtreecommitdiff
path: root/certificate.go
diff options
context:
space:
mode:
authorGibheer <gibheer@gmail.com>2015-04-01 21:17:04 +0200
committerGibheer <gibheer@gmail.com>2015-04-01 21:17:04 +0200
commit560929efaa0f756ac7a7355c087b8f0a16a12a0d (patch)
tree0b2f0fe8d14068a865002909dfe93c7d9fc61de7 /certificate.go
parent89009a362321232316001eca956d3b8cd0c2ed1c (diff)
add crl url support
With this option added, it is now possible to add crl urls to the certificates.
Diffstat (limited to 'certificate.go')
-rw-r--r--certificate.go36
1 files changed, 34 insertions, 2 deletions
diff --git a/certificate.go b/certificate.go
index 58f42b1..acb4b5a 100644
--- a/certificate.go
+++ b/certificate.go
@@ -85,6 +85,7 @@ type (
caPath string // path to the ca file if isCA is false
keyUsage string // comma separated list of key usages
extKeyUsage string // comma separated list of extended key usages
+ crlUrl string // comma separated list of crl urls
}
)
@@ -121,6 +122,11 @@ func InitFlagCert(cmd *Command) {
"ext-key-usage", "",
"comma separated list of extended key usage flags",
)
+ cmd.Flags().StringVar(
+ &flagContainer.certGeneration.crlUrl,
+ "crl-url", "",
+ "comma separated list where crl lists can be found",
+ )
}
// create a certificate
@@ -168,7 +174,21 @@ func checkCertFlags() error {
return err
}
}
- // parse the key usage string
+
+ if err := convertCertKeyUsage(); err != nil {
+ return err
+ }
+ if err := convertCertExtKeyUsage(); err != nil {
+ return err
+ }
+ if err := convertCertCrlUrl(); err != nil {
+ return err
+ }
+ return nil
+}
+
+// parse the key usage string
+func convertCertKeyUsage() error {
if keyUstr := flagContainer.certGeneration.keyUsage; keyUstr != "" {
keyUarr := strings.Split(keyUstr, ",")
var keyUresult x509.KeyUsage
@@ -181,7 +201,11 @@ func checkCertFlags() error {
}
FlagCertificateGeneration.KeyUsage = keyUresult
}
- // parse the extended key usage flags
+ return nil
+}
+
+// parse the extended key usage flags
+func convertCertExtKeyUsage() error {
if eKeyUstr := flagContainer.certGeneration.extKeyUsage; eKeyUstr != "" {
eKeyUarr := strings.Split(eKeyUstr, ",")
eKeyUResult := make([]x509.ExtKeyUsage, 0)
@@ -197,6 +221,14 @@ func checkCertFlags() error {
return nil
}
+// parse the crl urls
+func convertCertCrlUrl() error {
+ if str := flagContainer.certGeneration.crlUrl; str != "" {
+ FlagCertificateGeneration.CRLUrls = strings.Split(str, ",")
+ }
+ return nil
+}
+
// add flag to load certificate sign request
func InitFlagCSR(cmd *Command) {
cmd.Flags().StringVar(&flagContainer.signRequestPath, "csr-path", "", "path to the certificate sign request")