rename FlagCertificateData
This makes it easier to distinguish between the csr data and cert data.
This commit is contained in:
parent
97baed49b8
commit
885340ef8f
8
flags.go
8
flags.go
|
@ -141,7 +141,7 @@ certificate requests and certificates and sign/verify messages.`,
|
||||||
// private key specific stuff
|
// private key specific stuff
|
||||||
FlagPrivateKeyGeneration privateKeyGenerationFlags
|
FlagPrivateKeyGeneration privateKeyGenerationFlags
|
||||||
// a certificate filled with the parameters
|
// a certificate filled with the parameters
|
||||||
FlagCertificateData *pki.CertificateData
|
FlagCertificateRequestData *pki.CertificateData
|
||||||
// the certificate sign request
|
// the certificate sign request
|
||||||
FlagCertificateSignRequest *pki.CertificateRequest
|
FlagCertificateSignRequest *pki.CertificateRequest
|
||||||
)
|
)
|
||||||
|
@ -392,10 +392,10 @@ func InitFlagCertificateFields(cmd *Command) {
|
||||||
|
|
||||||
// parse the certificate fields into a raw certificate
|
// parse the certificate fields into a raw certificate
|
||||||
func checkCertificateFields() error {
|
func checkCertificateFields() error {
|
||||||
FlagCertificateData = pki.NewCertificateData()
|
FlagCertificateRequestData = pki.NewCertificateData()
|
||||||
// convert the automatic flags
|
// convert the automatic flags
|
||||||
container_type := reflect.ValueOf(&flagContainer.certificateFlags.automatic).Elem()
|
container_type := reflect.ValueOf(&flagContainer.certificateFlags.automatic).Elem()
|
||||||
cert_data_type := reflect.ValueOf(&FlagCertificateData.Subject).Elem()
|
cert_data_type := reflect.ValueOf(&FlagCertificateRequestData.Subject).Elem()
|
||||||
|
|
||||||
for _, field := range []string{"Country", "Organization", "OrganizationalUnit",
|
for _, field := range []string{"Country", "Organization", "OrganizationalUnit",
|
||||||
"Locality", "Province", "StreetAddress", "PostalCode"} {
|
"Locality", "Province", "StreetAddress", "PostalCode"} {
|
||||||
|
@ -406,7 +406,7 @@ func checkCertificateFields() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert the manual flags
|
// convert the manual flags
|
||||||
data := FlagCertificateData
|
data := FlagCertificateRequestData
|
||||||
raw_data := flagContainer.certificateFlags.manual
|
raw_data := flagContainer.certificateFlags.manual
|
||||||
data.Subject.SerialNumber = raw_data.serialNumber
|
data.Subject.SerialNumber = raw_data.serialNumber
|
||||||
data.Subject.CommonName = raw_data.commonName
|
data.Subject.CommonName = raw_data.commonName
|
||||||
|
|
2
main.go
2
main.go
|
@ -110,7 +110,7 @@ func create_sign_request(cmd *Command, args []string) {
|
||||||
crash_with_help(cmd, ErrorFlagInput, "Flags invalid: %s", err)
|
crash_with_help(cmd, ErrorFlagInput, "Flags invalid: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
csr, err := FlagCertificateData.ToCertificateRequest(FlagPrivateKey)
|
csr, err := FlagCertificateRequestData.ToCertificateRequest(FlagPrivateKey)
|
||||||
if err != nil { crash_with_help(cmd, ErrorProgram, "Could not create certificate sign request: %s", err) }
|
if err != nil { crash_with_help(cmd, ErrorProgram, "Could not create certificate sign request: %s", err) }
|
||||||
pem_block, err := csr.MarshalPem()
|
pem_block, err := csr.MarshalPem()
|
||||||
if err != nil { crash_with_help(cmd, ErrorProgram, "Error when marshalling to pem: %s", err) }
|
if err != nil { crash_with_help(cmd, ErrorProgram, "Error when marshalling to pem: %s", err) }
|
||||||
|
|
Loading…
Reference in New Issue