Add X509_NAME_hash_ex() to be able to check if it failed due to unsupported SHA1
[openssl.git] / doc / man3 / PKCS12_add1_attr_by_NID.pod
1 =pod
2
3 =head1 NAME
4
5 PKCS12_add1_attr_by_NID, PKCS12_add1_attr_by_txt - Add an attribute to a PKCS#12
6 safeBag 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
19 These functions add a PKCS#12 Attribute to the Attribute Set of the B<bag>.
20
21 PKCS12_add1_attr_by_NID() adds an attribute of type B<nid> with a value of ASN1
22 type B<type> constructed using B<len> bytes from B<bytes>.
23
24 PKCS12_add1_attr_by_txt() adds an attribute of type B<attrname> with a value of
25 ASN1 type B<type> constructed using B<len> bytes from B<bytes>.
26
27 =head1 NOTES
28
29 These functions do not check whether an existing attribute of the same type is
30 present. There can be multiple attributes with the same type assigned to a
31 safeBag.
32
33 Both functions were added in OpenSSL 3.0.
34
35 =head1 RETURN VALUES
36
37 A return value of 1 indicates success, 0 indicates failure.
38
39 =head1 SEE ALSO
40
41 L<PKCS12_create(3)>
42
43 =head1 COPYRIGHT
44
45 Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
46
47 Licensed under the Apache License 2.0 (the "License").  You may not use
48 this file except in compliance with the License.  You can obtain a copy
49 in the file LICENSE in the source distribution or at
50 L<https://www.openssl.org/source/license.html>.
51
52 =cut