MCPcopy Create free account
hub / github.com/egonelbre/exp / AsPrintableString

Method AsPrintableString

ber/value.go:279–290  ·  view source on GitHub ↗

AsPrintableString parses a ASN.1 PrintableString from the given byte array and returns it.

()

Source from the content-addressed store, hash-verified

277// AsPrintableString parses a ASN.1 PrintableString from the given byte
278// array and returns it.
279func (v *Token) AsPrintableString() (ret string, err error) {
280 v.mustBeValue()
281 bytes := v.Bytes
282 for _, b := range bytes {
283 if !isPrintable(b) {
284 err = SyntaxError{"PrintableString contains invalid character"}
285 return
286 }
287 }
288 ret = string(bytes)
289 return
290}
291
292// isPrintable returns true iff the given b is in the ASN.1 PrintableString set.
293func isPrintable(b byte) bool {

Callers 1

UniversalMethod · 0.95

Calls 2

mustBeValueMethod · 0.95
isPrintableFunction · 0.70

Tested by

no test coverage detected