Sortix main manual
This manual documents Sortix main. You can instead view this document in the latest official manual.
NAME
ASN1_put_object, ASN1_put_eoc, ASN1_object_size — start and end the BER encoding of an arbitrary ASN.1 data elementSYNOPSIS
#include <openssl/asn1.h>ASN1_put_object(unsigned char **ber_out, int constructed, int content_length, int tag, int class);
ASN1_put_eoc(unsigned char **ber_out);
ASN1_object_size(int constructed, int content_length, int tag);
DESCRIPTION
ASN1_put_object() begins writing the BER encoding of an arbitrary ASN.1 data element to the buffer *ber_out by writing the identifier and the length bytes. Making sure that there is sufficient space in the buffer is the responsibility of the caller. This function does not write any content bytes nor any end-of-content bytes.- 0
- Start a primitive value by setting the third most significant bit of the first byte written to 0. Always use the definite form.
- 1
- Start a constructed value by setting the third most significant bit of the first byte written to 1, and use the definite form.
- 2
- Start a constructed value and use the indefinite form,
RETURN VALUES
ASN1_put_eoc() returns the number of bytes written, which is always 2.SEE ALSO
ASN1_item_i2d(3), ASN1_TYPE_get(3), i2d_ASN1_NULL(3), i2d_ASN1_OBJECT(3), i2d_ASN1_OCTET_STRING(3), i2d_ASN1_SEQUENCE_ANY(3)STANDARDS
ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER), section 8.1: General rules for encodingHISTORY
ASN1_put_object() and ASN1_object_size() first appeared in SSLeay 0.5.1 and have been available since OpenBSD 2.4.CAVEATS
None of these functions do any sanity checking. When called in inconsistent ways, invalid content may result in *ber_out, for example- a tag number less than V_ASN1_PRIMITIVE_TAG with a class other than V_ASN1_UNIVERSAL
- a tag number equal to V_ASN1_EOC (0x00) or V_ASN1_PRIMITIVE_TAG (0x1f)
- a BOOLEAN, INTEGER, NULL etc. with the constructed bit set
- a SEQUENCE or SET etc. without the constructed bit set
- a content_length that makes no sense for the given tag
- a content_length that disagrees with the following data
- a BOOLEAN, INTEGER, NULL etc. in indefinite form
- an end-of-content marker even though no indefinite form was started
- ...