OSSL_ENCODER(3ossl)
π OSSL_ENCODER(3ossl) π
okay bestie, buckle up, because this is the OSSL_ENCODER(3ossl) page and it's giving "the whole encoder method routine situation," and honestly? kinda iconic.
Here's the whole squad of functions this page covers, so you know who's at the party:
OSSL_ENCODER, OSSL_ENCODER_fetch, OSSL_ENCODER_up_ref, OSSL_ENCODER_free, OSSL_ENCODER_get0_provider, OSSL_ENCODER_get0_properties, OSSL_ENCODER_is_a, OSSL_ENCODER_get0_name, OSSL_ENCODER_get0_description, OSSL_ENCODER_do_all_provided, OSSL_ENCODER_names_do_all, OSSL_ENCODER_gettable_params, OSSL_ENCODER_get_params β all of them are Encoder method routines. main character energy fr fr π
β¨ SYNOPSIS β¨
#include <openssl/encoder.h>
typedef struct ossl_encoder_st OSSL_ENCODER;
OSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *ctx, const char *name,
const char *properties);
int OSSL_ENCODER_up_ref(OSSL_ENCODER *encoder);
void OSSL_ENCODER_free(OSSL_ENCODER *encoder);
const OSSL_PROVIDER *OSSL_ENCODER_get0_provider(const OSSL_ENCODER *encoder);
const char *OSSL_ENCODER_get0_properties(const OSSL_ENCODER *encoder);
int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name);
const char *OSSL_ENCODER_get0_name(const OSSL_ENCODER *encoder);
const char *OSSL_ENCODER_get0_description(const OSSL_ENCODER *encoder);
void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(OSSL_ENCODER *encoder, void *arg),
void *arg);
int OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder,
void (*fn)(const char *name, void *data),
void *data);
const OSSL_PARAM *OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder);
int OSSL_ENCODER_get_params(OSSL_ENCODER_CTX *ctx, const OSSL_PARAM params[]);
πΈ DESCRIPTION πΈ
so like. OSSL_ENCODER is a method for encoders β and encoders are the lil guys who know how to take an object of some kind and encode it into an encoded form. examples? PEM, DER, or even human readable text. versatile queen behavior π
π OSSL_ENCODER_fetch π
OSSL_ENCODER_fetch() goes looking for an algorithm inside the provider that's been loaded into the OSSL_LIB_CTX you handed it as ctx, matching the name you gave and the properties you gave. easy enough.
now the important part: the name determines what type of object the fetched encoder method is expected to be able to encode, and the properties determine the expected output type. got it? good, because there will be a quiz.
for the known properties and the values they can have, go peek at "Names and properties" in provider-encoder(7). iykyk π
π OSSL_ENCODER_up_ref π
OSSL_ENCODER_up_ref() bumps the reference count for the given encoder up by one. keeping it alive, keeping it thriving π«Ά
π¦ OSSL_ENCODER_free π¦
OSSL_ENCODER_free() brings the reference count for the given encoder down by one, and the moment that count hits zero β she's freed. gone. released into the void π
pro tip though: if the argument is NULL, literally nothing happens. no crash, no drama, we just move on.
π OSSL_ENCODER_get0_provider π
OSSL_ENCODER_get0_provider() returns the provider of the given encoder. that's it, that's the whole thing.
β OSSL_ENCODER_get0_properties β
OSSL_ENCODER_get0_properties() returns the property definition associated with the given encoder.
π OSSL_ENCODER_is_a π
OSSL_ENCODER_is_a() checks whether encoder is an implementation of an algorithm that's identifiable with name. the vibe check function, basically.
π§ OSSL_ENCODER_get0_name π§
OSSL_ENCODER_get0_name() returns the name that was used to fetch the given encoder.
π OSSL_ENCODER_get0_description π
OSSL_ENCODER_get0_description() returns a description of the loader, meant for display and human consumption. and that description is entirely at the discretion of the loader implementation β yeah, the page says loader, we're not gonna interrogate it, we're just gonna report it π
π₯ OSSL_ENCODER_names_do_all π₯
OSSL_ENCODER_names_do_all() traverses all the names for the given encoder, and calls fn with each name and data as arguments. every single name gets a turn, no skipping the line π
π OSSL_ENCODER_do_all_provided π
OSSL_ENCODER_do_all_provided() traverses all encoder implementations across all activated providers in the library context libctx, and for each one of those implementations, it calls fn with the implementation method and arg as arguments. the full tour, no cap.
πΈ OSSL_ENCODER_gettable_params πΈ
OSSL_ENCODER_gettable_params() returns an OSSL_PARAM(3) array of parameter descriptors.
β¨ OSSL_ENCODER_get_params β¨
OSSL_ENCODER_get_params() tries to get parameters specified with an OSSL_PARAM(3) array params. and heads up: parameters the implementation doesn't recognise should just be ignored. no errors, no sulking, just ignore βοΈ
π RETURN VALUES π
okay this is the part where we find out what you actually get back. pay attention bestie:
OSSL_ENCODER_fetch()returns a pointer to the key management implementation represented by anOSSL_ENCODERobject, orNULLon error.OSSL_ENCODER_up_ref()returns1on success, or0on error.OSSL_ENCODER_free()doesn't return any value. she gives nothing and that's fine.OSSL_ENCODER_get0_provider()returns a pointer to a provider object, orNULLon error.OSSL_ENCODER_get0_properties()returns a pointer to a property definition string, orNULLon error.OSSL_ENCODER_is_a()returns1of encoder was identifiable, otherwise0. (yes, we know, it says "of" β we're keeping it, it's canon)OSSL_ENCODER_get0_name()returns the algorithm name from the provided implementation for the given encoder. and listen β the encoder may have multiple synonyms associated with it. in that case, the first name from the algorithm definition is the one you get. also: ownership of the returned string is retained by the encoder object, so do not free it yourself, the caller does not get custody π«΅OSSL_ENCODER_get0_description()returns a pointer to a description, orNULLif there isn't one.OSSL_ENCODER_names_do_all()returns1if the callback was called for all names. a return value of0means the callback was not called for any names.
ngl thenames_do_allone is a little unhinged β it's0for "never called at all," not "called for some but not all." read it twice. π«
π SEE ALSO π
go read these next, they're all part of the lore:
provider(7), OSSL_ENCODER_CTX(3), OSSL_ENCODER_to_bio(3), OSSL_ENCODER_CTX_new_for_pkey(3), OSSL_LIB_CTX(3)
π¦ HISTORY π¦
the functions described here were added in OpenSSL 3.0. so they're not ancient, they're just established π
π COPYRIGHT π
Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie π«Ά go encode something gorgeous. this was 3.5.6, dated 2026-04-07, and it was giving OSSL_ENCODER(3ossl) the entire time β periodt πβ¨π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms