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