X509_EXTENSION_set_object.pod 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. =pod
  2. =head1 NAME
  3. X509_EXTENSION_set_object, X509_EXTENSION_set_critical,
  4. X509_EXTENSION_set_data, X509_EXTENSION_create_by_NID,
  5. X509_EXTENSION_create_by_OBJ, X509_EXTENSION_get_object,
  6. X509_EXTENSION_get_critical, X509_EXTENSION_get_data - extension utility
  7. functions
  8. =head1 SYNOPSIS
  9. int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj);
  10. int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);
  11. int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data);
  12. X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,
  13. int nid, int crit,
  14. ASN1_OCTET_STRING *data);
  15. X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,
  16. const ASN1_OBJECT *obj, int crit,
  17. ASN1_OCTET_STRING *data);
  18. ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex);
  19. int X509_EXTENSION_get_critical(const X509_EXTENSION *ex);
  20. ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);
  21. =head1 DESCRIPTION
  22. X509_EXTENSION_set_object() sets the extension type of B<ex> to B<obj>. The
  23. B<obj> pointer is duplicated internally so B<obj> should be freed up after use.
  24. X509_EXTENSION_set_critical() sets the criticality of B<ex> to B<crit>. If
  25. B<crit> is zero the extension in non-critical otherwise it is critical.
  26. X509_EXTENSION_set_data() sets the data in extension B<ex> to B<data>. The
  27. B<data> pointer is duplicated internally.
  28. X509_EXTENSION_create_by_NID() creates an extension of type B<nid>,
  29. criticality B<crit> using data B<data>. The created extension is returned and
  30. written to B<*ex> reusing or allocating a new extension if necessary so B<*ex>
  31. should either be B<NULL> or a valid B<X509_EXTENSION> structure it must
  32. B<not> be an uninitialised pointer.
  33. X509_EXTENSION_create_by_OBJ() is identical to X509_EXTENSION_create_by_NID()
  34. except it creates and extension using B<obj> instead of a NID.
  35. X509_EXTENSION_get_object() returns the extension type of B<ex> as an
  36. B<ASN1_OBJECT> pointer. The returned pointer is an internal value which must
  37. not be freed up.
  38. X509_EXTENSION_get_critical() returns the criticality of extension B<ex> it
  39. returns B<1> for critical and B<0> for non-critical.
  40. X509_EXTENSION_get_data() returns the data of extension B<ex>. The returned
  41. pointer is an internal value which must not be freed up.
  42. =head1 NOTES
  43. These functions manipulate the contents of an extension directly. Most
  44. applications will want to parse or encode and add an extension: they should
  45. use the extension encode and decode functions instead such as
  46. X509_add1_ext_i2d() and X509_get_ext_d2i().
  47. The B<data> associated with an extension is the extension encoding in an
  48. B<ASN1_OCTET_STRING> structure.
  49. =head1 RETURN VALUES
  50. X509_EXTENSION_set_object() X509_EXTENSION_set_critical() and
  51. X509_EXTENSION_set_data() return B<1> for success and B<0> for failure.
  52. X509_EXTENSION_create_by_NID() and X509_EXTENSION_create_by_OBJ() return
  53. an B<X509_EXTENSION> pointer or B<NULL> if an error occurs.
  54. X509_EXTENSION_get_object() returns an B<ASN1_OBJECT> pointer.
  55. X509_EXTENSION_get_critical() returns B<0> for non-critical and B<1> for
  56. critical.
  57. X509_EXTENSION_get_data() returns an B<ASN1_OCTET_STRING> pointer.
  58. =head1 SEE ALSO
  59. L<X509V3_get_d2i(3)>
  60. =head1 COPYRIGHT
  61. Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
  62. Licensed under the OpenSSL license (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