1 =pod 2 3 =head1 NAME 4 5 X509_EXTENSION_set_object, X509_EXTENSION_set_critical, 6 X509_EXTENSION_set_data, X509_EXTENSION_create_by_NID, 7 X509_EXTENSION_create_by_OBJ, X509_EXTENSION_get_object, 8 X509_EXTENSION_get_critical, X509_EXTENSION_get_data - extension utility 9 functions 10 11 =head1 SYNOPSIS 12 13 int X509_EXTENSION_set_object(X509_EXTENSION *ex, const ASN1_OBJECT *obj); 14 int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit); 15 int X509_EXTENSION_set_data(X509_EXTENSION *ex, ASN1_OCTET_STRING *data); 16 17 X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, 18 int nid, int crit, 19 ASN1_OCTET_STRING *data); 20 X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex, 21 const ASN1_OBJECT *obj, int crit, 22 ASN1_OCTET_STRING *data); 23 24 ASN1_OBJECT *X509_EXTENSION_get_object(X509_EXTENSION *ex); 25 int X509_EXTENSION_get_critical(const X509_EXTENSION *ex); 26 ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); 27 28 =head1 DESCRIPTION 29 30 X509_EXTENSION_set_object() sets the extension type of B<ex> to B<obj>. The 31 B<obj> pointer is duplicated internally so B<obj> should be freed up after use. 32 33 X509_EXTENSION_set_critical() sets the criticality of B<ex> to B<crit>. If 34 B<crit> is zero the extension in non-critical otherwise it is critical. 35 36 X509_EXTENSION_set_data() sets the data in extension B<ex> to B<data>. The 37 B<data> pointer is duplicated internally. 38 39 X509_EXTENSION_create_by_NID() creates an extension of type B<nid>, 40 criticality B<crit> using data B<data>. The created extension is returned and 41 written to B<*ex> reusing or allocating a new extension if necessary so B<*ex> 42 should either be B<NULL> or a valid B<X509_EXTENSION> structure it must 43 B<not> be an uninitialised pointer. 44 45 X509_EXTENSION_create_by_OBJ() is identical to X509_EXTENSION_create_by_NID() 46 except it creates and extension using B<obj> instead of a NID. 47 48 X509_EXTENSION_get_object() returns the extension type of B<ex> as an 49 B<ASN1_OBJECT> pointer. The returned pointer is an internal value which must 50 not be freed up. 51 52 X509_EXTENSION_get_critical() returns the criticality of extension B<ex> it 53 returns B<1> for critical and B<0> for non-critical. 54 55 X509_EXTENSION_get_data() returns the data of extension B<ex>. The returned 56 pointer is an internal value which must not be freed up. 57 58 =head1 NOTES 59 60 These functions manipulate the contents of an extension directly. Most 61 applications will want to parse or encode and add an extension: they should 62 use the extension encode and decode functions instead such as 63 X509_add1_ext_i2d() and X509_get_ext_d2i(). 64 65 The B<data> associated with an extension is the extension encoding in an 66 B<ASN1_OCTET_STRING> structure. 67 68 =head1 RETURN VALUES 69 70 X509_EXTENSION_set_object() X509_EXTENSION_set_critical() and 71 X509_EXTENSION_set_data() return B<1> for success and B<0> for failure. 72 73 X509_EXTENSION_create_by_NID() and X509_EXTENSION_create_by_OBJ() return 74 an B<X509_EXTENSION> pointer or B<NULL> if an error occurs. 75 76 X509_EXTENSION_get_object() returns an B<ASN1_OBJECT> pointer. 77 78 X509_EXTENSION_get_critical() returns B<0> for non-critical and B<1> for 79 critical. 80 81 X509_EXTENSION_get_data() returns an B<ASN1_OCTET_STRING> pointer. 82 83 =head1 SEE ALSO 84 85 L<X509V3_get_d2i(3)> 86 87 =head1 COPYRIGHT 88 89 Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. 90 91 Licensed under the Apache License 2.0 (the "License"). You may not use 92 this file except in compliance with the License. You can obtain a copy 93 in the file LICENSE in the source distribution or at 94 L<https://www.openssl.org/source/license.html>. 95 96 =cut 97