BN_signed_bn2native

Encode a BIGNUM as a fixed-length native-endian two's-complement byte string.

Synopsis

Declared in <openssl/bn.h>

int
BN_signed_bn2native(
    BIGNUM const* a,
    unsigned char* to,
    int tolen);

Return Value

tolen on success, or -1 if a does not fit in tolen bytes.

Parameters

NameDescription
aValue to encode (sign is preserved via two's complement).
toDestination buffer of tolen bytes; sign-extended as needed.
tolenExact output length in bytes.