Create an encoder context preconfigured to encode an EVP_PKEY.

Synopsis

Declared in <openssl/encoder.h>

OSSL_ENCODER_CTX*
OSSL_ENCODER_CTX_new_for_pkey(
    EVP_PKEY const* pkey,
    int selection,
    char const* output_type,
    char const* output_struct,
    char const* propquery);

Description

Performs an implicit encoder fetch suitable for pkey, which is more useful than calling OSSL_ENCODER_CTX_new() alone. The returned context may have zero encoders if none matched; check with OSSL_ENCODER_CTX_get_num_encoders().

Return Value

New encoder context, or NULL on error; free with OSSL_ENCODER_CTX_free().

Parameters

Name

Description

pkey

Assigned public or private key to encode.

selection

OSSL_KEYMGMT_SELECT_* mask for components to encode.

output_type

Desired ending output type (for example "DER" or "PEM").

output_struct

Desired output structure name (for example "pkcs8"), or NULL.

propquery

Optional property query for encoder fetching, or NULL.

Created with MrDocs