i2d_re_X509_tbs.pod 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. =pod
  2. =head1 NAME
  3. d2i_X509_AUX, i2d_X509_AUX,
  4. i2d_re_X509_tbs, i2d_re_X509_CRL_tbs, i2d_re_X509_REQ_tbs
  5. - X509 encode and decode functions
  6. =head1 SYNOPSIS
  7. #include <openssl/x509.h>
  8. X509 *d2i_X509_AUX(X509 **px, const unsigned char **in, long len);
  9. int i2d_X509_AUX(X509 *x, unsigned char **out);
  10. int i2d_re_X509_tbs(X509 *x, unsigned char **out);
  11. int i2d_re_X509_CRL_tbs(X509_CRL *crl, unsigned char **pp);
  12. int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp);
  13. =head1 DESCRIPTION
  14. The X509 encode and decode routines encode and parse an
  15. B<X509> structure, which represents an X509 certificate.
  16. d2i_X509_AUX() is similar to L<d2i_X509(3)> but the input is expected to
  17. consist of an X509 certificate followed by auxiliary trust information.
  18. This is used by the PEM routines to read "TRUSTED CERTIFICATE" objects.
  19. This function should not be called on untrusted input.
  20. i2d_X509_AUX() is similar to L<i2d_X509(3)>, but the encoded output
  21. contains both the certificate and any auxiliary trust information.
  22. This is used by the PEM routines to write "TRUSTED CERTIFICATE" objects.
  23. Note that this is a non-standard OpenSSL-specific data format.
  24. i2d_re_X509_tbs() is similar to L<i2d_X509(3)> except it encodes only
  25. the TBSCertificate portion of the certificate. i2d_re_X509_CRL_tbs()
  26. and i2d_re_X509_REQ_tbs() are analogous for CRL and certificate request,
  27. respectively. The "re" in B<i2d_re_X509_tbs> stands for "re-encode",
  28. and ensures that a fresh encoding is generated in case the object has been
  29. modified after creation (see the BUGS section).
  30. The encoding of the TBSCertificate portion of a certificate is cached
  31. in the B<X509> structure internally to improve encoding performance
  32. and to ensure certificate signatures are verified correctly in some
  33. certificates with broken (non-DER) encodings.
  34. If, after modification, the B<X509> object is re-signed with X509_sign(),
  35. the encoding is automatically renewed. Otherwise, the encoding of the
  36. TBSCertificate portion of the B<X509> can be manually renewed by calling
  37. i2d_re_X509_tbs().
  38. =head1 RETURN VALUES
  39. d2i_X509_AUX() returns a valid B<X509> structure or NULL if an error occurred.
  40. i2d_X509_AUX() returns the length of encoded data or -1 on error.
  41. i2d_re_X509_tbs(), i2d_re_X509_CRL_tbs() and i2d_re_X509_REQ_tbs() return the
  42. length of encoded data or 0 on error.
  43. =head1 SEE ALSO
  44. L<ERR_get_error(3)>
  45. L<X509_CRL_get0_by_serial(3)>,
  46. L<X509_get0_signature(3)>,
  47. L<X509_get_ext_d2i(3)>,
  48. L<X509_get_extension_flags(3)>,
  49. L<X509_get_pubkey(3)>,
  50. L<X509_get_subject_name(3)>,
  51. L<X509_get_version(3)>,
  52. L<X509_NAME_add_entry_by_txt(3)>,
  53. L<X509_NAME_ENTRY_get_object(3)>,
  54. L<X509_NAME_get_index_by_NID(3)>,
  55. L<X509_NAME_print_ex(3)>,
  56. L<X509_new(3)>,
  57. L<X509_sign(3)>,
  58. L<X509V3_get_d2i(3)>,
  59. L<X509_verify_cert(3)>
  60. =head1 COPYRIGHT
  61. Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.
  62. Licensed under the Apache License 2.0 (the "License"). You may not use
  63. this file except in compliance with the License. You can obtain a copy
  64. in the file LICENSE in the source distribution or at
  65. L<https://www.openssl.org/source/license.html>.
  66. =cut