[prev in list] [next in list] [prev in thread] [next in thread]
List: bouncycastle-crypto-dev
Subject: [dev-crypto] ASN1InputStream with constructed applications lead to exception
From: Lothar Kimmeringer <job () kimmeringer ! de>
Date: 2008-11-19 9:35:22
Message-ID: 4923DDDA.4020107 () kimmeringer ! de
[Download RAW message or body]
Hello,
I'm trying to use the ASN1InputStream to read in DER-encoded data.
The following DER-data lead to an exception:
[...] 30 80 64 80 63 80 61 80 [...]
If I understood X.690 correctly (I don't claim to actually have ;-)
the following objects are here:
Constructed Sequence
Constructed Application 4,
Constructed Application 3,
Constructed Application 1
When trying to read in the object using ASN1InputStream I receive
the following exception:
java.io.IOException: unknown BER object encountered: 0x64
at org.bouncycastle.asn1.ASN1InputStream.readObject(ASN1InputStream.java:475)
(I added the hexadecimal value to the exception-message by using
the sources of bcprov to actually find out what part of the
DER-encoded data lead to the problem).
Looking into the sources I think I found the problem (but because
I'm not sure if I understood the DER-encoding of ASN.1 I'd like to
discuss it here).
ASN1InputStream.java: 385
switch (tag)
If the length is indefenitive, a switch-statement is used,
where every possible type is checked. What's missing is
a case APPLICATION | CONSTRUCTED.
Because the example above is not tagged, the default-block
goes directly to the exception.
I'd really like to use the BC-classes for reading in the data,
because I don't want to add (yet) another ASN1-parser to my
application (there are already two of them, where the other
is more or less a copy of BC just with a different package-name).
Best regards, Lothar
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic