Debian Codegraph @

upstream/debian-unstable/man3/X509_sign.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "X509_SIGN 3SSL"
58 .TH X509_SIGN 3SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 X509_sign, X509_sign_ctx,
65 X509_REQ_sign, X509_REQ_sign_ctx,
66 X509_ACERT_sign, X509_ACERT_sign_ctx,
67 X509_CRL_sign, X509_CRL_sign_ctx \-
68 sign certificate, certificate request, or CRL signature
69 .SH SYNOPSIS
70 .IX Header "SYNOPSIS"
71 .Vb 1
72 \& #include <openssl/x509.h>
73 \&
74 \& int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
75 \& int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);
76 \&
77 \& int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
78 \& int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);
79 \&
80 \& int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
81 \& int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);
82 \&
83 \& #include <openssl/x509_acert.h>
84 \&
85 \& int X509_ACERT_sign(X509_ACERT *x, EVP_PKEY *pkey, const EVP_MD *md);
86 \& int X509_ACERT_sign_ctx(X509_ACERT *x, EVP_MD_CTX *ctx);
87 .Ve
88 .SH DESCRIPTION
89 .IX Header "DESCRIPTION"
90 \&\fBX509_sign()\fR signs certificate \fIx\fR using private key \fIpkey\fR and message
91 digest \fImd\fR and sets the signature in \fIx\fR. \fBX509_sign_ctx()\fR also signs
92 certificate \fIx\fR but uses the parameters contained in digest context \fIctx\fR.
93 If the certificate information includes X.509 extensions,
94 these two functions make sure that the certificate bears X.509 version 3.
95 .PP
96 \&\fBX509_REQ_sign()\fR, \fBX509_REQ_sign_ctx()\fR,
97 \&\fBX509_ACERT_sign()\fR, \fBX509_ACERT_sign_ctx()\fR,
98 \&\fBX509_CRL_sign()\fR, and \fBX509_CRL_sign_ctx()\fR
99 sign certificate requests and CRLs, respectively.
100 .SH NOTES
101 .IX Header "NOTES"
102 \&\fBX509_sign_ctx()\fR is used where the default parameters for the corresponding
103 public key and digest are not suitable. It can be used to sign keys using
104 RSA-PSS for example.
105 .PP
106 For efficiency reasons and to work around ASN.1 encoding issues the encoding
107 of the signed portion of a certificate, certificate request and CRL is cached
108 internally. If the signed portion of the structure is modified the encoding
109 is not always updated meaning a stale version is sometimes used. This is not
110 normally a problem because modifying the signed portion will invalidate the
111 signature and signing will always update the encoding.
112 .SH "RETURN VALUES"
113 .IX Header "RETURN VALUES"
114 All functions return the size of the signature
115 in bytes for success and zero for failure.
116 .SH "SEE ALSO"
117 .IX Header "SEE ALSO"
118 \&\fBERR_get_error\fR\|(3),
119 \&\fBX509_NAME_add_entry_by_txt\fR\|(3),
120 \&\fBX509_new\fR\|(3),
121 \&\fBX509_verify_cert\fR\|(3),
122 \&\fBX509_verify\fR\|(3),
123 \&\fBX509_REQ_verify_ex\fR\|(3), \fBX509_REQ_verify\fR\|(3),
124 \&\fBX509_CRL_verify\fR\|(3)
125 .SH HISTORY
126 .IX Header "HISTORY"
127 The \fBX509_sign()\fR, \fBX509_REQ_sign()\fR and \fBX509_CRL_sign()\fR functions are
128 available in all versions of OpenSSL.
129 .PP
130 The \fBX509_sign_ctx()\fR, \fBX509_REQ_sign_ctx()\fR
131 and \fBX509_CRL_sign_ctx()\fR functions were added in OpenSSL 1.0.1.
132 .PP
133 The \fBX509_ACERT_sign()\fR and \fBX509_ACERT_sign_ctx()\fR functions were added
134 in OpenSSL 3.4.
135 .SH COPYRIGHT
136 .IX Header "COPYRIGHT"
137 Copyright 2015\-2024 The OpenSSL Project Authors. All Rights Reserved.
138 .PP
139 Licensed under the Apache License 2.0 (the "License"). You may not use
140 this file except in compliance with the License. You can obtain a copy
141 in the file LICENSE in the source distribution or at
142 <https://www.openssl.org/source/license.html>.