add crl url support
With this option added, it is now possible to add crl urls to the certificates.
This commit is contained in:
parent
89009a3623
commit
560929efaa
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
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")
|
||||
|
|
Loading…
Reference in New Issue