|
NAMEASN1_put_object , ASN1_put_eoc ,
ASN1_object_size —
start and end the BER encoding of an arbitrary ASN.1 data
element
SYNOPSIS#include <openssl/asn1.h>
void
int
int
DESCRIPTIONASN1_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.
The tag class can be
The constructed argument can have the following values:
If the tag is less than
After completing the identifier byte(s), when using the definite form, the given content_length is encoded in one or more bytes as needed, using the long form if and only if the content_length is greater than 127. When using the indefinite form, the special byte 0x80 is written instead and the content_length argument is ignored. At the end, *ber_out is set to the byte following the last byte written. The calling code can then start writing content bytes. If the indefinite form was selected, the calling code is also
responsible for calling
RETURN VALUESASN1_put_eoc () returns the number of bytes written,
which is always 2.
SEE ALSOASN1_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)STANDARDSITU-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 encodingHISTORYASN1_put_object () and
ASN1_object_size () first appeared in SSLeay 0.5.1 and
have been available since OpenBSD 2.4.
CAVEATSNone of these functions do any sanity checking. When called in inconsistent ways, invalid content may result in *ber_out, for example
If the calling code wants to find out how many bytes were written,
it needs to save a copy of the pointer *ber_out before
calling
Visit the GSP FreeBSD Man Page Interface. |