summaryrefslogtreecommitdiff
path: root/lib/libcrypto/man/X509at_add1_attr.3
blob: 3d29c56ef9633998b82486b0e1163515d5748e62 (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
.\" $OpenBSD: X509at_add1_attr.3,v 1.5 2021/10/26 12:56:48 schwarze Exp $
.\"
.\" Copyright (c) 2021 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: October 26 2021 $
.Dt X509AT_ADD1_ATTR 3
.Os
.Sh NAME
.Nm X509at_add1_attr ,
.Nm X509at_add1_attr_by_OBJ ,
.Nm X509at_add1_attr_by_NID ,
.Nm X509at_add1_attr_by_txt ,
.Nm X509at_delete_attr
.Nd change an array of X.501 Attribute objects
.Sh SYNOPSIS
.In openssl/x509.h
.Ft STACK_OF(X509_ATTRIBUTE) *
.Fo X509at_add1_attr
.Fa "STACK_OF(X509_ATTRIBUTE) **pattrs"
.Fa "X509_ATTRIBUTE *attr"
.Fc
.Ft STACK_OF(X509_ATTRIBUTE) *
.Fo X509at_add1_attr_by_OBJ
.Fa "STACK_OF(X509_ATTRIBUTE) **pattrs"
.Fa "const ASN1_OBJECT *obj"
.Fa "int type"
.Fa "const unsigned char *data"
.Fa "int len"
.Fc
.Ft STACK_OF(X509_ATTRIBUTE) *
.Fo X509at_add1_attr_by_NID
.Fa "STACK_OF(X509_ATTRIBUTE) **pattrs"
.Fa "int nid"
.Fa "int type"
.Fa "const unsigned char *data"
.Fa "int len"
.Fc
.Ft STACK_OF(X509_ATTRIBUTE) *
.Fo X509at_add1_attr_by_txt
.Fa "STACK_OF(X509_ATTRIBUTE) **pattrs"
.Fa "const char *name"
.Fa "int type"
.Fa "const unsigned char *data"
.Fa "int len"
.Fc
.Ft X509_ATTRIBUTE *
.Fo X509at_delete_attr
.Fa "STACK_OF(X509_ATTRIBUTE) *attrs"
.Fa "int index"
.Fc
.Sh DESCRIPTION
.Fn X509at_add1_attr
appends a deep copy of
.Fa attr
to the end of
.Pf ** Fa pattrs .
If
.Pf * Fa pattrs
is
.Dv NULL ,
a new array is allocated, and in case of success,
a pointer to it is assigned to
.Pf * Fa pattrs .
.Pp
.Fn X509at_add1_attr_by_OBJ ,
.Fn X509at_add1_attr_by_NID ,
and
.Fn X509at_add1_attr_by_txt
create a new X.501 Attribute object using
.Xr X509_ATTRIBUTE_create_by_OBJ 3 ,
.Xr X509_ATTRIBUTE_create_by_NID 3 ,
or
.Xr X509_ATTRIBUTE_create_by_txt 3 ,
respectively, and append it to
.Pf ** Fa pattrs
using
.Fn X509at_add1_attr .
.Pp
.Fn X509at_delete_attr
deletes the element with the zero-based
.Fa index
from the array
.Pf * Fa attrs .
.Sh RETURN VALUES
.Fn X509at_add1_attr ,
.Fn X509at_add1_attr_by_OBJ ,
.Fn X509at_add1_attr_by_NID ,
and
.Fn X509at_add1_attr_by_txt
return a pointer to the modified or new array or
.Dv NULL
if the
.Fa pattrs
argument is
.Dv NULL
or if creating or copying the X.501 Attribute object
or memory allocation fails.
.Pp
.Fn X509at_delete_attr
returns the deleted element or
.Dv NULL
if
.Fa attrs
is
.Dv NULL
or if the requested
.Fa index
is negative or greater than or equal to the number of objects in
.Pf * Fa attrs .
.Sh SEE ALSO
.Xr EVP_PKEY_add1_attr 3 ,
.Xr OBJ_nid2obj 3 ,
.Xr PKCS8_pkey_add1_attr_by_NID 3 ,
.Xr STACK_OF 3 ,
.Xr X509_ATTRIBUTE_create_by_OBJ 3 ,
.Xr X509_ATTRIBUTE_new 3 ,
.Xr X509_REQ_add1_attr 3 ,
.Xr X509at_get_attr 3
.Sh HISTORY
These functions first appeared in OpenSSL 0.9.5
and have been available since
.Ox 2.7 .