Hello, thanks for your answer. I think now i got it right.
Now that i have corrected the encoding of the restricted IA5String, it
seems that i have messed up a little more. The IA5String i have declared
earlier is part of an extension:
Let us assume the following:
mytype ::= SEQUENCE
{
a Type1,
...,
b SEQUENCE OF Type2 OPTIONAL
c Type3 OPTIONAL,
d Type3 OPTIONAL,
e Type3 OPTIONAL,
f Type3 OPTIONAL,
g Type3 OPTIONAL,
h Type3 OPTIONAL,
i Type3 OPTIONAL,
j Type3 OPTIONAL,
k Type3 OPTIONAL,
l Type3 OPTIONAL,
m Type3 OPTIONAL,
n Type3 OPTIONAL,
o Type3 OPTIONAL,
p Type3 OPTIONAL,
q Type3 OPTIONAL,
r Type3 OPTIONAL,
}
Type2 ::= CHOICE
{
mystring IA5String (SIZE (1..128)) (FROM ("01234567890#*,"),
c Type3
}
The encoding of the Sequence mytype seems to be correct up to the
extension marker (there are some more types, i left them out till
Ethereal shows me that encode them correctly). In the Extension Group
only b will be used, so the rest are dummy types to show the quantity.
Following i will show my understanding how the extension group should be
encoded with 1 item of type mystring = "55#12" in b.
First i have to encode the number of components in the extensions (which
is 16.
0010000 Number of Components in extension
1. Item 0 (b) is used
00000000. No other Item is used
00000000.
00000110. Byte Length of component b
00000001. Items in Sequence of: 1
00000000. Selection of Choice mystring (index 0)
0000100x. Length of IA5String 5
1000 5
1000. 5
0000 #
0100. 1
0101 2
xxxx. padding
In Hex
21 00 00 06 01 00 08 88 80 04 50
This is the Output of my encoding.
Ethereal say that the byte length of type b is 3 byte and tells that
mystring only consists of 5.
My guess that i have missencoded the length determinant in the extension
preamble. I have read again and again section 18 of X.691 but i didn't
find out what i have misunderstood.
Regards,
Tobias
P.S. I hope this time i have left out any typos :S
_______________________________________________
Asn1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1