Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

83 linhas
3.1 KiB

  1. /* Copyright (c) 2014, Google Inc.
  2. *
  3. * Permission to use, copy, modify, and/or distribute this software for any
  4. * purpose with or without fee is hereby granted, provided that the above
  5. * copyright notice and this permission notice appear in all copies.
  6. *
  7. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  10. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  12. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  13. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
  14. #ifndef OPENSSL_HEADER_PKCS7_H
  15. #define OPENSSL_HEADER_PKCS7_H
  16. #include <openssl/base.h>
  17. #include <openssl/stack.h>
  18. #if defined(__cplusplus)
  19. extern "C" {
  20. #endif
  21. // PKCS#7.
  22. //
  23. // This library contains functions for extracting information from PKCS#7
  24. // structures (RFC 2315).
  25. DECLARE_STACK_OF(CRYPTO_BUFFER)
  26. DECLARE_STACK_OF(X509)
  27. DECLARE_STACK_OF(X509_CRL)
  28. // PKCS7_get_raw_certificates parses a PKCS#7, SignedData structure from |cbs|
  29. // and appends the included certificates to |out_certs|. It returns one on
  30. // success and zero on error.
  31. OPENSSL_EXPORT int PKCS7_get_raw_certificates(
  32. STACK_OF(CRYPTO_BUFFER) *out_certs, CBS *cbs, CRYPTO_BUFFER_POOL *pool);
  33. // PKCS7_get_certificates behaves like |PKCS7_get_raw_certificates| but parses
  34. // them into |X509| objects.
  35. OPENSSL_EXPORT int PKCS7_get_certificates(STACK_OF(X509) *out_certs, CBS *cbs);
  36. // PKCS7_bundle_certificates appends a PKCS#7, SignedData structure containing
  37. // |certs| to |out|. It returns one on success and zero on error.
  38. OPENSSL_EXPORT int PKCS7_bundle_certificates(
  39. CBB *out, const STACK_OF(X509) *certs);
  40. // PKCS7_get_CRLs parses a PKCS#7, SignedData structure from |cbs| and appends
  41. // the included CRLs to |out_crls|. It returns one on success and zero on
  42. // error.
  43. OPENSSL_EXPORT int PKCS7_get_CRLs(STACK_OF(X509_CRL) *out_crls, CBS *cbs);
  44. // PKCS7_bundle_CRLs appends a PKCS#7, SignedData structure containing
  45. // |crls| to |out|. It returns one on success and zero on error.
  46. OPENSSL_EXPORT int PKCS7_bundle_CRLs(CBB *out, const STACK_OF(X509_CRL) *crls);
  47. // PKCS7_get_PEM_certificates reads a PEM-encoded, PKCS#7, SignedData structure
  48. // from |pem_bio| and appends the included certificates to |out_certs|. It
  49. // returns one on success and zero on error.
  50. OPENSSL_EXPORT int PKCS7_get_PEM_certificates(STACK_OF(X509) *out_certs,
  51. BIO *pem_bio);
  52. // PKCS7_get_PEM_CRLs reads a PEM-encoded, PKCS#7, SignedData structure from
  53. // |pem_bio| and appends the included CRLs to |out_crls|. It returns one on
  54. // success and zero on error.
  55. OPENSSL_EXPORT int PKCS7_get_PEM_CRLs(STACK_OF(X509_CRL) *out_crls,
  56. BIO *pem_bio);
  57. #if defined(__cplusplus)
  58. } // extern C
  59. #endif
  60. #define PKCS7_R_BAD_PKCS7_VERSION 100
  61. #define PKCS7_R_NOT_PKCS7_SIGNED_DATA 101
  62. #define PKCS7_R_NO_CERTIFICATES_INCLUDED 102
  63. #define PKCS7_R_NO_CRLS_INCLUDED 103
  64. #endif // OPENSSL_HEADER_PKCS7_H