GENERIC_ERROR returned on asn1_der_coding method
Description of problem:
GENERIC_ERROR (error code 6) returned on asn1_der_coding method
Version of libtasn1 used:
1.4.13
Distributor of libtasn1 (e.g., Ubuntu, Fedora, RHEL)
https://www.gnu.org/software/libtasn1/
How reproducible: Always
Steps to Reproduce:
- one
ingest the following schema with asn1_parser2tree --> ASN1_SUCCESS:
Schema { }
DEFINITIONS IMPLICIT TAGS ::=
BEGIN
Response ::= SEQUENCE {
a OCTET STRING (SIZE (2)),
b BOOLEAN,
c INTEGER,
d INTEGER
}
END
- two
populate the structure with asn1_write_value for each item, then print it with asn1_print_structure:
name:Schema type:DEFINITIONS attr:IMPLICIT,
name:NULL type:OBJ_ID
name:Response type:SEQUENCE
name:a type:OCT_STR value:0100 attr:SIZE,
name:NULL type:SIZE value:2 attr:1_PARAM,
name:b type:BOOLEAN value:FALSE
name:c type:INTEGER value:0x05
name:d type:INTEGER value:0x03
- three
try to generate the corresponding DER using asn1_der_coding(..., "Schema", ..., ..., ...) --> error code 6: GENERIC_ERROR
Actual results:
GENERIC_ERROR
Expected results:
DER encoded buffer or a meaningful error.
Edited by Flo