Skip to content

Commit

Permalink
Remove unnecessary method
Browse files Browse the repository at this point in the history
  • Loading branch information
maraino committed Aug 10, 2022
1 parent c257830 commit f30f495
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions x509util/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,30 +745,6 @@ func (s *SerialNumber) UnmarshalJSON(data []byte) error {
return nil
}

// MarshalSubjectAlternativeName marshals to a pkix.Extension the given SANs.
// This method does not set the Critical option that must be set if the subject
// is empty.
func MarshalSubjectAlternativeName(sans ...SubjectAlternativeName) (pkix.Extension, error) {
var rawValues []asn1.RawValue
for _, san := range sans {
rawValue, err := san.RawValue()
if err != nil {
return pkix.Extension{}, err
}
rawValues = append(rawValues, rawValue)
}

rawBytes, err := asn1.Marshal(rawValues)
if err != nil {
return pkix.Extension{}, fmt.Errorf("error marshaling SubjectAlternativeName extension to ASN1: %w", err)
}

return pkix.Extension{
Id: oidExtensionSubjectAltName,
Value: rawBytes,
}, nil
}

// createSubjectAltNameExtension will construct an Extension containing all
// SubjectAlternativeNames held in a Certificate. It implements more types than
// the golang x509 library, so it is used whenever OtherName or RegisteredID
Expand Down

0 comments on commit f30f495

Please sign in to comment.