X509_STORE_add_cert.pod 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. =pod
  2. =head1 NAME
  3. X509_STORE_add_cert, X509_STORE_add_crl, X509_STORE_set_depth,
  4. X509_STORE_set_flags, X509_STORE_set_purpose, X509_STORE_set_trust,
  5. X509_STORE_load_locations,
  6. X509_STORE_set_default_paths
  7. - X509_STORE manipulation
  8. =head1 SYNOPSIS
  9. #include <openssl/x509_vfy.h>
  10. int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
  11. int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
  12. int X509_STORE_set_depth(X509_STORE *store, int depth);
  13. int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);
  14. int X509_STORE_set_purpose(X509_STORE *ctx, int purpose);
  15. int X509_STORE_set_trust(X509_STORE *ctx, int trust);
  16. int X509_STORE_load_locations(X509_STORE *ctx,
  17. const char *file, const char *dir);
  18. int X509_STORE_set_default_paths(X509_STORE *ctx);
  19. =head1 DESCRIPTION
  20. The B<X509_STORE> structure is intended to be a consolidated mechanism for
  21. holding information about X.509 certificates and CRLs, and constructing
  22. and validating chains of certificates terminating in trusted roots.
  23. It admits multiple lookup mechanisms and efficient scaling performance
  24. with large numbers of certificates, and a great deal of flexibility in
  25. how validation and policy checks are performed.
  26. L<X509_STORE_new(3)> creates an empty B<X509_STORE> structure, which contains
  27. no information about trusted certificates or where such certificates
  28. are located on disk, and is generally not usable. Normally, trusted
  29. certificates will be added to the B<X509_STORE> to prepare it for use,
  30. via mechanisms such as X509_STORE_add_lookup() and X509_LOOKUP_file(), or
  31. PEM_read_bio_X509_AUX() and X509_STORE_add_cert(). CRLs can also be added,
  32. and many behaviors configured as desired.
  33. Once the B<X509_STORE> is suitably configured, X509_STORE_CTX_new() is
  34. used to instantiate a single-use B<X509_STORE_CTX> for each chain-building
  35. and verification operation. That process includes providing the end-entity
  36. certificate to be verified and an additional set of untrusted certificates
  37. that may be used in chain-building. As such, it is expected that the
  38. certificates included in the B<X509_STORE> are certificates that represent
  39. trusted entities such as root certificate authorities (CAs).
  40. OpenSSL represents these trusted certificates internally as B<X509> objects
  41. with an associated B<X509_CERT_AUX>, as are produced by
  42. PEM_read_bio_X509_AUX() and similar routines that refer to X509_AUX.
  43. The public interfaces that operate on such trusted certificates still
  44. operate on pointers to B<X509> objects, though.
  45. X509_STORE_add_cert() and X509_STORE_add_crl() add the respective object
  46. to the B<X509_STORE>'s local storage. Untrusted objects should not be
  47. added in this way.
  48. X509_STORE_set_depth(), X509_STORE_set_flags(), X509_STORE_set_purpose(),
  49. X509_STORE_set_trust(), and X509_STORE_set1_param() set the default values
  50. for the corresponding values used in certificate chain validation. Their
  51. behavior is documented in the corresponding B<X509_VERIFY_PARAM> manual
  52. pages, e.g., L<X509_VERIFY_PARAM_set_depth(3)>.
  53. X509_STORE_load_locations() loads trusted certificate(s) into an
  54. B<X509_STORE> from a given file and/or directory path. It is permitted
  55. to specify just a file, just a directory, or both paths. The certificates
  56. in the directory must be in hashed form, as documented in
  57. L<X509_LOOKUP_hash_dir(3)>.
  58. X509_STORE_set_default_paths() is somewhat misnamed, in that it does not
  59. set what default paths should be used for loading certificates. Instead,
  60. it loads certificates into the B<X509_STORE> from the hardcoded default
  61. paths.
  62. =head1 RETURN VALUES
  63. X509_STORE_add_cert(), X509_STORE_add_crl(), X509_STORE_set_depth(),
  64. X509_STORE_set_flags(), X509_STORE_set_purpose(),
  65. X509_STORE_set_trust(), X509_STORE_load_locations(), and
  66. X509_STORE_set_default_paths() return 1 on success or 0 on failure.
  67. =head1 SEE ALSO
  68. L<X509_LOOKUP_hash_dir(3)>.
  69. L<X509_VERIFY_PARAM_set_depth(3)>.
  70. L<X509_STORE_new(3)>,
  71. L<X509_STORE_get0_param(3)>
  72. =head1 COPYRIGHT
  73. Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
  74. Licensed under the OpenSSL license (the "License"). You may not use
  75. this file except in compliance with the License. You can obtain a copy
  76. in the file LICENSE in the source distribution or at
  77. L<https://www.openssl.org/source/license.html>.
  78. =cut