mirror of
https://github.com/google/go-attestation.git
synced 2024-12-18 20:47:57 +00:00
Add critical bool arg to MarshalSubjectAltName to allow SANs to be critical (#367)
This commit is contained in:
parent
e6ab626979
commit
5b3763098f
@ -149,8 +149,9 @@ func forEachSAN(extension []byte, callback func(ext asn1.RawValue) error) error
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalSubjectAltName converts a SubjectAltName struct into a pkix.Extension.
|
||||
func MarshalSubjectAltName(san *SubjectAltName) (pkix.Extension, error) {
|
||||
// MarshalSubjectAltName converts a SubjectAltName struct into a pkix.Extension,
|
||||
// allowing callers to specify if the extension is critical.
|
||||
func MarshalSubjectAltName(san *SubjectAltName, critical bool) (pkix.Extension, error) {
|
||||
var generalNames []asn1.RawValue
|
||||
for _, permID := range san.PermanentIdentifiers {
|
||||
val, err := marshalOtherName(oidPermanentIdentifier, permID)
|
||||
@ -171,7 +172,8 @@ func MarshalSubjectAltName(san *SubjectAltName) (pkix.Extension, error) {
|
||||
return pkix.Extension{}, err
|
||||
}
|
||||
return pkix.Extension{
|
||||
Id: oid.SubjectAltName,
|
||||
Value: val,
|
||||
Id: oid.SubjectAltName,
|
||||
Critical: critical,
|
||||
Value: val,
|
||||
}, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user