-func asn1bstringToString(val []byte, numBits uint) string {
- // Take the last byte
- c := val[len(val)-1]
-
- b := numBits % 8
-
- // If num bits is not evenly divisable by 8 ...
- if b != 0 {
- // ... shift the value to the higher bits (in our case: 0x0b -> 0xb0)
- c <<= 8 - b
- }
-
- if len(val) == 1 {
- return fmt.Sprintf("%02x", c)
- }
- return fmt.Sprintf("%02x%02x", val[:len(val)-1], c)
-}
-