Home | History | Annotate | Line # | Download | only in man3
      1  1.1  christos =pod
      2  1.1  christos 
      3  1.1  christos =head1 NAME
      4  1.1  christos 
      5  1.1  christos PKCS12_add_cert, PKCS12_add_key, PKCS12_add_key_ex,
      6  1.1  christos PKCS12_add_secret - Add an object to a set of PKCS#12 safeBags
      7  1.1  christos 
      8  1.1  christos =head1 SYNOPSIS
      9  1.1  christos 
     10  1.1  christos  #include <openssl/pkcs12.h>
     11  1.1  christos 
     12  1.1  christos  PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert);
     13  1.1  christos  PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags,
     14  1.1  christos                                EVP_PKEY *key, int key_usage, int iter,
     15  1.1  christos                                int key_nid, const char *pass);
     16  1.1  christos  PKCS12_SAFEBAG *PKCS12_add_key_ex(STACK_OF(PKCS12_SAFEBAG) **pbags,
     17  1.1  christos                                    EVP_PKEY *key, int key_usage, int iter,
     18  1.1  christos                                    int key_nid, const char *pass,
     19  1.1  christos                                    OSSL_LIB_CTX *ctx, const char *propq);
     20  1.1  christos 
     21  1.1  christos  PKCS12_SAFEBAG *PKCS12_add_secret(STACK_OF(PKCS12_SAFEBAG) **pbags,
     22  1.1  christos                                   int nid_type, const unsigned char *value, int len);
     23  1.1  christos 
     24  1.1  christos =head1 DESCRIPTION
     25  1.1  christos 
     26  1.1  christos These functions create a new B<PKCS12_SAFEBAG> and add it to the set of safeBags
     27  1.1  christos in I<pbags>.
     28  1.1  christos 
     29  1.1  christos PKCS12_add_cert() creates a PKCS#12 certBag containing the supplied
     30  1.1  christos certificate and adds this to the set of PKCS#12 safeBags.
     31  1.1  christos 
     32  1.1  christos PKCS12_add_key() creates a PKCS#12 keyBag (unencrypted) or a pkcs8shroudedKeyBag
     33  1.1  christos (encrypted) containing the supplied B<EVP_PKEY> and adds this to the set of PKCS#12
     34  1.1  christos safeBags. If I<key_nid> is not -1 then the key is encrypted with the supplied
     35  1.1  christos algorithm, using I<pass> as the passphrase and I<iter> as the iteration count. If
     36  1.1  christos I<iter> is zero then a default value for iteration count of 2048 is used.
     37  1.1  christos 
     38  1.1  christos PKCS12_add_key_ex() is identical to PKCS12_add_key() but allows for a library
     39  1.1  christos context I<ctx> and property query I<propq> to be used to select algorithm
     40  1.1  christos implementations.
     41  1.1  christos 
     42  1.1  christos PKCS12_add_secret() creates a PKCS#12 secretBag with an OID corresponding to
     43  1.1  christos the supplied I<nid_type> containing the supplied value as an ASN1 octet string.
     44  1.1  christos This is then added to the set of PKCS#12 safeBags.
     45  1.1  christos 
     46  1.1  christos =head1 NOTES
     47  1.1  christos 
     48  1.1  christos If a certificate contains an I<alias> or a I<keyid> then this will be
     49  1.1  christos used for the corresponding B<friendlyName> or B<localKeyID> in the
     50  1.1  christos PKCS12 structure.
     51  1.1  christos 
     52  1.1  christos PKCS12_add_key() makes assumptions regarding the encoding of the given pass
     53  1.1  christos phrase.
     54  1.1  christos See L<passphrase-encoding(7)> for more information.
     55  1.1  christos 
     56  1.1  christos =head1 RETURN VALUES
     57  1.1  christos 
     58  1.1  christos A valid B<PKCS12_SAFEBAG> structure or NULL if an error occurred.
     59  1.1  christos 
     60  1.1  christos =head1 CONFORMING TO
     61  1.1  christos 
     62  1.1  christos IETF RFC 7292 (L<https://tools.ietf.org/html/rfc7292>)
     63  1.1  christos 
     64  1.1  christos =head1 SEE ALSO
     65  1.1  christos 
     66  1.1  christos L<PKCS12_create(3)>
     67  1.1  christos 
     68  1.1  christos =head1 HISTORY
     69  1.1  christos 
     70  1.1  christos PKCS12_add_secret() and PKCS12_add_key_ex() were added in OpenSSL 3.0.
     71  1.1  christos 
     72  1.1  christos =head1 COPYRIGHT
     73  1.1  christos 
     74  1.1  christos Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
     75  1.1  christos 
     76  1.1  christos Licensed under the Apache License 2.0 (the "License").  You may not use
     77  1.1  christos this file except in compliance with the License.  You can obtain a copy
     78  1.1  christos in the file LICENSE in the source distribution or at
     79  1.1  christos L<https://www.openssl.org/source/license.html>.
     80  1.1  christos 
     81  1.1  christos =cut
     82