xref: /freebsd/crypto/openssl/doc/man3/d2i_RSAPrivateKey.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1*b077aed3SPierre Pronchery=pod
2*b077aed3SPierre Pronchery
3*b077aed3SPierre Pronchery=begin comment
4*b077aed3SPierre Pronchery
5*b077aed3SPierre ProncheryAny deprecated keypair/params d2i or i2d functions are collected on this page.
6*b077aed3SPierre Pronchery
7*b077aed3SPierre Pronchery=end comment
8*b077aed3SPierre Pronchery
9*b077aed3SPierre Pronchery=head1 NAME
10*b077aed3SPierre Pronchery
11*b077aed3SPierre Proncheryd2i_DSAPrivateKey,
12*b077aed3SPierre Proncheryd2i_DSAPrivateKey_bio,
13*b077aed3SPierre Proncheryd2i_DSAPrivateKey_fp,
14*b077aed3SPierre Proncheryd2i_DSAPublicKey,
15*b077aed3SPierre Proncheryd2i_DSA_PUBKEY,
16*b077aed3SPierre Proncheryd2i_DSA_PUBKEY_bio,
17*b077aed3SPierre Proncheryd2i_DSA_PUBKEY_fp,
18*b077aed3SPierre Proncheryd2i_DSAparams,
19*b077aed3SPierre Proncheryd2i_RSAPrivateKey,
20*b077aed3SPierre Proncheryd2i_RSAPrivateKey_bio,
21*b077aed3SPierre Proncheryd2i_RSAPrivateKey_fp,
22*b077aed3SPierre Proncheryd2i_RSAPublicKey,
23*b077aed3SPierre Proncheryd2i_RSAPublicKey_bio,
24*b077aed3SPierre Proncheryd2i_RSAPublicKey_fp,
25*b077aed3SPierre Proncheryd2i_RSA_PUBKEY,
26*b077aed3SPierre Proncheryd2i_RSA_PUBKEY_bio,
27*b077aed3SPierre Proncheryd2i_RSA_PUBKEY_fp,
28*b077aed3SPierre Proncheryd2i_DHparams,
29*b077aed3SPierre Proncheryd2i_DHparams_bio,
30*b077aed3SPierre Proncheryd2i_DHparams_fp,
31*b077aed3SPierre Proncheryd2i_ECPKParameters,
32*b077aed3SPierre Proncheryd2i_ECParameters,
33*b077aed3SPierre Proncheryd2i_ECPrivateKey,
34*b077aed3SPierre Proncheryd2i_ECPrivateKey_bio,
35*b077aed3SPierre Proncheryd2i_ECPrivateKey_fp,
36*b077aed3SPierre Proncheryd2i_EC_PUBKEY,
37*b077aed3SPierre Proncheryd2i_EC_PUBKEY_bio,
38*b077aed3SPierre Proncheryd2i_EC_PUBKEY_fp,
39*b077aed3SPierre Proncheryi2d_RSAPrivateKey,
40*b077aed3SPierre Proncheryi2d_RSAPrivateKey_bio,
41*b077aed3SPierre Proncheryi2d_RSAPrivateKey_fp,
42*b077aed3SPierre Proncheryi2d_RSAPublicKey,
43*b077aed3SPierre Proncheryi2d_RSAPublicKey_bio,
44*b077aed3SPierre Proncheryi2d_RSAPublicKey_fp,
45*b077aed3SPierre Proncheryi2d_RSA_PUBKEY,
46*b077aed3SPierre Proncheryi2d_RSA_PUBKEY_bio,
47*b077aed3SPierre Proncheryi2d_RSA_PUBKEY_fp,
48*b077aed3SPierre Proncheryi2d_DHparams,
49*b077aed3SPierre Proncheryi2d_DHparams_bio,
50*b077aed3SPierre Proncheryi2d_DHparams_fp,
51*b077aed3SPierre Proncheryi2d_DSAPrivateKey,
52*b077aed3SPierre Proncheryi2d_DSAPrivateKey_bio,
53*b077aed3SPierre Proncheryi2d_DSAPrivateKey_fp,
54*b077aed3SPierre Proncheryi2d_DSAPublicKey,
55*b077aed3SPierre Proncheryi2d_DSA_PUBKEY,
56*b077aed3SPierre Proncheryi2d_DSA_PUBKEY_bio,
57*b077aed3SPierre Proncheryi2d_DSA_PUBKEY_fp,
58*b077aed3SPierre Proncheryi2d_DSAparams,
59*b077aed3SPierre Proncheryi2d_ECPKParameters,
60*b077aed3SPierre Proncheryi2d_ECParameters,
61*b077aed3SPierre Proncheryi2d_ECPrivateKey,
62*b077aed3SPierre Proncheryi2d_ECPrivateKey_bio,
63*b077aed3SPierre Proncheryi2d_ECPrivateKey_fp,
64*b077aed3SPierre Proncheryi2d_EC_PUBKEY,
65*b077aed3SPierre Proncheryi2d_EC_PUBKEY_bio,
66*b077aed3SPierre Proncheryi2d_EC_PUBKEY_fp
67*b077aed3SPierre Pronchery- DEPRECATED
68*b077aed3SPierre Pronchery
69*b077aed3SPierre Pronchery=head1 SYNOPSIS
70*b077aed3SPierre Pronchery
71*b077aed3SPierre Pronchery=for openssl generic
72*b077aed3SPierre Pronchery
73*b077aed3SPierre ProncheryThe following functions have been deprecated since OpenSSL 3.0, and can be
74*b077aed3SPierre Proncheryhidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
75*b077aed3SPierre Proncherysee L<openssl_user_macros(7)>:
76*b077aed3SPierre Pronchery
77*b077aed3SPierre Pronchery TYPE *d2i_TYPEPrivateKey(TYPE **a, const unsigned char **ppin, long length);
78*b077aed3SPierre Pronchery TYPE *d2i_TYPEPrivateKey_bio(BIO *bp, TYPE **a);
79*b077aed3SPierre Pronchery TYPE *d2i_TYPEPrivateKey_fp(FILE *fp, TYPE **a);
80*b077aed3SPierre Pronchery TYPE *d2i_TYPEPublicKey(TYPE **a, const unsigned char **ppin, long length);
81*b077aed3SPierre Pronchery TYPE *d2i_TYPEPublicKey_bio(BIO *bp, TYPE **a);
82*b077aed3SPierre Pronchery TYPE *d2i_TYPEPublicKey_fp(FILE *fp, TYPE **a);
83*b077aed3SPierre Pronchery TYPE *d2i_TYPEparams(TYPE **a, const unsigned char **ppin, long length);
84*b077aed3SPierre Pronchery TYPE *d2i_TYPEparams_bio(BIO *bp, TYPE **a);
85*b077aed3SPierre Pronchery TYPE *d2i_TYPEparams_fp(FILE *fp, TYPE **a);
86*b077aed3SPierre Pronchery TYPE *d2i_TYPE_PUBKEY(TYPE **a, const unsigned char **ppin, long length);
87*b077aed3SPierre Pronchery TYPE *d2i_TYPE_PUBKEY_bio(BIO *bp, TYPE **a);
88*b077aed3SPierre Pronchery TYPE *d2i_TYPE_PUBKEY_fp(FILE *fp, TYPE **a);
89*b077aed3SPierre Pronchery
90*b077aed3SPierre Pronchery int i2d_TYPEPrivateKey(const TYPE *a, unsigned char **ppout);
91*b077aed3SPierre Pronchery int i2d_TYPEPrivateKey(TYPE *a, unsigned char **ppout);
92*b077aed3SPierre Pronchery int i2d_TYPEPrivateKey_fp(FILE *fp, const TYPE *a);
93*b077aed3SPierre Pronchery int i2d_TYPEPrivateKey_fp(FILE *fp, TYPE *a);
94*b077aed3SPierre Pronchery int i2d_TYPEPrivateKey_bio(BIO *bp, const TYPE *a);
95*b077aed3SPierre Pronchery int i2d_TYPEPrivateKey_bio(BIO *bp, TYPE *a);
96*b077aed3SPierre Pronchery int i2d_TYPEPublicKey(const TYPE *a, unsigned char **ppout);
97*b077aed3SPierre Pronchery int i2d_TYPEPublicKey(TYPE *a, unsigned char **ppout);
98*b077aed3SPierre Pronchery int i2d_TYPEPublicKey_fp(FILE *fp, const TYPE *a);
99*b077aed3SPierre Pronchery int i2d_TYPEPublicKey_fp(FILE *fp, TYPE *a);
100*b077aed3SPierre Pronchery int i2d_TYPEPublicKey_bio(BIO *bp, const TYPE *a);
101*b077aed3SPierre Pronchery int i2d_TYPEPublicKey_bio(BIO *bp, TYPE *a);
102*b077aed3SPierre Pronchery int i2d_TYPEparams(const TYPE *a, unsigned char **ppout);
103*b077aed3SPierre Pronchery int i2d_TYPEparams(TYPE *a, unsigned char **ppout);
104*b077aed3SPierre Pronchery int i2d_TYPEparams_fp(FILE *fp, const TYPE *a);
105*b077aed3SPierre Pronchery int i2d_TYPEparams_fp(FILE *fp, TYPE *a);
106*b077aed3SPierre Pronchery int i2d_TYPEparams_bio(BIO *bp, const TYPE *a);
107*b077aed3SPierre Pronchery int i2d_TYPEparams_bio(BIO *bp, TYPE *a);
108*b077aed3SPierre Pronchery int i2d_TYPE_PUBKEY(const TYPE *a, unsigned char **ppout);
109*b077aed3SPierre Pronchery int i2d_TYPE_PUBKEY(TYPE *a, unsigned char **ppout);
110*b077aed3SPierre Pronchery int i2d_TYPE_PUBKEY_fp(FILE *fp, const TYPE *a);
111*b077aed3SPierre Pronchery int i2d_TYPE_PUBKEY_fp(FILE *fp, TYPE *a);
112*b077aed3SPierre Pronchery int i2d_TYPE_PUBKEY_bio(BIO *bp, const TYPE *a);
113*b077aed3SPierre Pronchery int i2d_TYPE_PUBKEY_bio(BIO *bp, TYPE *a);
114*b077aed3SPierre Pronchery
115*b077aed3SPierre Pronchery=head1 DESCRIPTION
116*b077aed3SPierre Pronchery
117*b077aed3SPierre ProncheryAll functions described here are deprecated.  Please use L<OSSL_DECODER(3)>
118*b077aed3SPierre Proncheryinstead of the B<d2i> functions and L<OSSL_ENCODER(3)> instead of the B<i2d>
119*b077aed3SPierre Proncheryfunctions.  See L</Migration> below.
120*b077aed3SPierre Pronchery
121*b077aed3SPierre ProncheryIn the description here, B<I<TYPE>> is used a placeholder for any of the
122*b077aed3SPierre ProncheryOpenSSL datatypes, such as B<RSA>.
123*b077aed3SPierre ProncheryThe function parameters I<ppin> and I<ppout> are generally either both named
124*b077aed3SPierre ProncheryI<pp> in the headers, or I<in> and I<out>.
125*b077aed3SPierre Pronchery
126*b077aed3SPierre ProncheryAll the functions here behave the way that's described in L<d2i_X509(3)>.
127*b077aed3SPierre Pronchery
128*b077aed3SPierre ProncheryPlease note that not all functions in the synopsis are available for all key
129*b077aed3SPierre Proncherytypes.  For example, there are no d2i_RSAparams() or i2d_RSAparams(),
130*b077aed3SPierre Proncherybecause the PKCS#1 B<RSA> structure doesn't include any key parameters.
131*b077aed3SPierre Pronchery
132*b077aed3SPierre ProncheryB<d2i_I<TYPE>PrivateKey>() and derivates thereof decode DER encoded
133*b077aed3SPierre ProncheryB<I<TYPE>> private key data organized in a type specific structure.
134*b077aed3SPierre Pronchery
135*b077aed3SPierre ProncheryB<d2i_I<TYPE>PublicKey>() and derivates thereof decode DER encoded
136*b077aed3SPierre ProncheryB<I<TYPE>> public key data organized in a type specific structure.
137*b077aed3SPierre Pronchery
138*b077aed3SPierre ProncheryB<d2i_I<TYPE>params>() and derivates thereof decode DER encoded B<I<TYPE>>
139*b077aed3SPierre Proncherykey parameters organized in a type specific structure.
140*b077aed3SPierre Pronchery
141*b077aed3SPierre ProncheryB<d2i_I<TYPE>_PUBKEY>() and derivates thereof decode DER encoded B<I<TYPE>>
142*b077aed3SPierre Proncherypublic key data organized in a B<SubjectPublicKeyInfo> structure.
143*b077aed3SPierre Pronchery
144*b077aed3SPierre ProncheryB<i2d_I<TYPE>PrivateKey>() and derivates thereof encode the private key
145*b077aed3SPierre ProncheryB<I<TYPE>> data into a type specific DER encoded structure.
146*b077aed3SPierre Pronchery
147*b077aed3SPierre ProncheryB<i2d_I<TYPE>PublicKey>() and derivates thereof encode the public key
148*b077aed3SPierre ProncheryB<I<TYPE>> data into a type specific DER encoded structure.
149*b077aed3SPierre Pronchery
150*b077aed3SPierre ProncheryB<i2d_I<TYPE>params>() and derivates thereof encode the B<I<TYPE>> key
151*b077aed3SPierre Proncheryparameters data into a type specific DER encoded structure.
152*b077aed3SPierre Pronchery
153*b077aed3SPierre ProncheryB<i2d_I<TYPE>_PUBKEY>() and derivates thereof encode the public key
154*b077aed3SPierre ProncheryB<I<TYPE>> data into a DER encoded B<SubjectPublicKeyInfo> structure.
155*b077aed3SPierre Pronchery
156*b077aed3SPierre ProncheryFor example, d2i_RSAPrivateKey() and d2i_RSAPublicKey() expects the
157*b077aed3SPierre Proncherystructure defined by PKCS#1.
158*b077aed3SPierre ProncherySimilarly, i2d_RSAPrivateKey() and  i2d_RSAPublicKey() produce DER encoded
159*b077aed3SPierre Proncherystring organized according to PKCS#1.
160*b077aed3SPierre Pronchery
161*b077aed3SPierre Pronchery=head2 Migration
162*b077aed3SPierre Pronchery
163*b077aed3SPierre ProncheryMigration from the diverse B<I<TYPE>>s requires using corresponding new
164*b077aed3SPierre ProncheryOpenSSL types.  For all B<I<TYPE>>s described here, the corresponding new
165*b077aed3SPierre Proncherytype is B<EVP_PKEY>.  The rest of this section assumes that this has been
166*b077aed3SPierre Proncherydone, exactly how to do that is described elsewhere.
167*b077aed3SPierre Pronchery
168*b077aed3SPierre ProncheryThere are two migration paths:
169*b077aed3SPierre Pronchery
170*b077aed3SPierre Pronchery=over 4
171*b077aed3SPierre Pronchery
172*b077aed3SPierre Pronchery=item *
173*b077aed3SPierre Pronchery
174*b077aed3SPierre ProncheryReplace
175*b077aed3SPierre Proncheryb<d2i_I<TYPE>PrivateKey()> with L<d2i_PrivateKey(3)>,
176*b077aed3SPierre Proncheryb<d2i_I<TYPE>PublicKey()> with L<d2i_PublicKey(3)>,
177*b077aed3SPierre Proncheryb<d2i_I<TYPE>params()> with L<d2i_KeyParams(3)>,
178*b077aed3SPierre Proncheryb<d2i_I<TYPE>_PUBKEY()> with L<d2i_PUBKEY(3)>,
179*b077aed3SPierre Proncheryb<i2d_I<TYPE>PrivateKey()> with L<i2d_PrivateKey(3)>,
180*b077aed3SPierre Proncheryb<i2d_I<TYPE>PublicKey()> with L<i2d_PublicKey(3)>,
181*b077aed3SPierre Proncheryb<i2d_I<TYPE>params()> with L<i2d_KeyParams(3)>,
182*b077aed3SPierre Proncheryb<i2d_I<TYPE>_PUBKEY()> with L<i2d_PUBKEY(3)>.
183*b077aed3SPierre ProncheryA caveat is that L<i2d_PrivateKey(3)> may output a DER encoded PKCS#8
184*b077aed3SPierre Proncheryoutermost structure instead of the type specific structure, and that
185*b077aed3SPierre ProncheryL<d2i_PrivateKey(3)> recognises and unpacks a PKCS#8 structures.
186*b077aed3SPierre Pronchery
187*b077aed3SPierre Pronchery=item *
188*b077aed3SPierre Pronchery
189*b077aed3SPierre ProncheryUse L<OSSL_DECODER(3)> and L<OSSL_ENCODER(3)>.  How to migrate is described
190*b077aed3SPierre Proncherybelow.  All those descriptions assume that the key to be encoded is in the
191*b077aed3SPierre Proncheryvariable I<pkey>.
192*b077aed3SPierre Pronchery
193*b077aed3SPierre Pronchery=back
194*b077aed3SPierre Pronchery
195*b077aed3SPierre Pronchery=head3 Migrating B<i2d> functions to B<OSSL_ENCODER>
196*b077aed3SPierre Pronchery
197*b077aed3SPierre ProncheryThe exact L<OSSL_ENCODER(3)> output is driven by arguments rather than by
198*b077aed3SPierre Proncheryfunction names.  The sample code to get DER encoded output in a type
199*b077aed3SPierre Proncheryspecific structure is uniform, the only things that vary are the selection
200*b077aed3SPierre Proncheryof what part of the B<EVP_PKEY> should be output, and the structure.  The
201*b077aed3SPierre ProncheryB<i2d> functions names can therefore be translated into two variables,
202*b077aed3SPierre ProncheryI<selection> and I<structure> as follows:
203*b077aed3SPierre Pronchery
204*b077aed3SPierre Pronchery=over 4
205*b077aed3SPierre Pronchery
206*b077aed3SPierre Pronchery=item B<i2d_I<TYPE>PrivateKey>() translates into:
207*b077aed3SPierre Pronchery
208*b077aed3SPierre Pronchery int selection = EVP_PKEY_PRIVATE_KEY;
209*b077aed3SPierre Pronchery const char *structure = "type-specific";
210*b077aed3SPierre Pronchery
211*b077aed3SPierre Pronchery=item B<i2d_I<TYPE>PublicKey>() translates into:
212*b077aed3SPierre Pronchery
213*b077aed3SPierre Pronchery int selection = EVP_PKEY_PUBLIC_KEY;
214*b077aed3SPierre Pronchery const char *structure = "type-specific";
215*b077aed3SPierre Pronchery
216*b077aed3SPierre Pronchery=item B<i2d_I<TYPE>params>() translates into:
217*b077aed3SPierre Pronchery
218*b077aed3SPierre Pronchery int selection = EVP_PKEY_PARAMETERS;
219*b077aed3SPierre Pronchery const char *structure = "type-specific";
220*b077aed3SPierre Pronchery
221*b077aed3SPierre Pronchery=item B<i2d_I<TYPE>_PUBKEY>() translates into:
222*b077aed3SPierre Pronchery
223*b077aed3SPierre Pronchery int selection = EVP_PKEY_PUBLIC_KEY;
224*b077aed3SPierre Pronchery const char *structure = "SubjectPublicKeyInfo";
225*b077aed3SPierre Pronchery
226*b077aed3SPierre Pronchery=back
227*b077aed3SPierre Pronchery
228*b077aed3SPierre ProncheryThe following sample code does the rest of the work:
229*b077aed3SPierre Pronchery
230*b077aed3SPierre Pronchery unsigned char *p = buffer;     /* |buffer| is supplied by the caller */
231*b077aed3SPierre Pronchery size_t len = buffer_size;      /* assumed be the size of |buffer| */
232*b077aed3SPierre Pronchery OSSL_ENCODER_CTX *ctx =
233*b077aed3SPierre Pronchery     OSSL_ENCODER_CTX_new_for_pkey(pkey, selection, "DER", structure,
234*b077aed3SPierre Pronchery                                   NULL, NULL);
235*b077aed3SPierre Pronchery if (ctx == NULL) {
236*b077aed3SPierre Pronchery     /* fatal error handling */
237*b077aed3SPierre Pronchery }
238*b077aed3SPierre Pronchery if (OSSL_ENCODER_CTX_get_num_encoders(ctx) == 0) {
239*b077aed3SPierre Pronchery     OSSL_ENCODER_CTX_free(ctx);
240*b077aed3SPierre Pronchery     /* non-fatal error handling */
241*b077aed3SPierre Pronchery }
242*b077aed3SPierre Pronchery if (!OSSL_ENCODER_to_data(ctx, &p, &len)) {
243*b077aed3SPierre Pronchery     OSSL_ENCODER_CTX_free(ctx);
244*b077aed3SPierre Pronchery     /* error handling */
245*b077aed3SPierre Pronchery }
246*b077aed3SPierre Pronchery OSSL_ENCODER_CTX_free(ctx);
247*b077aed3SPierre Pronchery
248*b077aed3SPierre Pronchery=for comment TODO: a similar section on OSSL_DECODER is to be added
249*b077aed3SPierre Pronchery
250*b077aed3SPierre Pronchery=head1 NOTES
251*b077aed3SPierre Pronchery
252*b077aed3SPierre ProncheryThe letters B<i> and B<d> in B<i2d_I<TYPE>>() stand for
253*b077aed3SPierre Pronchery"internal" (that is, an internal C structure) and "DER" respectively.
254*b077aed3SPierre ProncherySo B<i2d_I<TYPE>>() converts from internal to DER.
255*b077aed3SPierre Pronchery
256*b077aed3SPierre ProncheryThe functions can also understand B<BER> forms.
257*b077aed3SPierre Pronchery
258*b077aed3SPierre ProncheryThe actual TYPE structure passed to B<i2d_I<TYPE>>() must be a valid
259*b077aed3SPierre Proncherypopulated B<I<TYPE>> structure -- it B<cannot> simply be fed with an
260*b077aed3SPierre Proncheryempty structure such as that returned by TYPE_new().
261*b077aed3SPierre Pronchery
262*b077aed3SPierre ProncheryThe encoded data is in binary form and may contain embedded zeros.
263*b077aed3SPierre ProncheryTherefore, any FILE pointers or BIOs should be opened in binary mode.
264*b077aed3SPierre ProncheryFunctions such as strlen() will B<not> return the correct length
265*b077aed3SPierre Proncheryof the encoded structure.
266*b077aed3SPierre Pronchery
267*b077aed3SPierre ProncheryThe ways that I<*ppin> and I<*ppout> are incremented after the operation
268*b077aed3SPierre Proncherycan trap the unwary. See the B<WARNINGS> section in L<d2i_X509(3)> for some
269*b077aed3SPierre Proncherycommon errors.
270*b077aed3SPierre ProncheryThe reason for this-auto increment behaviour is to reflect a typical
271*b077aed3SPierre Proncheryusage of ASN1 functions: after one structure is encoded or decoded
272*b077aed3SPierre Proncheryanother will be processed after it.
273*b077aed3SPierre Pronchery
274*b077aed3SPierre ProncheryThe following points about the data types might be useful:
275*b077aed3SPierre Pronchery
276*b077aed3SPierre Pronchery=over 4
277*b077aed3SPierre Pronchery
278*b077aed3SPierre Pronchery=item B<DSA_PUBKEY>
279*b077aed3SPierre Pronchery
280*b077aed3SPierre ProncheryRepresents a DSA public key using a B<SubjectPublicKeyInfo> structure.
281*b077aed3SPierre Pronchery
282*b077aed3SPierre Pronchery=item B<DSAPublicKey>, B<DSAPrivateKey>
283*b077aed3SPierre Pronchery
284*b077aed3SPierre ProncheryUse a non-standard OpenSSL format and should be avoided; use B<DSA_PUBKEY>,
285*b077aed3SPierre ProncheryL<PEM_write_PrivateKey(3)>, or similar instead.
286*b077aed3SPierre Pronchery
287*b077aed3SPierre Pronchery=back
288*b077aed3SPierre Pronchery
289*b077aed3SPierre Pronchery=head1 RETURN VALUES
290*b077aed3SPierre Pronchery
291*b077aed3SPierre ProncheryB<d2i_I<TYPE>>(), B<d2i_I<TYPE>_bio>() and B<d2i_I<TYPE>_fp>() return a valid
292*b077aed3SPierre ProncheryB<I<TYPE>> structure or NULL if an error occurs.  If the "reuse" capability has
293*b077aed3SPierre Proncherybeen used with a valid structure being passed in via I<a>, then the object is
294*b077aed3SPierre Proncheryfreed in the event of error and I<*a> is set to NULL.
295*b077aed3SPierre Pronchery
296*b077aed3SPierre ProncheryB<i2d_I<TYPE>>() returns the number of bytes successfully encoded or a negative
297*b077aed3SPierre Proncheryvalue if an error occurs.
298*b077aed3SPierre Pronchery
299*b077aed3SPierre ProncheryB<i2d_I<TYPE>_bio>() and B<i2d_I<TYPE>_fp>() return 1 for success and 0 if an
300*b077aed3SPierre Proncheryerror occurs.
301*b077aed3SPierre Pronchery
302*b077aed3SPierre Pronchery=head1 SEE ALSO
303*b077aed3SPierre Pronchery
304*b077aed3SPierre ProncheryL<OSSL_ENCODER(3)>, L<OSSL_DECODER(3)>,
305*b077aed3SPierre ProncheryL<d2i_PrivateKey(3)>, L<d2i_PublicKey(3)>, L<d2i_KeyParams(3)>,
306*b077aed3SPierre ProncheryL<d2i_PUBKEY(3)>,
307*b077aed3SPierre ProncheryL<i2d_PrivateKey(3)>, L<i2d_PublicKey(3)>, L<i2d_KeyParams(3)>,
308*b077aed3SPierre ProncheryL<i2d_PUBKEY(3)>
309*b077aed3SPierre Pronchery
310*b077aed3SPierre Pronchery=head1 COPYRIGHT
311*b077aed3SPierre Pronchery
312*b077aed3SPierre ProncheryCopyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
313*b077aed3SPierre Pronchery
314*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
315*b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
316*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
317*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
318*b077aed3SPierre Pronchery
319*b077aed3SPierre Pronchery=cut
320