X509_sign.pod 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. X509_REQ_sign(), X509_REQ_sign_ctx(),
  20. X509_CRL_sign(), and X509_CRL_sign_ctx()
  21. sign certificate requests and CRLs, respectively.
  22. =head1 NOTES
  23. X509_sign_ctx() is used where the default parameters for the corresponding
  24. public key and digest are not suitable. It can be used to sign keys using
  25. RSA-PSS for example.
  26. For efficiency reasons and to work around ASN.1 encoding issues the encoding
  27. of the signed portion of a certificate, certificate request and CRL is cached
  28. internally. If the signed portion of the structure is modified the encoding
  29. is not always updated meaning a stale version is sometimes used. This is not
  30. normally a problem because modifying the signed portion will invalidate the
  31. signature and signing will always update the encoding.
  32. =head1 RETURN VALUES
  33. All functions return the size of the signature
  34. in bytes for success and zero for failure.
  35. =head1 SEE ALSO
  36. L<ERR_get_error(3)>,
  37. L<X509_NAME_add_entry_by_txt(3)>,
  38. L<X509_new(3)>,
  39. L<X509_verify_cert(3)>,
  40. L<X509_verify(3)>,
  41. L<X509_REQ_verify_ex(3)>, L<X509_REQ_verify(3)>,
  42. L<X509_CRL_verify(3)>
  43. =head1 HISTORY
  44. The X509_sign(), X509_REQ_sign() and X509_CRL_sign() functions are
  45. available in all versions of OpenSSL.
  46. The X509_sign_ctx(), X509_REQ_sign_ctx()
  47. and X509_CRL_sign_ctx() functions were added in OpenSSL 1.0.1.
  48. =head1 COPYRIGHT
  49. Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
  50. Licensed under the Apache License 2.0 (the "License"). You may not use
  51. this file except in compliance with the License. You can obtain a copy
  52. in the file LICENSE in the source distribution or at
  53. L<https://www.openssl.org/source/license.html>.
  54. =cut