1 1.1 christos =pod 2 1.1 christos 3 1.1 christos =head1 NAME 4 1.1 christos 5 1.1.1.3 christos X509_sign, X509_sign_ctx, 6 1.1.1.3 christos X509_REQ_sign, X509_REQ_sign_ctx, 7 1.1.1.3 christos X509_CRL_sign, X509_CRL_sign_ctx - 8 1.1.1.3 christos sign certificate, certificate request, or CRL signature 9 1.1 christos 10 1.1 christos =head1 SYNOPSIS 11 1.1 christos 12 1.1 christos #include <openssl/x509.h> 13 1.1 christos 14 1.1 christos int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); 15 1.1 christos int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx); 16 1.1 christos 17 1.1 christos int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); 18 1.1 christos int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx); 19 1.1 christos 20 1.1 christos int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); 21 1.1 christos int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx); 22 1.1 christos 23 1.1 christos =head1 DESCRIPTION 24 1.1 christos 25 1.1.1.3 christos X509_sign() signs certificate I<x> using private key I<pkey> and message 26 1.1.1.3 christos digest I<md> and sets the signature in I<x>. X509_sign_ctx() also signs 27 1.1.1.3 christos certificate I<x> but uses the parameters contained in digest context I<ctx>. 28 1.1.1.3 christos 29 1.1.1.3 christos X509_REQ_sign(), X509_REQ_sign_ctx(), 30 1.1.1.3 christos X509_CRL_sign(), and X509_CRL_sign_ctx() 31 1.1.1.3 christos sign certificate requests and CRLs, respectively. 32 1.1 christos 33 1.1 christos =head1 NOTES 34 1.1 christos 35 1.1 christos X509_sign_ctx() is used where the default parameters for the corresponding 36 1.1 christos public key and digest are not suitable. It can be used to sign keys using 37 1.1 christos RSA-PSS for example. 38 1.1 christos 39 1.1 christos For efficiency reasons and to work around ASN.1 encoding issues the encoding 40 1.1 christos of the signed portion of a certificate, certificate request and CRL is cached 41 1.1 christos internally. If the signed portion of the structure is modified the encoding 42 1.1 christos is not always updated meaning a stale version is sometimes used. This is not 43 1.1 christos normally a problem because modifying the signed portion will invalidate the 44 1.1 christos signature and signing will always update the encoding. 45 1.1 christos 46 1.1 christos =head1 RETURN VALUES 47 1.1 christos 48 1.1.1.3 christos All functions return the size of the signature 49 1.1 christos in bytes for success and zero for failure. 50 1.1 christos 51 1.1 christos =head1 SEE ALSO 52 1.1 christos 53 1.1 christos L<ERR_get_error(3)>, 54 1.1 christos L<X509_NAME_add_entry_by_txt(3)>, 55 1.1 christos L<X509_new(3)>, 56 1.1.1.3 christos L<X509_verify_cert(3)>, 57 1.1.1.3 christos L<X509_verify(3)>, 58 1.1.1.3 christos L<X509_REQ_verify_ex(3)>, L<X509_REQ_verify(3)>, 59 1.1.1.3 christos L<X509_CRL_verify(3)> 60 1.1 christos 61 1.1 christos =head1 HISTORY 62 1.1 christos 63 1.1.1.2 christos The X509_sign(), X509_REQ_sign() and X509_CRL_sign() functions are 64 1.1.1.2 christos available in all versions of OpenSSL. 65 1.1 christos 66 1.1.1.2 christos The X509_sign_ctx(), X509_REQ_sign_ctx() 67 1.1.1.3 christos and X509_CRL_sign_ctx() functions were added in OpenSSL 1.0.1. 68 1.1 christos 69 1.1 christos =head1 COPYRIGHT 70 1.1 christos 71 1.1.1.3 christos Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved. 72 1.1 christos 73 1.1.1.3 christos Licensed under the Apache License 2.0 (the "License"). You may not use 74 1.1 christos this file except in compliance with the License. You can obtain a copy 75 1.1 christos in the file LICENSE in the source distribution or at 76 1.1 christos L<https://www.openssl.org/source/license.html>. 77 1.1 christos 78 1.1 christos =cut 79