xref: /freebsd/crypto/openssl/doc/man3/PKCS12_add1_attr_by_NID.pod (revision 1719886f6d08408b834d270c59ffcfd821c8f63a)
1=pod
2
3=head1 NAME
4
5PKCS12_add1_attr_by_NID, PKCS12_add1_attr_by_txt - Add an attribute to a PKCS#12
6safeBag structure
7
8=head1 SYNOPSIS
9
10 #include <openssl/pkcs12.h>
11
12 int PKCS12_add1_attr_by_NID(PKCS12_SAFEBAG *bag, int nid, int type,
13                             const unsigned char *bytes, int len);
14 int PKCS12_add1_attr_by_txt(PKCS12_SAFEBAG *bag, const char *attrname, int type,
15                             const unsigned char *bytes, int len);
16
17=head1 DESCRIPTION
18
19These functions add a PKCS#12 Attribute to the Attribute Set of the B<bag>.
20
21PKCS12_add1_attr_by_NID() adds an attribute of type B<nid> with a value of ASN1
22type B<type> constructed using B<len> bytes from B<bytes>.
23
24PKCS12_add1_attr_by_txt() adds an attribute of type B<attrname> with a value of
25ASN1 type B<type> constructed using B<len> bytes from B<bytes>.
26
27=head1 NOTES
28
29These functions do not check whether an existing attribute of the same type is
30present. There can be multiple attributes with the same type assigned to a
31safeBag.
32
33Both functions were added in OpenSSL 3.0.
34
35=head1 RETURN VALUES
36
37A return value of 1 indicates success, 0 indicates failure.
38
39=head1 SEE ALSO
40
41L<PKCS12_create(3)>
42
43=head1 COPYRIGHT
44
45Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
46
47Licensed under the Apache License 2.0 (the "License").  You may not use
48this file except in compliance with the License.  You can obtain a copy
49in the file LICENSE in the source distribution or at
50L<https://www.openssl.org/source/license.html>.
51
52=cut
53