1X509_SIGN(3ossl)                    OpenSSL                   X509_SIGN(3ossl)
2
3
4

NAME

6       X509_sign, X509_sign_ctx, X509_REQ_sign, X509_REQ_sign_ctx,
7       X509_CRL_sign, X509_CRL_sign_ctx - sign certificate, certificate
8       request, or CRL signature
9

SYNOPSIS

11        #include <openssl/x509.h>
12
13        int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
14        int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);
15
16        int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
17        int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);
18
19        int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
20        int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);
21

DESCRIPTION

23       X509_sign() signs certificate x using private key pkey and message
24       digest md and sets the signature in x. X509_sign_ctx() also signs
25       certificate x but uses the parameters contained in digest context ctx.
26
27       X509_REQ_sign(), X509_REQ_sign_ctx(), X509_CRL_sign(), and
28       X509_CRL_sign_ctx() sign certificate requests and CRLs, respectively.
29

NOTES

31       X509_sign_ctx() is used where the default parameters for the
32       corresponding public key and digest are not suitable. It can be used to
33       sign keys using RSA-PSS for example.
34
35       For efficiency reasons and to work around ASN.1 encoding issues the
36       encoding of the signed portion of a certificate, certificate request
37       and CRL is cached internally. If the signed portion of the structure is
38       modified the encoding is not always updated meaning a stale version is
39       sometimes used. This is not normally a problem because modifying the
40       signed portion will invalidate the signature and signing will always
41       update the encoding.
42

RETURN VALUES

44       All functions return the size of the signature in bytes for success and
45       zero for failure.
46

SEE ALSO

48       ERR_get_error(3), X509_NAME_add_entry_by_txt(3), X509_new(3),
49       X509_verify_cert(3), X509_verify(3), X509_REQ_verify_ex(3),
50       X509_REQ_verify(3), X509_CRL_verify(3)
51

HISTORY

53       The X509_sign(), X509_REQ_sign() and X509_CRL_sign() functions are
54       available in all versions of OpenSSL.
55
56       The X509_sign_ctx(), X509_REQ_sign_ctx() and X509_CRL_sign_ctx()
57       functions were added in OpenSSL 1.0.1.
58
60       Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
61
62       Licensed under the Apache License 2.0 (the "License").  You may not use
63       this file except in compliance with the License.  You can obtain a copy
64       in the file LICENSE in the source distribution or at
65       <https://www.openssl.org/source/license.html>.
66
67
68
693.1.1                             2023-08-31                  X509_SIGN(3ossl)
Impressum