Java 1.5 is not encoding integers properly



I am using java 1.5 to generate a service ticket token (AP Request) for a
service running on Unisys machines.
This token can not be parsed properly due to ASN encoding errors.

There is an Authenticator in this AP request.
Within the authenticator, there is an optional field for seq-number of type
integer.
The seq-number is a unsigned integer that can go from 0 to 2**32 -1 with a
random initial value.

During my sample runs, I saw that Java 1.5 implementation is either sending
an integer encoded in 2 bytes or an integer encoded in 4 bytes. When this is
encoded in 2 bytes, there is no issue. When this is encoded in 4 bytes, the
encoding is not correct. The value looks something like FFFFXXXX (A706 0204
FFFFXXXX).

As per ASN encoding, this should be encoded as 00FFFFXXXX (A707 0205
00FFFFXXXX) since ASN encoding does not allow top 9 bit to be either all
ones or all zeroes.

Has anyone seen this problem?

sample Hex dump of the seq-number field from the Authenticator

A70402020398 Works
A704020207CB Works
A7060204FFFFF77F Fails
A7060204FFFFFA59 Fails
A7060204FFFFF96D Fails
A7060204FFFFF3F8 Fails


.



Relevant Pages

  • Re: Caveat emperor
    ... request since they started this business. ... I don't think this supports arguments for greater Executive powers. ... The argument that "If we had this we could have prevented 9/11" fails on a very large number of factual grounds. ... Maria and her friends in their push to install an unaccountable executive in a single-party state have chosen an position that helps the terrorists. ...
    (alt.usage.english)
  • Re: Newbie (Post#1): Help with Array of Objects
    ... I code Java in a TDD environment, ... > sense if you picture yourself in a war against the compiler to make your ... Best possible scenario. ... The code always fails at runtime. ...
    (comp.lang.java.help)
  • Re: When to check the return value of malloc
    ... A request for 100MB succeeds, what's the probability that a request for 100 ... bytes fails? ... Maintenance cost for a program using xmalloc() instead of a handling ...
    (comp.lang.c)
  • Re: Vista - jre1.6.0_05 - applets wont run
    ... and this is immediately after I install the JRE. ... Still it fails. ... I'm wondering if I need to wait for Java 6 Update 10? ... certain changes to become effective it required a reboot. ...
    (comp.lang.java.programmer)
  • RE: Word 2007 Automation BUG? in Windows 2008 Service C++
    ... I DO consider it a bug that the method reports success, and then fails. ... I am using C# and Java though. ... The Document Open method does not fail but the document is always NULL. ...
    (microsoft.public.office.developer.automation)