1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =head1 NAME 4 1.1 christos 5 1.1 christos OSSL_ENCODER, 6 1.1 christos OSSL_ENCODER_fetch, 7 1.1 christos OSSL_ENCODER_up_ref, 8 1.1 christos OSSL_ENCODER_free, 9 1.1 christos OSSL_ENCODER_get0_provider, 10 1.1 christos OSSL_ENCODER_get0_properties, 11 1.1 christos OSSL_ENCODER_is_a, 12 1.1 christos OSSL_ENCODER_get0_name, 13 1.1 christos OSSL_ENCODER_get0_description, 14 1.1 christos OSSL_ENCODER_do_all_provided, 15 1.1 christos OSSL_ENCODER_names_do_all, 16 1.1 christos OSSL_ENCODER_gettable_params, 17 1.1 christos OSSL_ENCODER_get_params 18 1.1 christos - Encoder method routines 19 1.1 christos 20 1.1 christos =head1 SYNOPSIS 21 1.1 christos 22 1.1 christos #include <openssl/encoder.h> 23 1.1 christos 24 1.1 christos typedef struct ossl_encoder_st OSSL_ENCODER; 25 1.1 christos 26 1.1 christos OSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *ctx, const char *name, 27 1.1 christos const char *properties); 28 1.1 christos int OSSL_ENCODER_up_ref(OSSL_ENCODER *encoder); 29 1.1 christos void OSSL_ENCODER_free(OSSL_ENCODER *encoder); 30 1.1 christos const OSSL_PROVIDER *OSSL_ENCODER_get0_provider(const OSSL_ENCODER *encoder); 31 1.1 christos const char *OSSL_ENCODER_get0_properties(const OSSL_ENCODER *encoder); 32 1.1 christos int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name); 33 1.1 christos const char *OSSL_ENCODER_get0_name(const OSSL_ENCODER *encoder); 34 1.1 christos const char *OSSL_ENCODER_get0_description(const OSSL_ENCODER *encoder); 35 1.1 christos void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx, 36 1.1 christos void (*fn)(OSSL_ENCODER *encoder, void *arg), 37 1.1 christos void *arg); 38 1.1 christos int OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder, 39 1.1 christos void (*fn)(const char *name, void *data), 40 1.1 christos void *data); 41 1.1 christos const OSSL_PARAM *OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder); 42 1.1 christos int OSSL_ENCODER_get_params(OSSL_ENCODER_CTX *ctx, const OSSL_PARAM params[]); 43 1.1 christos 44 1.1 christos =head1 DESCRIPTION 45 1.1 christos 46 1.1 christos B<OSSL_ENCODER> is a method for encoders, which know how to 47 1.1 christos encode an object of some kind to a encoded form, such as PEM, 48 1.1 christos DER, or even human readable text. 49 1.1 christos 50 1.1 christos OSSL_ENCODER_fetch() looks for an algorithm within the provider that 51 1.1 christos has been loaded into the B<OSSL_LIB_CTX> given by I<ctx>, having the 52 1.1 christos name given by I<name> and the properties given by I<properties>. 53 1.1 christos The I<name> determines what type of object the fetched encoder 54 1.1 christos method is expected to be able to encode, and the properties are 55 1.1 christos used to determine the expected output type. 56 1.1 christos For known properties and the values they may have, please have a look 57 1.1 christos in L<provider-encoder(7)/Names and properties>. 58 1.1 christos 59 1.1 christos OSSL_ENCODER_up_ref() increments the reference count for the given 60 1.1 christos I<encoder>. 61 1.1 christos 62 1.1 christos OSSL_ENCODER_free() decrements the reference count for the given 63 1.1 christos I<encoder>, and when the count reaches zero, frees it. 64 1.1.1.3 christos If the argument is NULL, nothing is done. 65 1.1 christos 66 1.1 christos OSSL_ENCODER_get0_provider() returns the provider of the given 67 1.1 christos I<encoder>. 68 1.1 christos 69 1.1 christos OSSL_ENCODER_get0_properties() returns the property definition associated 70 1.1 christos with the given I<encoder>. 71 1.1 christos 72 1.1 christos OSSL_ENCODER_is_a() checks if I<encoder> is an implementation of an 73 1.1 christos algorithm that's identifiable with I<name>. 74 1.1 christos 75 1.1 christos OSSL_ENCODER_get0_name() returns the name used to fetch the given I<encoder>. 76 1.1 christos 77 1.1 christos OSSL_ENCODER_get0_description() returns a description of the I<loader>, meant 78 1.1 christos for display and human consumption. The description is at the discretion of the 79 1.1 christos I<loader> implementation. 80 1.1 christos 81 1.1 christos OSSL_ENCODER_names_do_all() traverses all names for the given 82 1.1 christos I<encoder>, and calls I<fn> with each name and I<data> as arguments. 83 1.1 christos 84 1.1 christos OSSL_ENCODER_do_all_provided() traverses all encoder 85 1.1 christos implementations by all activated providers in the library context 86 1.1 christos I<libctx>, and for each of the implementations, calls I<fn> with the 87 1.1 christos implementation method and I<arg> as arguments. 88 1.1 christos 89 1.1 christos OSSL_ENCODER_gettable_params() returns an L<OSSL_PARAM(3)> 90 1.1 christos array of parameter descriptors. 91 1.1 christos 92 1.1 christos OSSL_ENCODER_get_params() attempts to get parameters specified 93 1.1 christos with an L<OSSL_PARAM(3)> array I<params>. Parameters that the 94 1.1 christos implementation doesn't recognise should be ignored. 95 1.1 christos 96 1.1 christos =head1 RETURN VALUES 97 1.1 christos 98 1.1 christos OSSL_ENCODER_fetch() returns a pointer to the key management 99 1.1 christos implementation represented by an OSSL_ENCODER object, or NULL on 100 1.1 christos error. 101 1.1 christos 102 1.1 christos OSSL_ENCODER_up_ref() returns 1 on success, or 0 on error. 103 1.1 christos 104 1.1 christos OSSL_ENCODER_free() doesn't return any value. 105 1.1 christos 106 1.1 christos OSSL_ENCODER_get0_provider() returns a pointer to a provider object, or 107 1.1 christos NULL on error. 108 1.1 christos 109 1.1 christos OSSL_ENCODER_get0_properties() returns a pointer to a property 110 1.1 christos definition string, or NULL on error. 111 1.1 christos 112 1.1 christos OSSL_ENCODER_is_a() returns 1 of I<encoder> was identifiable, 113 1.1 christos otherwise 0. 114 1.1 christos 115 1.1 christos OSSL_ENCODER_get0_name() returns the algorithm name from the provided 116 1.1 christos implementation for the given I<encoder>. Note that the I<encoder> may have 117 1.1 christos multiple synonyms associated with it. In this case the first name from the 118 1.1 christos algorithm definition is returned. Ownership of the returned string is retained 119 1.1 christos by the I<encoder> object and should not be freed by the caller. 120 1.1 christos 121 1.1.1.2 christos OSSL_ENCODER_get0_description() returns a pointer to a description, or NULL if 122 1.1 christos there isn't one. 123 1.1 christos 124 1.1 christos OSSL_ENCODER_names_do_all() returns 1 if the callback was called for all 125 1.1 christos names. A return value of 0 means that the callback was not called for any names. 126 1.1 christos 127 1.1 christos =head1 SEE ALSO 128 1.1 christos 129 1.1 christos L<provider(7)>, L<OSSL_ENCODER_CTX(3)>, L<OSSL_ENCODER_to_bio(3)>, 130 1.1 christos L<OSSL_ENCODER_CTX_new_for_pkey(3)>, L<OSSL_LIB_CTX(3)> 131 1.1 christos 132 1.1 christos =head1 HISTORY 133 1.1 christos 134 1.1 christos The functions described here were added in OpenSSL 3.0. 135 1.1 christos 136 1.1 christos =head1 COPYRIGHT 137 1.1 christos 138 1.1.1.3 christos Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. 139 1.1 christos 140 1.1 christos Licensed under the Apache License 2.0 (the "License"). You may not use 141 1.1 christos this file except in compliance with the License. You can obtain a copy 142 1.1 christos in the file LICENSE in the source distribution or at 143 1.1 christos L<https://www.openssl.org/source/license.html>. 144 1.1 christos 145 1.1 christos =cut 146