ber_get_null - Linux


ber_get_null extracts a null-valued BER element from a BER encoded message.


ber_get_null(ber_element *ber, ber_identifier_t id)


  • ber: A pointer to the BER element to decode.
  • id: The identifier of the BER element to retrieve.


// Decoding a NULL element with a specific identifier
int identifier = 1;
ber_element *element = ...;
ber_identifier_t null = ber_get_null(element, identifier);
if (!null) {
  // NULL element not found
// Decoding a NULL element without a specific identifier
ber_element *element = ...;
ber_identifier_t null = ber_get_null(element, 0);
if (!null) {
  // NULL element at the current position not found

Common Issues

  • If the BER element does not contain a NULL element with the specified identifier, NULL will be returned.
  • If the BER element is not properly encoded, an error will be raised.


ber_get_null can be used in conjunction with other BER decoding functions to parse complex BER messages.

Related Commands