0

Given the following ASN1 definition:

InitialUE-Identity ::= CHOICE {
        s-TMSI         S-TMSI,
        randomValue    BIT STRING (SIZE (40))
}

An XER encoding for randomvalue: 0x59AA46959A would be:

<InitialUE-Identity>                            
    <randomValue>0101100110101010010001101001010110011010</randomValue>
</InitialUE-Identity>

Is there any way to input a BIT STRING in hex format? Something like:

<InitialUE-Identity>                            
    <randomValue>0x59AA46959A</randomValue>
</InitialUE-Identity>
xvan
  • 4,554
  • 1
  • 22
  • 37

1 Answers1

1

Install an XSLT processor with support for the EXPath Binary function library, and it's then easy to do a transformation that converts the hex to binary.

http://expath.org/spec/binary#hex

Well, I thought it was. Looking more carefully, you can read the hex easily using bin:hex(randomValue), but outputting the sequence-of-ones-and-zeros looks more tricky. In fact, it's probably just as easy to do it by hand: just loop over the hex digits and convert each one to a sequence of four ones-and-zeros using a lookup table.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164