1.\" $OpenBSD: X509_get0_signature.3,v 1.6 2020/06/24 19:55:55 schwarze Exp $
2.\" selective merge up to:
3.\" OpenSSL man3/X509_get0_signature 2f7a2520 Apr 25 17:28:08 2017 +0100
4.\"
5.\" This file is a derived work.
6.\" The changes are covered by the following Copyright and license:
7.\"
8.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org>
9.\"
10.\" Permission to use, copy, modify, and distribute this software for any
11.\" purpose with or without fee is hereby granted, provided that the above
12.\" copyright notice and this permission notice appear in all copies.
13.\"
14.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21.\"
22.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
23.\" Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
24.\"
25.\" Redistribution and use in source and binary forms, with or without
26.\" modification, are permitted provided that the following conditions
27.\" are met:
28.\"
29.\" 1. Redistributions of source code must retain the above copyright
30.\"    notice, this list of conditions and the following disclaimer.
31.\"
32.\" 2. Redistributions in binary form must reproduce the above copyright
33.\"    notice, this list of conditions and the following disclaimer in
34.\"    the documentation and/or other materials provided with the
35.\"    distribution.
36.\"
37.\" 3. All advertising materials mentioning features or use of this
38.\"    software must display the following acknowledgment:
39.\"    "This product includes software developed by the OpenSSL Project
40.\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
41.\"
42.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
43.\"    endorse or promote products derived from this software without
44.\"    prior written permission. For written permission, please contact
45.\"    openssl-core@openssl.org.
46.\"
47.\" 5. Products derived from this software may not be called "OpenSSL"
48.\"    nor may "OpenSSL" appear in their names without prior written
49.\"    permission of the OpenSSL Project.
50.\"
51.\" 6. Redistributions of any form whatsoever must retain the following
52.\"    acknowledgment:
53.\"    "This product includes software developed by the OpenSSL Project
54.\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
55.\"
56.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
57.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
58.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
59.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
60.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
61.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
62.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
63.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
64.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
65.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
66.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\"
69.Dd $Mdocdate: June 24 2020 $
70.Dt X509_GET0_SIGNATURE 3
71.Os
72.Sh NAME
73.Nm X509_get0_signature ,
74.Nm X509_REQ_get0_signature ,
75.Nm X509_CRL_get0_signature ,
76.Nm X509_get0_tbs_sigalg ,
77.Nm X509_get_signature_type ,
78.Nm X509_get_signature_nid ,
79.Nm X509_REQ_get_signature_nid ,
80.Nm X509_CRL_get_signature_nid
81.Nd signature information
82.Sh SYNOPSIS
83.In openssl/x509.h
84.Ft void
85.Fo X509_get0_signature
86.Fa "const ASN1_BIT_STRING **psig"
87.Fa "const X509_ALGOR **palg"
88.Fa "const X509 *x"
89.Fc
90.Ft void
91.Fo X509_REQ_get0_signature
92.Fa "const X509_REQ *req"
93.Fa "const ASN1_BIT_STRING **psig"
94.Fa "const X509_ALGOR **palg"
95.Fc
96.Ft void
97.Fo X509_CRL_get0_signature
98.Fa "const X509_CRL *crl"
99.Fa "const ASN1_BIT_STRING **psig"
100.Fa "const X509_ALGOR **palg"
101.Fc
102.Ft const X509_ALGOR *
103.Fo X509_get0_tbs_sigalg
104.Fa "const X509 *x"
105.Fc
106.Ft int
107.Fo X509_get_signature_type
108.Fa "const X509 *x"
109.Fc
110.Ft int
111.Fo X509_get_signature_nid
112.Fa "const X509 *x"
113.Fc
114.Ft int
115.Fo X509_REQ_get_signature_nid
116.Fa "const X509_REQ *req"
117.Fc
118.Ft int
119.Fo X509_CRL_get_signature_nid
120.Fa "const X509_CRL *crl"
121.Fc
122.Sh DESCRIPTION
123.Fn X509_get0_signature ,
124.Fn X509_REQ_get0_signature ,
125and
126.Fn X509_CRL_get0_signature
127set
128.Pf * Fa psig
129to the signature and
130.Pf * Fa palg
131to the signature algorithm of
132.Fa x ,
133.Fa req ,
134or
135.Fa crl ,
136respectively.
137.Fn X509_get0_tbs_sigalg
138returns the signature algorithm in the signed portion of
139.Fa x .
140The values returned are internal pointers
141that must not be freed by the caller.
142.Pp
143.Fn X509_get_signature_type
144returns the base NID corresponding to the signature algorithm of
145.Fa x
146just like
147.Xr EVP_PKEY_base_id 3
148does.
149.Pp
150.Fn X509_get_signature_nid ,
151.Fn X509_REQ_get_signature_nid ,
152and
153.Fn X509_CRL_get_signature_nid
154return the NID corresponding to the signature algorithm of
155.Fa x ,
156.Fa req ,
157or
158.Fa crl ,
159respectively, just like
160.Xr EVP_PKEY_id 3
161does.
162.Pp
163These functions provide lower level access to the signature
164for cases where an application wishes to analyse or generate a
165signature in a form where
166.Xr X509_sign 3
167is not appropriate, for example in a non-standard or unsupported format.
168.Sh SEE ALSO
169.Xr EVP_PKEY_base_id 3 ,
170.Xr OBJ_obj2nid 3 ,
171.Xr X509_ALGOR_new 3 ,
172.Xr X509_CRL_get0_by_serial 3 ,
173.Xr X509_CRL_new 3 ,
174.Xr X509_get_pubkey 3 ,
175.Xr X509_get_subject_name 3 ,
176.Xr X509_get_version 3 ,
177.Xr X509_new 3 ,
178.Xr X509_REQ_new 3 ,
179.Xr X509_sign 3 ,
180.Xr X509_verify_cert 3
181.Sh HISTORY
182.Fn X509_get_signature_type
183first appeared in SSLeay 0.8.0 and has been available since
184.Ox 2.4 .
185.Pp
186.Fn X509_get0_signature
187and
188.Fn X509_get_signature_nid
189first appeared in OpenSSL 1.0.2.
190.Fn X509_REQ_get0_signature ,
191.Fn X509_CRL_get0_signature ,
192.Fn X509_get0_tbs_sigalg ,
193.Fn X509_REQ_get_signature_nid ,
194and
195.Fn X509_CRL_get_signature_nid
196first appeared in OpenSSL 1.1.0.
197All these functions have been available since
198.Ox 6.3 .
199