aboutsummaryrefslogtreecommitdiff
path: root/ber
diff options
context:
space:
mode:
Diffstat (limited to 'ber')
-rw-r--r--ber/class.go2
-rw-r--r--ber/dump.go26
2 files changed, 17 insertions, 11 deletions
diff --git a/ber/class.go b/ber/class.go
index 32c1564..50ada25 100644
--- a/ber/class.go
+++ b/ber/class.go
@@ -21,7 +21,7 @@ const (
var classNames = map[Class]string{
classUniversal: "Universal",
classApplication: "Application",
- classContextSpecific: "Context-specific",
+ classContextSpecific: "Context",
classPrivate: "Private",
}
diff --git a/ber/dump.go b/ber/dump.go
index e0edf94..fd1e45b 100644
--- a/ber/dump.go
+++ b/ber/dump.go
@@ -11,17 +11,17 @@ func Dump(b []byte) string {
func (s *state) universal(h Header) string {
switch h.Tag {
case tagInteger, tagEnumerated:
- return fmt.Sprintln(s.unmarshalInt())
+ return fmt.Sprint(s.unmarshalInt())
case tagBoolean:
- return fmt.Sprintln(s.unmarshalBool())
+ return fmt.Sprint(s.unmarshalBool())
case tagObjectIdentifier:
- return fmt.Sprintln(s.unmarshalOID())
+ return fmt.Sprint(s.unmarshalOID())
case tagBitString:
- return fmt.Sprintln(s.unmarshalBitString())
+ return fmt.Sprint(s.unmarshalBitString())
case tagIA5String, tagOctetString:
- return fmt.Sprintln(s.unmarshalString())
+ return fmt.Sprint(s.unmarshalString())
default:
- return fmt.Sprintln(s.next())
+ return fmt.Sprint(s.next())
}
}
@@ -31,17 +31,23 @@ func (s *state) dump(indent int) (ret string) {
}
for s.Len() > 0 {
h := s.unmarshalClass()
- ret += fmt.Sprintf("%3d: %*s%v: ", s.Len(), 2*indent, "", h)
+ ret += fmt.Sprintf("%3d: %*s", s.Len(), 2*indent, "")
switch h.Kind {
case kindPrimitive:
switch h.Class {
case classUniversal:
- ret += s.universal(h)
+ ret += fmt.Sprintln(h.Tag, "=", s.universal(h))
default:
- ret += fmt.Sprintln(s.next())
+ ret += fmt.Sprintln(h.Class, int(h.Tag), "=",
+ s.next())
}
case kindConstructed:
- ret += fmt.Sprintln("→")
+ switch h.Class {
+ case classUniversal:
+ ret += fmt.Sprintln(h.Tag, "→")
+ default:
+ ret += fmt.Sprintln(h.Class, int(h.Tag), "→")
+ }
ret += s.subState().dump(indent + 1)
}
}