From 5a1439dcf94bfcd9eac4ae8b9d9ba60a3f7a3419 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 27 Jun 2015 22:16:24 +0200 Subject: Add class decector --- ber/class_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 ber/class_test.go (limited to 'ber/class_test.go') diff --git a/ber/class_test.go b/ber/class_test.go new file mode 100644 index 0000000..8e9a49a --- /dev/null +++ b/ber/class_test.go @@ -0,0 +1,20 @@ +package ber + +import "fmt" + +func ExampleIdent() { + b := []byte{0x60, 0xA1, 0x02, 0x30, 0x0A, 0x80, 0x7E, 0x04} + for _, v := range b { + c, i, t := Ident(v) + fmt.Printf("0x%.2X: %v %v %v - 0x%.2X\n", v, c, i, t, byte(t)) + } + // Output: + // 0x60: Application Constructed End-of-Content - 0x00 + // 0xA1: Context-specific Constructed Boolean - 0x01 + // 0x02: Universal Primitive Integer - 0x02 + // 0x30: Universal Constructed Sequence / Of - 0x10 + // 0x0A: Universal Primitive Enumerated - 0x0A + // 0x80: Context-specific Primitive End-of-Content - 0x00 + // 0x7E: Application Constructed BMP String - 0x1E + // 0x04: Universal Primitive Octet String - 0x04 +} -- cgit v1.2.3