test: use the new set public and private together call
[openssl.git] / doc / man3 / OSSL_DECODER.pod
1 =pod
2
3 =head1 NAME
4
5 OSSL_DECODER,
6 OSSL_DECODER_fetch,
7 OSSL_DECODER_up_ref,
8 OSSL_DECODER_free,
9 OSSL_DECODER_provider,
10 OSSL_DECODER_properties,
11 OSSL_DECODER_is_a,
12 OSSL_DECODER_number,
13 OSSL_DECODER_do_all_provided,
14 OSSL_DECODER_names_do_all,
15 OSSL_DECODER_gettable_params,
16 OSSL_DECODER_get_params
17 - Decoder method routines
18
19 =head1 SYNOPSIS
20
21  #include <openssl/decoder.h>
22
23  typedef struct ossl_decoder_st OSSL_DECODER;
24
25  OSSL_DECODER *OSSL_DECODER_fetch(OSSL_LIB_CTX *ctx, const char *name,
26                                   const char *properties);
27  int OSSL_DECODER_up_ref(OSSL_DECODER *decoder);
28  void OSSL_DECODER_free(OSSL_DECODER *decoder);
29  const OSSL_PROVIDER *OSSL_DECODER_provider(const OSSL_DECODER *decoder);
30  const char *OSSL_DECODER_properties(const OSSL_DECODER *decoder);
31  int OSSL_DECODER_is_a(const OSSL_DECODER *decoder, const char *name);
32  int OSSL_DECODER_number(const OSSL_DECODER *decoder);
33  void OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx,
34                                    void (*fn)(OSSL_DECODER *decoder, void *arg),
35                                    void *arg);
36  int OSSL_DECODER_names_do_all(const OSSL_DECODER *decoder,
37                                void (*fn)(const char *name, void *data),
38                                void *data);
39  const OSSL_PARAM *OSSL_DECODER_gettable_params(OSSL_DECODER *decoder);
40  int OSSL_DECODER_get_params(OSSL_DECODER_CTX *ctx, const OSSL_PARAM params[]);
41
42 =head1 DESCRIPTION
43
44 B<OSSL_DECODER> is a method for decoders, which know how to
45 decode encoded data into an object of some type that the rest
46 of OpenSSL knows how to handle.
47
48 OSSL_DECODER_fetch() looks for an algorithm within the provider that
49 has been loaded into the B<OSSL_LIB_CTX> given by I<ctx>, having the
50 name given by I<name> and the properties given by I<properties>.
51 The I<name> determines what type of object the fetched decoder
52 method is expected to be able to decode, and the properties are
53 used to determine the expected output type.
54 For known properties and the values they may have, please have a look
55 in L<provider-encoder(7)/Names and properties>.
56
57 OSSL_DECODER_up_ref() increments the reference count for the given
58 I<decoder>.
59
60 OSSL_DECODER_free() decrements the reference count for the given
61 I<decoder>, and when the count reaches zero, frees it.
62
63 OSSL_DECODER_provider() returns the provider of the given
64 I<decoder>.
65
66 OSSL_DECODER_properties() returns the property definition associated
67 with the given I<decoder>.
68
69 OSSL_DECODER_is_a() checks if I<decoder> is an implementation
70 of an algorithm that's identifiable with I<name>.
71
72 OSSL_DECODER_number() returns the internal dynamic number assigned
73 to the given I<decoder>.
74
75 OSSL_DECODER_names_do_all() traverses all names for the given
76 I<decoder>, and calls I<fn> with each name and I<data> as arguments.
77
78 OSSL_DECODER_do_all_provided() traverses all decoder
79 implementations by all activated providers in the library context
80 I<libctx>, and for each of the implementations, calls I<fn> with the
81 implementation method and I<arg> as arguments.
82
83 OSSL_DECODER_gettable_params() returns an L<OSSL_PARAM(3)>
84 array of parameter descriptors.
85
86 OSSL_DECODER_get_params() attempts to get parameters specified
87 with an L<OSSL_PARAM(3)> array I<params>.  Parameters that the
88 implementation doesn't recognise should be ignored.
89
90 =head1 RETURN VALUES
91
92 OSSL_DECODER_fetch() returns a pointer to an OSSL_DECODER object,
93 or NULL on error.
94
95 OSSL_DECODER_up_ref() returns 1 on success, or 0 on error.
96
97 OSSL_DECODER_free() doesn't return any value.
98
99 OSSL_DECODER_provider() returns a pointer to a provider object, or
100 NULL on error.
101
102 OSSL_DECODER_properties() returns a pointer to a property
103 definition string, or NULL on error.
104
105 OSSL_DECODER_is_a() returns 1 if I<decoder> was identifiable,
106 otherwise 0.
107
108 OSSL_DECODER_number() returns an integer.
109
110 OSSL_DECODER_names_do_all() returns 1 if the callback was called for all
111 names. A return value of 0 means that the callback was not called for any names.
112
113 =head1 NOTES
114
115 OSSL_DECODER_fetch() may be called implicitly by other fetching
116 functions, using the same library context and properties.
117 Any other API that uses keys will typically do this.
118
119 =begin comment TODO(3.0) Add examples!
120
121 =head1 EXAMPLES
122
123 Text, because pod2xxx doesn't like empty sections
124
125 =end comment
126
127 =head1 SEE ALSO
128
129 L<provider(7)>, L<OSSL_DECODER_CTX(3)>, L<OSSL_DECODER_from_bio(3)>,
130 L<OSSL_DECODER_CTX_new_for_pkey(3)>, L<OSSL_LIB_CTX(3)>
131
132 =head1 HISTORY
133
134 The functions described here were added in OpenSSL 3.0.
135
136 =head1 COPYRIGHT
137
138 Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
139
140 Licensed under the Apache License 2.0 (the "License").  You may not use
141 this file except in compliance with the License.  You can obtain a copy
142 in the file LICENSE in the source distribution or at
143 L<https://www.openssl.org/source/license.html>.
144
145 =cut