summaryrefslogtreecommitdiff
path: root/lib/libcrypto/man/ASN1_STRING_new.3
blob: 23679cdb3cc0f39d10a38fcc79d8e832e3418ba4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
.\"	$OpenBSD: ASN1_STRING_new.3,v 1.21 2021/11/15 13:39:40 schwarze Exp $
.\"	OpenSSL 99d63d46 Tue Mar 24 07:52:24 2015 -0400
.\"
.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: November 15 2021 $
.Dt ASN1_STRING_NEW 3
.Os
.Sh NAME
.Nm ASN1_STRING_new ,
.Nm ASN1_STRING_type_new ,
.Nm ASN1_STRING_free ,
.Nm ASN1_OCTET_STRING_new ,
.Nm ASN1_OCTET_STRING_free ,
.Nm ASN1_BIT_STRING_new ,
.Nm ASN1_BIT_STRING_free ,
.Nm ASN1_INTEGER_new ,
.Nm ASN1_INTEGER_free ,
.Nm ASN1_ENUMERATED_new ,
.Nm ASN1_ENUMERATED_free ,
.Nm ASN1_UTF8STRING_new ,
.Nm ASN1_UTF8STRING_free ,
.Nm ASN1_IA5STRING_new ,
.Nm ASN1_IA5STRING_free ,
.Nm ASN1_UNIVERSALSTRING_new ,
.Nm ASN1_UNIVERSALSTRING_free ,
.Nm ASN1_BMPSTRING_new ,
.Nm ASN1_BMPSTRING_free ,
.Nm ASN1_GENERALSTRING_new ,
.Nm ASN1_GENERALSTRING_free ,
.Nm ASN1_T61STRING_new ,
.Nm ASN1_T61STRING_free ,
.Nm ASN1_VISIBLESTRING_new ,
.Nm ASN1_VISIBLESTRING_free ,
.Nm ASN1_PRINTABLESTRING_new ,
.Nm ASN1_PRINTABLESTRING_free ,
.Nm ASN1_PRINTABLE_new ,
.Nm ASN1_PRINTABLE_free ,
.Nm DIRECTORYSTRING_new ,
.Nm DIRECTORYSTRING_free ,
.Nm DISPLAYTEXT_new ,
.Nm DISPLAYTEXT_free ,
.Nm ASN1_GENERALIZEDTIME_new ,
.Nm ASN1_GENERALIZEDTIME_free ,
.Nm ASN1_UTCTIME_new ,
.Nm ASN1_UTCTIME_free ,
.Nm ASN1_TIME_new ,
.Nm ASN1_TIME_free
.Nd allocate and free ASN1_STRING objects
.Sh SYNOPSIS
.In openssl/asn1.h
.Ft ASN1_STRING *
.Fn ASN1_STRING_new void
.Ft ASN1_STRING *
.Fn ASN1_STRING_type_new "int type"
.Ft void
.Fn ASN1_STRING_free "ASN1_STRING *a"
.Ft ASN1_OCTET_STRING *
.Fn ASN1_OCTET_STRING_new void
.Ft void
.Fn ASN1_OCTET_STRING_free "ASN1_OCTET_STRING *a"
.Ft ASN1_BIT_STRING *
.Fn ASN1_BIT_STRING_new void
.Ft void
.Fn ASN1_BIT_STRING_free "ASN1_BIT_STRING *a"
.Ft ASN1_INTEGER *
.Fn ASN1_INTEGER_new void
.Ft void
.Fn ASN1_INTEGER_free "ASN1_INTEGER *a"
.Ft ASN1_ENUMERATED *
.Fn ASN1_ENUMERATED_new void
.Ft void
.Fn ASN1_ENUMERATED_free "ASN1_ENUMERATED *a"
.Ft ASN1_UTF8STRING *
.Fn ASN1_UTF8STRING_new void
.Ft void
.Fn ASN1_UTF8STRING_free "ASN1_UTF8STRING *a"
.Ft ASN1_IA5STRING *
.Fn ASN1_IA5STRING_new void
.Ft void
.Fn ASN1_IA5STRING_free "ASN1_IA5STRING *a"
.Ft ASN1_UNIVERSALSTRING *
.Fn ASN1_UNIVERSALSTRING_new void
.Ft void
.Fn ASN1_UNIVERSALSTRING_free "ASN1_UNIVERSALSTRING *a"
.Ft ASN1_BMPSTRING *
.Fn ASN1_BMPSTRING_new void
.Ft void
.Fn ASN1_BMPSTRING_free "ASN1_BMPSTRING *a"
.Ft ASN1_GENERALSTRING *
.Fn ASN1_GENERALSTRING_new void
.Ft void
.Fn ASN1_GENERALSTRING_free "ASN1_GENERALSTRING *a"
.Ft ASN1_T61STRING *
.Fn ASN1_T61STRING_new void
.Ft void
.Fn ASN1_T61STRING_free "ASN1_T61STRING *a"
.Ft ASN1_VISIBLESTRING *
.Fn ASN1_VISIBLESTRING_new void
.Ft void
.Fn ASN1_VISIBLESTRING_free "ASN1_VISIBLESTRING *a"
.Ft ASN1_PRINTABLESTRING *
.Fn ASN1_PRINTABLESTRING_new void
.Ft void
.Fn ASN1_PRINTABLESTRING_free "ASN1_PRINTABLESTRING *a"
.Ft ASN1_STRING *
.Fn ASN1_PRINTABLE_new void
.Ft void
.Fn ASN1_PRINTABLE_free "ASN1_STRING *a"
.Ft ASN1_STRING *
.Fn DIRECTORYSTRING_new void
.Ft void
.Fn DIRECTORYSTRING_free "ASN1_STRING *a"
.Ft ASN1_STRING *
.Fn DISPLAYTEXT_new void
.Ft void
.Fn DISPLAYTEXT_free "ASN1_STRING *a"
.Ft ASN1_GENERALIZEDTIME *
.Fn ASN1_GENERALIZEDTIME_new void
.Ft void
.Fn ASN1_GENERALIZEDTIME_free "ASN1_GENERALIZEDTIME *a"
.Ft ASN1_UTCTIME *
.Fn ASN1_UTCTIME_new void
.Ft void
.Fn ASN1_UTCTIME_free "ASN1_UTCTIME *a"
.Ft ASN1_TIME *
.Fn ASN1_TIME_new void
.Ft void
.Fn ASN1_TIME_free "ASN1_TIME *a"
.Sh DESCRIPTION
The
.Vt ASN1_STRING
object can represent a variety of ASN.1 built-in types.
It can store a type and a value.
.Pp
All the
.Fn *_new
functions
allocate and initialize an empty
.Vt ASN1_STRING
object.
The following table shows the type assigned to the new object,
and which ASN.1 type it represents.
.Bl -column "ASN1_GENERALIZEDTIME_new()" "V_ASN1_GENERALIZEDTIME"
.It Em constructor function     Ta Em OpenSSL type          Ta Em ASN.1 type
.It Ta
.It Fn ASN1_STRING_new          Ta Dv V_ASN1_OCTET_STRING
.It Fn ASN1_STRING_type_new     Ta Fa type No argument
.It Ta
.It Fn ASN1_OCTET_STRING_new    Ta Dv V_ASN1_OCTET_STRING    Ta OCTET STRING
.It Fn ASN1_BIT_STRING_new      Ta Dv V_ASN1_BIT_STRING      Ta BIT STRING
.It Fn ASN1_INTEGER_new         Ta Dv V_ASN1_INTEGER         Ta INTEGER
.It Fn ASN1_ENUMERATED_new      Ta Dv V_ASN1_ENUMERATED      Ta ENUMERATED
.It Ta
.It Fn ASN1_UTF8STRING_new      Ta Dv V_ASN1_UTF8STRING      Ta UTF8String
.It Fn ASN1_IA5STRING_new       Ta Dv V_ASN1_IA5STRING       Ta IA5String
.It Ta
.It Fn ASN1_UNIVERSALSTRING_new Ta Dv V_ASN1_UNIVERSALSTRING Ta UniversalString
.It Fn ASN1_BMPSTRING_new       Ta Dv V_ASN1_BMPSTRING       Ta BMPString
.It Fn ASN1_GENERALSTRING_new   Ta Dv V_ASN1_GENERALSTRING   Ta GeneralString
.It Fn ASN1_T61STRING_new       Ta Dv V_ASN1_T61STRING       Ta T61String
.It Fn ASN1_VISIBLESTRING_new   Ta Dv V_ASN1_VISIBLESTRING   Ta VisibleString
.It Fn ASN1_PRINTABLESTRING_new Ta Dv V_ASN1_PRINTABLESTRING Ta PrintableString
.It Ta
.It Fn ASN1_PRINTABLE_new       Ta Dv V_ASN1_UNDEF
.It Fn DIRECTORYSTRING_new      Ta Dv V_ASN1_UNDEF
.It Fn DISPLAYTEXT_new          Ta Dv V_ASN1_UNDEF
.It Ta
.It Fn ASN1_GENERALIZEDTIME_new Ta Dv V_ASN1_GENERALIZEDTIME Ta GeneralizedTime
.It Fn ASN1_UTCTIME_new         Ta Dv V_ASN1_UTCTIME         Ta UTCTime
.It Fn ASN1_TIME_new            Ta Dv V_ASN1_UNDEF           Ta TIME
.El
.Pp
All the
.Fn *_free
functions free
.Fa a
including any data contained in it.
If
.Fa a
is a
.Dv NULL
pointer, no action occurs.
.Sh RETURN VALUES
All the
.Fn *_new
functions return the new
.Vt ASN1_STRING
object if successful; otherwise
.Dv NULL
is returned and an error code can be retrieved with
.Xr ERR_get_error 3 .
.Sh SEE ALSO
.Xr ASN1_INTEGER_get 3 ,
.Xr ASN1_item_pack 3 ,
.Xr ASN1_mbstring_copy 3 ,
.Xr ASN1_PRINTABLE_type 3 ,
.Xr ASN1_STRING_length 3 ,
.Xr ASN1_STRING_print_ex 3 ,
.Xr ASN1_time_parse 3 ,
.Xr ASN1_TIME_set 3 ,
.Xr ASN1_TYPE_get 3 ,
.Xr ASN1_UNIVERSALSTRING_to_string 3 ,
.Xr d2i_ASN1_OBJECT 3 ,
.Xr d2i_ASN1_OCTET_STRING 3 ,
.Xr i2a_ASN1_STRING 3 ,
.Xr X509_cmp_time 3 ,
.Xr X509_EXTENSION_get_object 3 ,
.Xr X509_get_ext_by_OBJ 3 ,
.Xr X509_NAME_ENTRY_get_object 3
.Sh HISTORY
.Fn ASN1_OCTET_STRING_new ,
.Fn ASN1_OCTET_STRING_free ,
.Fn ASN1_BIT_STRING_new ,
.Fn ASN1_BIT_STRING_free ,
.Fn ASN1_INTEGER_new ,
.Fn ASN1_INTEGER_free ,
.Fn ASN1_IA5STRING_new ,
.Fn ASN1_IA5STRING_free ,
.Fn ASN1_T61STRING_new ,
.Fn ASN1_T61STRING_free ,
.Fn ASN1_PRINTABLESTRING_new ,
.Fn ASN1_PRINTABLESTRING_free ,
.Fn ASN1_PRINTABLE_new ,
.Fn ASN1_PRINTABLE_free ,
.Fn ASN1_UTCTIME_new ,
and
.Fn ASN1_UTCTIME_free
first appeared in SSLeay 0.5.1.
.Fn ASN1_STRING_new ,
.Fn ASN1_STRING_type_new ,
and
.Fn ASN1_STRING_free
first appeared in SSLeay 0.6.5.
.Fn ASN1_UNIVERSALSTRING_new ,
.Fn ASN1_UNIVERSALSTRING_free ,
.Fn ASN1_GENERALSTRING_new ,
and
.Fn ASN1_GENERALSTRING_free
first appeared in SSLeay 0.8.0.
.Fn ASN1_BMPSTRING_new ,
.Fn ASN1_BMPSTRING_free ,
.Fn ASN1_GENERALIZEDTIME_new ,
and
.Fn ASN1_GENERALIZEDTIME_free
first appeared in SSLeay 0.9.0.
All these functions have been available since
.Ox 2.4 .
.Pp
.Fn ASN1_ENUMERATED_new ,
.Fn ASN1_ENUMERATED_free ,
.Fn ASN1_TIME_new ,
and
.Fn ASN1_TIME_free
first appeared in OpenSSL 0.9.2b.
.Fn ASN1_UTF8STRING_new ,
.Fn ASN1_UTF8STRING_free ,
.Fn ASN1_VISIBLESTRING_new ,
.Fn ASN1_VISIBLESTRING_free ,
.Fn DIRECTORYSTRING_new ,
.Fn DIRECTORYSTRING_free ,
.Fn DISPLAYTEXT_new ,
and
.Fn DISPLAYTEXT_free
first appeared in OpenSSL 0.9.3.
These functions have been available since
.Ox 2.6 .
.Sh BUGS
.Vt ASN1_OCTET_STRING ,
.Vt ASN1_BIT_STRING ,
.Vt ASN1_INTEGER ,
.Vt ASN1_ENUMERATED ,
.Vt ASN1_UTF8STRING ,
.Vt ASN1_IA5STRING ,
.Vt ASN1_UNIVERSALSTRING ,
.Vt ASN1_BMPSTRING ,
.Vt ASN1_GENERALSTRING ,
.Vt ASN1_T61STRING ,
.Vt ASN1_VISIBLESTRING ,
.Vt ASN1_PRINTABLESTRING ,
.Vt ASN1_GENERALIZEDTIME ,
.Vt ASN1_UTCTIME ,
and
.Vt ASN1_TIME
are merely typedef aliases of
.Vt ASN1_STRING
and provide no type safety whatsoever.