ASN1_dup

Deep-copy an ASN.1 value by encoding with i2d then decoding with d2i.

Synopsis

Declared in <openssl/asn1.h>

void*
ASN1_dup(
    i2d_of_void* i2d,
    d2i_of_void* d2i,
    void const* x);

Return Value

Newly allocated copy, or NULL on error.

Parameters

NameDescription
i2dEncoder that serializes x to DER (or returns the required length).
d2iDecoder that rebuilds a heap object from that DER.
xSource object to duplicate.