X509_sign.pod 2.5 KB

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