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