xref: /freebsd/crypto/openssl/doc/man3/PKCS8_pkey_add1_attr.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1*b077aed3SPierre Pronchery=pod
2*b077aed3SPierre Pronchery
3*b077aed3SPierre Pronchery=head1 NAME
4*b077aed3SPierre Pronchery
5*b077aed3SPierre ProncheryPKCS8_pkey_get0_attrs, PKCS8_pkey_add1_attr, PKCS8_pkey_add1_attr_by_NID, PKCS8_pkey_add1_attr_by_OBJ - PKCS8 attribute functions
6*b077aed3SPierre Pronchery
7*b077aed3SPierre Pronchery=head1 SYNOPSIS
8*b077aed3SPierre Pronchery
9*b077aed3SPierre Pronchery #include <openssl/x509.h>
10*b077aed3SPierre Pronchery
11*b077aed3SPierre Pronchery const STACK_OF(X509_ATTRIBUTE) *
12*b077aed3SPierre Pronchery PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8);
13*b077aed3SPierre Pronchery int PKCS8_pkey_add1_attr(PKCS8_PRIV_KEY_INFO *p8, X509_ATTRIBUTE *attr);
14*b077aed3SPierre Pronchery int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type,
15*b077aed3SPierre Pronchery                                 const unsigned char *bytes, int len);
16*b077aed3SPierre Pronchery int PKCS8_pkey_add1_attr_by_OBJ(PKCS8_PRIV_KEY_INFO *p8, const ASN1_OBJECT *obj,
17*b077aed3SPierre Pronchery                                int type, const unsigned char *bytes, int len);
18*b077aed3SPierre Pronchery
19*b077aed3SPierre Pronchery=head1 DESCRIPTION
20*b077aed3SPierre Pronchery
21*b077aed3SPierre ProncheryPKCS8_pkey_get0_attrs() returns a const STACK of X509_ATTRIBUTE present in
22*b077aed3SPierre Proncherythe passed const PKCS8_PRIV_KEY_INFO structure B<p8>.
23*b077aed3SPierre Pronchery
24*b077aed3SPierre ProncheryPKCS8_pkey_add1_attr() adds a constructed X509_ATTRIBUTE B<attr> to the
25*b077aed3SPierre Proncheryexisting PKCS8_PRIV_KEY_INFO structure B<p8>.
26*b077aed3SPierre Pronchery
27*b077aed3SPierre ProncheryPKCS8_pkey_add1_attr_by_NID() and PKCS8_pkey_add1_attr_by_OBJ() construct a new
28*b077aed3SPierre ProncheryX509_ATTRIBUTE from the passed arguments and add it to the existing
29*b077aed3SPierre ProncheryPKCS8_PRIV_KEY_INFO structure B<p8>.
30*b077aed3SPierre Pronchery
31*b077aed3SPierre Pronchery=head1 RETURN VALUES
32*b077aed3SPierre Pronchery
33*b077aed3SPierre ProncheryPKCS8_pkey_add1_attr(), PKCS8_pkey_add1_attr_by_NID(), and
34*b077aed3SPierre ProncheryPKCS8_pkey_add1_attr_by_OBJ() return 1 for success and 0 for failure.
35*b077aed3SPierre Pronchery
36*b077aed3SPierre Pronchery=head1 NOTES
37*b077aed3SPierre Pronchery
38*b077aed3SPierre ProncherySTACK of X509_ATTRIBUTE is present in many X509-related structures and some of
39*b077aed3SPierre Proncherythem have the corresponding set of similar functions.
40*b077aed3SPierre Pronchery
41*b077aed3SPierre Pronchery=head1 SEE ALSO
42*b077aed3SPierre Pronchery
43*b077aed3SPierre ProncheryL<crypto(7)>
44*b077aed3SPierre Pronchery
45*b077aed3SPierre Pronchery=head1 COPYRIGHT
46*b077aed3SPierre Pronchery
47*b077aed3SPierre ProncheryCopyright 2020 The OpenSSL Project Authors. All Rights Reserved.
48*b077aed3SPierre Pronchery
49*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
50*b077aed3SPierre Proncherythis file except in compliance with the License.  You can obtain a copy
51*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at
52*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>.
53*b077aed3SPierre Pronchery
54*b077aed3SPierre Pronchery=cut
55