ber_put_ostring - Linux


ber_put_oer_ostring is used in the Application Layer to encode a BER Object Identifier (OID) into a compact binary representation. This encoding is defined in the X.690 standard.


ber_put_oer_ostring(ber, ostring)

| Parameter | Description |
| ber | A pointer to a BER element. |
| ostring | A pointer to an OCTET STRING (ASN.1 type) structure containing the OID to be encoded. |




// Encode an OID into a BER element
asn_encode_to_buffer(&ber, buf, &data_oid);
ber_put_oer_ostring(&ber, &data_oid);

// Decode the encoded OID from the BER element
asn_decode_from_buffer(&ber, buf, &data_oid);

Common Issues

  • Ensure that the ostring parameter points to a valid OCTET STRING structure containing the OID to be encoded.
  • Check that the BER element is correctly initialized and allocated.


ber_put_oer_ostring can be combined with other BER encoding functions to create complex ASN.1 structures. It can be used in applications that require efficient encoding of OIDs, such as PKIs and security systems.

Related Commands

  • ber_put_int
  • ber_put_enum
  • ber_put_string