1 | =pod
|
---|
2 |
|
---|
3 | =head1 NAME
|
---|
4 |
|
---|
5 | OSSL_CMP_ITAV_create,
|
---|
6 | OSSL_CMP_ITAV_set0,
|
---|
7 | OSSL_CMP_ITAV_get0_type,
|
---|
8 | OSSL_CMP_ITAV_get0_value,
|
---|
9 | OSSL_CMP_ITAV_push0_stack_item,
|
---|
10 | OSSL_CMP_ITAV_new0_certProfile,
|
---|
11 | OSSL_CMP_ITAV_get0_certProfile
|
---|
12 | - OSSL_CMP_ITAV utility functions
|
---|
13 |
|
---|
14 | =head1 SYNOPSIS
|
---|
15 |
|
---|
16 | #include <openssl/cmp.h>
|
---|
17 |
|
---|
18 | OSSL_CMP_ITAV *OSSL_CMP_ITAV_create(ASN1_OBJECT *type, ASN1_TYPE *value);
|
---|
19 | void OSSL_CMP_ITAV_set0(OSSL_CMP_ITAV *itav, ASN1_OBJECT *type,
|
---|
20 | ASN1_TYPE *value);
|
---|
21 | ASN1_OBJECT *OSSL_CMP_ITAV_get0_type(const OSSL_CMP_ITAV *itav);
|
---|
22 | ASN1_TYPE *OSSL_CMP_ITAV_get0_value(const OSSL_CMP_ITAV *itav);
|
---|
23 | int OSSL_CMP_ITAV_push0_stack_item(STACK_OF(OSSL_CMP_ITAV) **itav_sk_p,
|
---|
24 | OSSL_CMP_ITAV *itav);
|
---|
25 | OSSL_CMP_ITAV
|
---|
26 | *OSSL_CMP_ITAV_new0_certProfile(STACK_OF(ASN1_UTF8STRING) *certProfile);
|
---|
27 | int OSSL_CMP_ITAV_get0_certProfile(const OSSL_CMP_ITAV *itav,
|
---|
28 | STACK_OF(ASN1_UTF8STRING) **out);
|
---|
29 |
|
---|
30 | =head1 DESCRIPTION
|
---|
31 |
|
---|
32 | ITAV is short for InfoTypeAndValue. This type is defined in RFC 4210
|
---|
33 | section 5.3.19 and Appendix F. It is used at various places in CMP messages,
|
---|
34 | e.g., in the generalInfo PKIHeader field, to hold a key-value pair.
|
---|
35 |
|
---|
36 | OSSL_CMP_ITAV_create() creates a new B<OSSL_CMP_ITAV> structure and fills it in.
|
---|
37 | It combines OSSL_CMP_ITAV_new() and OSSL_CMP_ITAV_set0().
|
---|
38 |
|
---|
39 | OSSL_CMP_ITAV_set0() sets the I<itav> with an infoType of I<type> and an
|
---|
40 | infoValue of I<value>. This function uses the pointers I<type> and I<value>
|
---|
41 | internally, so they must B<not> be freed up after the call.
|
---|
42 |
|
---|
43 | OSSL_CMP_ITAV_get0_type() returns a direct pointer to the infoType in the
|
---|
44 | I<itav>.
|
---|
45 |
|
---|
46 | OSSL_CMP_ITAV_get0_value() returns a direct pointer to the infoValue in
|
---|
47 | the I<itav> as generic B<ASN1_TYPE> pointer.
|
---|
48 |
|
---|
49 | OSSL_CMP_ITAV_push0_stack_item() pushes I<itav> to the stack pointed to
|
---|
50 | by I<*itav_sk_p>. It creates a new stack if I<*itav_sk_p> points to NULL.
|
---|
51 |
|
---|
52 | OSSL_CMP_ITAV_new0_certProfile() creates a new B<OSSL_CMP_ITAV> structure
|
---|
53 | of type B<certProfile> that includes the optionally given list of profile names.
|
---|
54 | On success, ownership of the list is with the new B<OSSL_CMP_ITAV> structure.
|
---|
55 |
|
---|
56 | OSSL_CMP_ITAV_get0_certProfile() on success assigns to I<*out>
|
---|
57 | an internal pointer to the
|
---|
58 | list of certificate profile names contained in the infoValue field of I<itav>.
|
---|
59 | The pointer may be NULL if no profile name is included.
|
---|
60 | It is an error if the infoType of I<itav> is not B<certProfile>.
|
---|
61 |
|
---|
62 | =head1 NOTES
|
---|
63 |
|
---|
64 | CMP is defined in RFC 4210 and RFC 9480 (and CRMF in RFC 4211).
|
---|
65 |
|
---|
66 | OIDs to use as types in B<OSSL_CMP_ITAV> can be found at
|
---|
67 | L<https://datatracker.ietf.org/doc/html/rfc9480#section-4.2.2>.
|
---|
68 | The respective OpenSSL NIDs, such as B<NID_id_it_certProfile>,
|
---|
69 | are defined in the F<< <openssl/obj_mac.h> >> header file.
|
---|
70 |
|
---|
71 | =head1 RETURN VALUES
|
---|
72 |
|
---|
73 | OSSL_CMP_ITAV_create() and OSSL_CMP_ITAV_new0_certProfile()
|
---|
74 | return a pointer to an ITAV structure on success, or NULL on error.
|
---|
75 |
|
---|
76 | OSSL_CMP_ITAV_set0() does not return a value.
|
---|
77 |
|
---|
78 | OSSL_CMP_ITAV_get0_type() and OSSL_CMP_ITAV_get0_value()
|
---|
79 | return the respective pointer or NULL if their input is NULL.
|
---|
80 |
|
---|
81 | OSSL_CMP_ITAV_push0_stack_item() and OSSL_CMP_ITAV_get0_certProfile()
|
---|
82 | return 1 on success, 0 on error.
|
---|
83 |
|
---|
84 | =head1 EXAMPLES
|
---|
85 |
|
---|
86 | The following code creates and sets a structure representing a generic
|
---|
87 | InfoTypeAndValue sequence, using an OID created from text as type, and an
|
---|
88 | integer as value. Afterwards, it is pushed to the B<OSSL_CMP_CTX> to be later
|
---|
89 | included in the requests' PKIHeader's genInfo field.
|
---|
90 |
|
---|
91 | ASN1_OBJECT *type = OBJ_txt2obj("1.2.3.4.5", 1);
|
---|
92 | if (type == NULL) ...
|
---|
93 |
|
---|
94 | ASN1_INTEGER *asn1int = ASN1_INTEGER_new();
|
---|
95 | if (asn1int == NULL || !ASN1_INTEGER_set(asn1int, 12345)) ...
|
---|
96 |
|
---|
97 | ASN1_TYPE *val = ASN1_TYPE_new();
|
---|
98 | if (val == NULL) ...
|
---|
99 | ASN1_TYPE_set(val, V_ASN1_INTEGER, asn1int);
|
---|
100 |
|
---|
101 | OSSL_CMP_ITAV *itav = OSSL_CMP_ITAV_create(type, val);
|
---|
102 | if (itav == NULL) ...
|
---|
103 |
|
---|
104 | if (!OSSL_CMP_CTX_push0_geninfo_ITAV(ctx, itav)) {
|
---|
105 | OSSL_CMP_ITAV_free(itav); /* also frees type and val */
|
---|
106 | ...
|
---|
107 | }
|
---|
108 |
|
---|
109 | ...
|
---|
110 |
|
---|
111 | OSSL_CMP_CTX_free(ctx); /* also frees itav */
|
---|
112 |
|
---|
113 | =head1 SEE ALSO
|
---|
114 |
|
---|
115 | L<OSSL_CMP_CTX_new(3)>, L<OSSL_CMP_CTX_free(3)>, L<ASN1_TYPE_set(3)>
|
---|
116 |
|
---|
117 | =head1 HISTORY
|
---|
118 |
|
---|
119 | The OpenSSL CMP support was added in OpenSSL 3.0.
|
---|
120 |
|
---|
121 | OSSL_CMP_ITAV_new0_certProfile() and OSSL_CMP_ITAV_get0_certProfile()
|
---|
122 | were added in OpenSSL 3.3.
|
---|
123 |
|
---|
124 | =head1 COPYRIGHT
|
---|
125 |
|
---|
126 | Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
|
---|
127 |
|
---|
128 | Licensed under the Apache License 2.0 (the "License"). You may not use
|
---|
129 | this file except in compliance with the License. You can obtain a copy
|
---|
130 | in the file LICENSE in the source distribution or at
|
---|
131 | L<https://www.openssl.org/source/license.html>.
|
---|
132 |
|
---|
133 | =cut
|
---|