Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #1128 from huiyifyj/fix-typo
Browse files Browse the repository at this point in the history
Fix typo and go fmt this file
  • Loading branch information
nickysemenza committed Sep 16, 2020
2 parents 2916a1f + 1fb9b90 commit efd6a76
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions csr/csr.go
Expand Up @@ -132,12 +132,12 @@ type CAConfig struct {
// A CertificateRequest encapsulates the API interface to the
// certificate request functionality.
type CertificateRequest struct {
CN string `json:"CN" yaml:"CN"`
Names []Name `json:"names" yaml:"names"`
Hosts []string `json:"hosts" yaml:"hosts"`
KeyRequest *KeyRequest `json:"key,omitempty" yaml:"key,omitempty"`
CA *CAConfig `json:"ca,omitempty" yaml:"ca,omitempty"`
SerialNumber string `json:"serialnumber,omitempty" yaml:"serialnumber,omitempty"`
CN string `json:"CN" yaml:"CN"`
Names []Name `json:"names" yaml:"names"`
Hosts []string `json:"hosts" yaml:"hosts"`
KeyRequest *KeyRequest `json:"key,omitempty" yaml:"key,omitempty"`
CA *CAConfig `json:"ca,omitempty" yaml:"ca,omitempty"`
SerialNumber string `json:"serialnumber,omitempty" yaml:"serialnumber,omitempty"`
Extensions []pkix.Extension `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

Expand Down Expand Up @@ -270,9 +270,9 @@ func getHosts(cert *x509.Certificate) []string {
}

// getNames returns an array of Names from the certificate
// It onnly cares about Country, Organization, OrganizationalUnit, Locality, Province
// It only cares about Country, Organization, OrganizationalUnit, Locality, Province
func getNames(sub pkix.Name) []Name {
// anonymous func for finding the max of a list of interger
// anonymous func for finding the max of a list of integer
max := func(v1 int, vn ...int) (max int) {
max = v1
for i := 0; i < len(vn); i++ {
Expand Down Expand Up @@ -430,12 +430,12 @@ func appendCAInfoToCSR(reqConf *CAConfig, csr *x509.CertificateRequest) error {
}

csr.ExtraExtensions = append(csr.ExtraExtensions, pkix.Extension{
Id: asn1.ObjectIdentifier{2, 5, 29, 19},
Value: val,
Critical: true,
})
Id: asn1.ObjectIdentifier{2, 5, 29, 19},
Value: val,
Critical: true,
})

return nil
return nil
}

// appendCAInfoToCSR appends user-defined extension to a CSR
Expand Down

0 comments on commit efd6a76

Please sign in to comment.