1 .\" $OpenBSD: d2i_DSAPublicKey.3,v 1.8 2016/12/25 14:38:55 schwarze Exp $
2 .\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400
4 .\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5 .\" Copyright (c) 2002, 2003, 2013, 2015, 2016 The OpenSSL Project.
6 .\" All rights reserved.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in
17 .\" the documentation and/or other materials provided with the
20 .\" 3. All advertising materials mentioning features or use of this
21 .\" software must display the following acknowledgment:
22 .\" "This product includes software developed by the OpenSSL Project
23 .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
25 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 .\" endorse or promote products derived from this software without
27 .\" prior written permission. For written permission, please contact
28 .\" openssl-core@openssl.org.
30 .\" 5. Products derived from this software may not be called "OpenSSL"
31 .\" nor may "OpenSSL" appear in their names without prior written
32 .\" permission of the OpenSSL Project.
34 .\" 6. Redistributions of any form whatsoever must retain the following
36 .\" "This product includes software developed by the OpenSSL Project
37 .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
39 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
52 .Dd $Mdocdate: December 25 2016 $
53 .Dt D2I_DSAPUBLICKEY 3
56 .Nm d2i_DSAPublicKey ,
57 .Nm i2d_DSAPublicKey ,
60 .Nm d2i_DSA_PUBKEY_bio ,
61 .Nm d2i_DSA_PUBKEY_fp ,
62 .Nm i2d_DSA_PUBKEY_bio ,
63 .Nm i2d_DSA_PUBKEY_fp ,
64 .Nm d2i_DSAPrivateKey ,
65 .Nm i2d_DSAPrivateKey ,
66 .Nm d2i_DSAPrivateKey_bio ,
67 .Nm d2i_DSAPrivateKey_fp ,
68 .Nm i2d_DSAPrivateKey_bio ,
69 .Nm i2d_DSAPrivateKey_fp ,
75 .Nd decode and encode DSA keys
81 .Fa "const unsigned char **der_in"
86 .Fa "const DSA *val_in"
87 .Fa "unsigned char **der_out"
92 .Fa "const unsigned char **der_in"
97 .Fa "const DSA *val_in"
98 .Fa "unsigned char **der_out"
101 .Fo d2i_DSA_PUBKEY_bio
106 .Fo d2i_DSA_PUBKEY_fp
111 .Fo i2d_DSA_PUBKEY_bio
116 .Fo i2d_DSA_PUBKEY_fp
121 .Fo d2i_DSAPrivateKey
123 .Fa "const unsigned char **der_in"
127 .Fo i2d_DSAPrivateKey
128 .Fa "const DSA *val_in"
129 .Fa "unsigned char **der_out"
132 .Fo d2i_DSAPrivateKey_bio
137 .Fo d2i_DSAPrivateKey_fp
142 .Fo i2d_DSAPrivateKey_bio
147 .Fo i2d_DSAPrivateKey_fp
154 .Fa "const unsigned char **der_in"
159 .Fa "const DSA *val_in"
160 .Fa "unsigned char **der_out"
168 .Fa "DSA_SIG **val_out"
169 .Fa "const unsigned char **der_in"
174 .Fa "const DSA_SIG *val_in"
175 .Fa "unsigned char **der_out"
178 These functions decode and encode DSA keys and parameters.
179 For details about the semantics, examples, caveats, and bugs, see
180 .Xr ASN1_item_d2i 3 .
185 decode and encode the DSA public key components using a non-standard
186 format, so consider using
191 The actual data encoded depends on the value of
192 .Fa val_in->write_params .
194 .Fa val_in->write_params
197 field is encoded as an ASN.1 INTEGER.
199 .Fa val_in->write_params
200 is 1, then a SEQUENCE consisting of the
211 decode and encode a DSA public key using an ASN.1
212 .Vt SubjectPublicKeyInfo
213 structure defined in RFC 5280 section 4.1
215 .Xr X509_PUBKEY_new 3 .
216 .Fn d2i_DSA_PUBKEY_bio ,
217 .Fn d2i_DSA_PUBKEY_fp ,
218 .Fn i2d_DSA_PUBKEY_bio ,
220 .Fn i2d_DSA_PUBKEY_fp
221 are similar except that they decode or encode using a
227 .Fn d2i_DSAPrivateKey
229 .Fn i2d_DSAPrivateKey
230 decode and encode the DSA private key components.
233 object passed to the private key encoding functions should have all
234 the private key components present.
235 These functions use a non-standard structure consisting of a
236 SEQUENCE containing the
240 .Fa val_in->pub_key ,
244 This data format is unencrypted.
245 For private key security when writing private keys to files,
247 .Xr PEM_write_DSAPrivateKey 3
250 .Fn d2i_DSAPrivateKey_bio ,
251 .Fn d2i_DSAPrivateKey_fp ,
252 .Fn i2d_DSAPrivateKey_bio ,
254 .Fn i2d_DSAPrivateKey_fp
255 are similar except that they decode or encode using a
264 decode and encode the DSA parameters using an ASN.1
266 structure defined in RFC 3279 section 2.3.2
267 and used for the parameters field of the ASN.1
268 .Vt AlgorithmIdentifier
269 structure defined in RFC 5280 section 4.1.1.2.
272 allocates and initializes an empty
274 object and copies the DSA parameters from
280 If a private or public key are present in
287 decode and encode a DSA signature using an ASN.1
289 structure as defined in RFC 3279 section 2.2.2
290 and used for the signatureValue field of the ASN.1
292 structure described in RFC 5280 sections 4.1.1.3 and 5.1.1.3.
294 .Fn d2i_DSAPublicKey ,
296 .Fn d2i_DSA_PUBKEY_bio ,
297 .Fn d2i_DSA_PUBKEY_fp ,
298 .Fn d2i_DSAPrivateKey ,
299 .Fn d2i_DSAPrivateKey_bio ,
300 .Fn d2i_DSAPrivateKey_fp ,
317 .Xr ASN1_item_d2i 3 ,
320 .Xr EVP_PKEY_set1_DSA 3 ,
321 .Xr PEM_write_DSAPrivateKey 3 ,
322 .Xr X509_PUBKEY_new 3
324 RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
325 Certificate Revocation List (CRL) Profile,
326 section 4.1: Basic Certificate Fields
328 RFC 3279: Algorithms and Identifiers for the Internet X.509 Public
329 Key Infrastructure Certificate and Certificate Revocation List (CRL)
333 section 2.2.2: DSA Signature Algorithm
335 section 2.3.2: DSA Signature Keys