5 X509_sign, X509_sign_ctx,
6 X509_REQ_sign, X509_REQ_sign_ctx,
7 X509_CRL_sign, X509_CRL_sign_ctx -
8 sign certificate, certificate request, or CRL signature
12 #include <openssl/x509.h>
14 int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
15 int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);
17 int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
18 int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);
20 int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
21 int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);
25 X509_sign() signs certificate I<x> using private key I<pkey> and message
26 digest I<md> and sets the signature in I<x>. X509_sign_ctx() also signs
27 certificate I<x> but uses the parameters contained in digest context I<ctx>.
29 X509_REQ_sign(), X509_REQ_sign_ctx(),
30 X509_CRL_sign(), and X509_CRL_sign_ctx()
31 sign certificate requests and CRLs, respectively.
35 X509_sign_ctx() is used where the default parameters for the corresponding
36 public key and digest are not suitable. It can be used to sign keys using
39 For efficiency reasons and to work around ASN.1 encoding issues the encoding
40 of the signed portion of a certificate, certificate request and CRL is cached
41 internally. If the signed portion of the structure is modified the encoding
42 is not always updated meaning a stale version is sometimes used. This is not
43 normally a problem because modifying the signed portion will invalidate the
44 signature and signing will always update the encoding.
48 All functions return the size of the signature
49 in bytes for success and zero for failure.
54 L<X509_NAME_add_entry_by_txt(3)>,
56 L<X509_verify_cert(3)>,
58 L<X509_REQ_verify_with_libctx(3)>, L<X509_REQ_verify(3)>,
63 The X509_sign(), X509_REQ_sign() and X509_CRL_sign() functions are
64 available in all versions of OpenSSL.
66 The X509_sign_ctx(), X509_REQ_sign_ctx()
67 and X509_CRL_sign_ctx() functions were added in OpenSSL 1.0.1.
71 Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
73 Licensed under the Apache License 2.0 (the "License"). You may not use
74 this file except in compliance with the License. You can obtain a copy
75 in the file LICENSE in the source distribution or at
76 L<https://www.openssl.org/source/license.html>.