1OSSL_CMP_ITAV_SET0(3ossl)           OpenSSL          OSSL_CMP_ITAV_SET0(3ossl)
2
3
4

NAME

6       OSSL_CMP_ITAV_create, OSSL_CMP_ITAV_set0, OSSL_CMP_ITAV_get0_type,
7       OSSL_CMP_ITAV_get0_value, OSSL_CMP_ITAV_push0_stack_item -
8       OSSL_CMP_ITAV utility functions
9

SYNOPSIS

11         #include <openssl/cmp.h>
12         OSSL_CMP_ITAV *OSSL_CMP_ITAV_create(ASN1_OBJECT *type, ASN1_TYPE *value);
13         void OSSL_CMP_ITAV_set0(OSSL_CMP_ITAV *itav, ASN1_OBJECT *type,
14                                 ASN1_TYPE *value);
15         ASN1_OBJECT *OSSL_CMP_ITAV_get0_type(const OSSL_CMP_ITAV *itav);
16         ASN1_TYPE *OSSL_CMP_ITAV_get0_value(const OSSL_CMP_ITAV *itav);
17
18         int OSSL_CMP_ITAV_push0_stack_item(STACK_OF(OSSL_CMP_ITAV) **itav_sk_p,
19                                            OSSL_CMP_ITAV *itav);
20

DESCRIPTION

22       Certificate Management Protocol (CMP, RFC 4210) extension to OpenSSL
23
24       ITAV is short for InfoTypeAndValue. This type is defined in RFC 4210
25       section 5.3.19 and Appendix F. It is used at various places in CMP
26       messages, e.g., in the generalInfo PKIHeader field, to hold a key-value
27       pair.
28
29       OSSL_CMP_ITAV_create() creates a new OSSL_CMP_ITAV structure and fills
30       it in.  It combines OSSL_CMP_ITAV_new() and OSSL_CMP_ITAV_set0().
31
32       OSSL_CMP_ITAV_set0() sets the itav with an infoType of type and an
33       infoValue of value. This function uses the pointers type and value
34       internally, so they must not be freed up after the call.
35
36       OSSL_CMP_ITAV_get0_type() returns a direct pointer to the infoType in
37       the itav.
38
39       OSSL_CMP_ITAV_get0_value() returns a direct pointer to the infoValue in
40       the itav as generic ASN1_TYPE pointer.
41
42       OSSL_CMP_ITAV_push0_stack_item() pushes itav to the stack pointed to by
43       *itav_sk_p. It creates a new stack if *itav_sk_p points to NULL.
44

NOTES

46       CMP is defined in RFC 4210 (and CRMF in RFC 4211).
47

RETURN VALUES

49       OSSL_CMP_ITAV_create() returns a pointer to the ITAV structure on
50       success, or NULL on error.
51
52       OSSL_CMP_ITAV_set0() does not return a value.
53
54       OSSL_CMP_ITAV_get0_type() and OSSL_CMP_ITAV_get0_value() return the
55       respective pointer or NULL if their input is NULL.
56
57       OSSL_CMP_ITAV_push0_stack_item() returns 1 on success, 0 on error.
58

EXAMPLES

60       The following code creates and sets a structure representing a generic
61       InfoTypeAndValue sequence, using an OID created from text as type, and
62       an integer as value. Afterwards, it is pushed to the OSSL_CMP_CTX to be
63       later included in the requests' PKIHeader's genInfo field.
64
65           ASN1_OBJECT *type = OBJ_txt2obj("1.2.3.4.5", 1);
66           if (type == NULL) ...
67
68           ASN1_INTEGER *asn1int = ASN1_INTEGER_new();
69           if (asn1int == NULL || !ASN1_INTEGER_set(asn1int, 12345)) ...
70
71           ASN1_TYPE *val = ASN1_TYPE_new();
72           if (val == NULL) ...
73           ASN1_TYPE_set(val, V_ASN1_INTEGER, asn1int);
74
75           OSSL_CMP_ITAV *itav = OSSL_CMP_ITAV_create(type, val);
76           if (itav == NULL) ...
77
78           OSSL_CMP_CTX *ctx = OSSL_CMP_CTX_new();
79           if (ctx == NULL || !OSSL_CMP_CTX_geninfo_push0_ITAV(ctx, itav)) {
80               OSSL_CMP_ITAV_free(itav); /* also frees type and val */
81               goto err;
82           }
83
84           ...
85
86           OSSL_CMP_CTX_free(ctx); /* also frees itav */
87

SEE ALSO

89       OSSL_CMP_CTX_new(3), OSSL_CMP_CTX_free(3), ASN1_TYPE_set(3)
90

HISTORY

92       The OpenSSL CMP support was added in OpenSSL 3.0.
93
95       Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
96
97       Licensed under the Apache License 2.0 (the "License").  You may not use
98       this file except in compliance with the License.  You can obtain a copy
99       in the file LICENSE in the source distribution or at
100       <https://www.openssl.org/source/license.html>.
101
102
103
1043.1.1                             2023-08-31         OSSL_CMP_ITAV_SET0(3ossl)
Impressum