Closed ThomasKliszowski closed 4 years ago
I tried to implement OPTIONAL tagging on a sequence by doing something like that:
ASN1Sequence() ..add(ASN1Integer.fromInt(1)) ..add(ASN1Integer(privateKey.d, tag: OCTET_STRING_TYPE)) ..add(ASN1Object.preEncoded( 160, ASN1ObjectIdentifier.fromComponentString("1.2.840.10045.3.1.7") .encodedBytes)) ..add(ASN1Object.preEncoded( 161, ASN1BitString(publicKey.Q.getEncoded(false)).encodedBytes));
This code gives me a wrong object identifier 1.2.840.10045.3.0.0. After investigate a bit, I could find that ASN1Object.preEncoded() is broken, the range is going from start to length, when it should go from start to start + length.
1.2.840.10045.3.0.0
ASN1Object.preEncoded()
start
length
start + length
I tried to implement OPTIONAL tagging on a sequence by doing something like that:
This code gives me a wrong object identifier
1.2.840.10045.3.0.0
. After investigate a bit, I could find thatASN1Object.preEncoded()
is broken, the range is going fromstart
tolength
, when it should go fromstart
tostart + length
.