util/encodings.go
func CheckRDNSequenceWhiteSpace(raw []byte) (leading, trailing bool, err error) {
	var seq pkix.RDNSequence
	if _, err = asn1.Unmarshal(raw, &seq); err != nil {
		return
	}
	for _, rdn := range seq {
		for _, atv := range rdn {
			if !IsNameAttribute(atv.Type) {
				continue
			}
			value, ok := atv.Value.(string)
			if !ok {
				continue
			}
			if leftStrip := strings.TrimLeftFunc(value, unicode.IsSpace); leftStrip != value {
				leading = true
			}
			if rightStrip := strings.TrimRightFunc(value, unicode.IsSpace); rightStrip != value {
				trailing = true
			}
		}
	}
	return
}
func CheckRDNSequenceWhiteSpace(raw []byte) (leading, trailing bool, err error) {
	var seq pkix.RDNSequence
	if _, err = asn1.Unmarshal(raw, &seq); err != nil {
		return
	}
	for _, rdn := range seq {
		for _, atv := range rdn {
			if !IsNameAttribute(atv.Type) {
				continue
			}
			value, ok := atv.Value.(string)
			if !ok {
				continue
			}
			if leftStrip := strings.TrimLeftFunc(value, unicode.IsSpace); leftStrip != value {
				leading = true
			}
			if rightStrip := strings.TrimRightFunc(value, unicode.IsSpace); rightStrip != value {
				trailing = true
			}
		}
	}
	return
}
func CheckRDNSequenceWhiteSpace ( raw [ ] byte ) ( leading , trailing bool , err error ) { var seq pkix . RDNSequence if _ , err = asn1 . Unmarshal ( raw , & seq ) ; err != nil { return } for _ , rdn := range seq { for _ , atv := range rdn { if ! IsNameAttribute ( atv . Type ) { continue } value , ok := atv . Value . ( string ) if ! ok { continue } if leftStrip := strings . TrimLeftFunc ( value , unicode . IsSpace ) ; leftStrip != value { leading = true } if rightStrip := strings . TrimRightFunc ( value , unicode . IsSpace ) ; rightStrip != value { trailing = true } } } return }
// CheckRDNSequenceWhiteSpace returns true if there is leading or trailing
// whitespace in any name attribute in the sequence, respectively.
CheckRDNSequenceWhiteSpace returns true if there is leading or trailing whitespace in any name attribute in the sequence respectively .