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 OSSL_STORE_INFO, OSSL_STORE_INFO_get_type, OSSL_STORE_INFO_get0_NAME,
      6  1.1.1.3  christos OSSL_STORE_INFO_get0_NAME_description,
      7  1.1.1.3  christos OSSL_STORE_INFO_get0_PARAMS, OSSL_STORE_INFO_get0_PUBKEY,
      8      1.1  christos OSSL_STORE_INFO_get0_PKEY, OSSL_STORE_INFO_get0_CERT, OSSL_STORE_INFO_get0_CRL,
      9      1.1  christos OSSL_STORE_INFO_get1_NAME, OSSL_STORE_INFO_get1_NAME_description,
     10  1.1.1.3  christos OSSL_STORE_INFO_get1_PARAMS, OSSL_STORE_INFO_get1_PUBKEY,
     11  1.1.1.3  christos OSSL_STORE_INFO_get1_PKEY, OSSL_STORE_INFO_get1_CERT, OSSL_STORE_INFO_get1_CRL,
     12  1.1.1.3  christos OSSL_STORE_INFO_type_string, OSSL_STORE_INFO_free,
     13      1.1  christos OSSL_STORE_INFO_new_NAME, OSSL_STORE_INFO_set0_NAME_description,
     14  1.1.1.3  christos OSSL_STORE_INFO_new_PARAMS, OSSL_STORE_INFO_new_PUBKEY,
     15  1.1.1.3  christos OSSL_STORE_INFO_new_PKEY, OSSL_STORE_INFO_new_CERT, OSSL_STORE_INFO_new_CRL,
     16  1.1.1.3  christos OSSL_STORE_INFO_new, OSSL_STORE_INFO_get0_data
     17  1.1.1.3  christos - Functions to manipulate OSSL_STORE_INFO objects
     18      1.1  christos 
     19      1.1  christos =head1 SYNOPSIS
     20      1.1  christos 
     21      1.1  christos  #include <openssl/store.h>
     22      1.1  christos 
     23      1.1  christos  typedef struct ossl_store_info_st OSSL_STORE_INFO;
     24      1.1  christos 
     25      1.1  christos  int OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *store_info);
     26      1.1  christos  const char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *store_info);
     27      1.1  christos  char *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *store_info);
     28      1.1  christos  const char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO
     29      1.1  christos                                                    *store_info);
     30      1.1  christos  char *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *store_info);
     31      1.1  christos  EVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *store_info);
     32      1.1  christos  EVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *store_info);
     33  1.1.1.3  christos  EVP_PKEY *OSSL_STORE_INFO_get0_PUBKEY(const OSSL_STORE_INFO *info);
     34  1.1.1.3  christos  EVP_PKEY *OSSL_STORE_INFO_get1_PUBKEY(const OSSL_STORE_INFO *info);
     35      1.1  christos  EVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *store_info);
     36      1.1  christos  EVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *store_info);
     37      1.1  christos  X509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *store_info);
     38      1.1  christos  X509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *store_info);
     39      1.1  christos  X509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *store_info);
     40      1.1  christos  X509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *store_info);
     41      1.1  christos 
     42      1.1  christos  const char *OSSL_STORE_INFO_type_string(int type);
     43      1.1  christos 
     44      1.1  christos  void OSSL_STORE_INFO_free(OSSL_STORE_INFO *store_info);
     45      1.1  christos 
     46      1.1  christos  OSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name);
     47      1.1  christos  int OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc);
     48      1.1  christos  OSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(DSA *dsa_params);
     49  1.1.1.3  christos  OSSL_STORE_INFO *OSSL_STORE_INFO_new_PUBKEY(EVP_PKEY *pubkey);
     50      1.1  christos  OSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey);
     51      1.1  christos  OSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509);
     52      1.1  christos  OSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl);
     53      1.1  christos 
     54  1.1.1.3  christos  OSSL_STORE_INFO *OSSL_STORE_INFO_new(int type, void *data);
     55  1.1.1.3  christos  void *OSSL_STORE_INFO_get0_data(int type, const OSSL_STORE_INFO *info);
     56  1.1.1.3  christos 
     57      1.1  christos =head1 DESCRIPTION
     58      1.1  christos 
     59      1.1  christos These functions are primarily useful for applications to retrieve
     60      1.1  christos supported objects from B<OSSL_STORE_INFO> objects and for scheme specific
     61      1.1  christos loaders to create B<OSSL_STORE_INFO> holders.
     62      1.1  christos 
     63      1.1  christos =head2 Types
     64      1.1  christos 
     65      1.1  christos B<OSSL_STORE_INFO> is an opaque type that's just an intermediary holder for
     66  1.1.1.3  christos the objects that have been retrieved by OSSL_STORE_load() and similar functions.
     67      1.1  christos Supported OpenSSL type object can be extracted using one of
     68  1.1.1.3  christos STORE_INFO_get0_<TYPE>() where <TYPE> can be NAME, PARAMS, PKEY, CERT, or CRL.
     69      1.1  christos The life time of this extracted object is as long as the life time of
     70      1.1  christos the B<OSSL_STORE_INFO> it was extracted from, so care should be taken not
     71      1.1  christos to free the latter too early.
     72  1.1.1.3  christos As an alternative, STORE_INFO_get1_<TYPE>() extracts a duplicate (or the
     73      1.1  christos same object with its reference count increased), which can be used
     74      1.1  christos after the containing B<OSSL_STORE_INFO> has been freed.
     75  1.1.1.3  christos The object returned by STORE_INFO_get1_<TYPE>() must be freed separately
     76      1.1  christos by the caller.
     77  1.1.1.3  christos See L</SUPPORTED OBJECTS> for more information on the types that are supported.
     78      1.1  christos 
     79      1.1  christos =head2 Functions
     80      1.1  christos 
     81      1.1  christos OSSL_STORE_INFO_get_type() takes a B<OSSL_STORE_INFO> and returns the STORE
     82      1.1  christos type number for the object inside.
     83  1.1.1.3  christos 
     84      1.1  christos STORE_INFO_get_type_string() takes a STORE type number and returns a
     85      1.1  christos short string describing it.
     86      1.1  christos 
     87      1.1  christos OSSL_STORE_INFO_get0_NAME(), OSSL_STORE_INFO_get0_NAME_description(),
     88  1.1.1.3  christos OSSL_STORE_INFO_get0_PARAMS(), OSSL_STORE_INFO_get0_PUBKEY(),
     89  1.1.1.3  christos OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(),
     90  1.1.1.3  christos OSSL_STORE_INFO_get0_CRL()
     91  1.1.1.3  christos all take a B<OSSL_STORE_INFO> and return the object it holds if the
     92  1.1.1.3  christos B<OSSL_STORE_INFO> type (as returned by OSSL_STORE_INFO_get_type())
     93  1.1.1.3  christos matches the function, otherwise NULL.
     94      1.1  christos 
     95      1.1  christos OSSL_STORE_INFO_get1_NAME(), OSSL_STORE_INFO_get1_NAME_description(),
     96  1.1.1.3  christos OSSL_STORE_INFO_get1_PARAMS(), OSSL_STORE_INFO_get1_PUBKEY(),
     97  1.1.1.3  christos OSSL_STORE_INFO_get1_PKEY(), OSSL_STORE_INFO_get1_CERT() and
     98  1.1.1.3  christos OSSL_STORE_INFO_get1_CRL()
     99  1.1.1.3  christos all take a B<OSSL_STORE_INFO> and return a duplicate the object it
    100  1.1.1.3  christos holds if the B<OSSL_STORE_INFO> type (as returned by
    101  1.1.1.3  christos OSSL_STORE_INFO_get_type()) matches the function, otherwise NULL.
    102      1.1  christos 
    103      1.1  christos OSSL_STORE_INFO_free() frees a B<OSSL_STORE_INFO> and its contained type.
    104  1.1.1.4  christos If the argument is NULL, nothing is done.
    105      1.1  christos 
    106      1.1  christos OSSL_STORE_INFO_new_NAME() , OSSL_STORE_INFO_new_PARAMS(),
    107  1.1.1.3  christos , OSSL_STORE_INFO_new_PUBKEY(), OSSL_STORE_INFO_new_PKEY(),
    108  1.1.1.3  christos OSSL_STORE_INFO_new_CERT() and OSSL_STORE_INFO_new_CRL()
    109  1.1.1.3  christos create a B<OSSL_STORE_INFO> object to hold the given input object.
    110  1.1.1.3  christos On success the input object is consumed.
    111  1.1.1.3  christos 
    112  1.1.1.3  christos Additionally, for B<OSSL_STORE_INFO_NAME> objects,
    113      1.1  christos OSSL_STORE_INFO_set0_NAME_description() can be used to add an extra
    114      1.1  christos description.
    115      1.1  christos This description is meant to be human readable and should be used for
    116      1.1  christos information printout.
    117      1.1  christos 
    118  1.1.1.3  christos OSSL_STORE_INFO_new() creates a B<OSSL_STORE_INFO> with an arbitrary I<type>
    119  1.1.1.3  christos number and I<data> structure.  It's the responsibility of the caller to
    120  1.1.1.3  christos define type numbers other than the ones defined by F<< <openssl/store.h> >>,
    121  1.1.1.3  christos and to handle freeing the associated data structure on their own.
    122  1.1.1.3  christos I<Using type numbers that are defined by F<< <openssl/store.h> >> may cause
    123  1.1.1.3  christos undefined behaviours, including crashes>.
    124  1.1.1.3  christos 
    125  1.1.1.3  christos OSSL_STORE_INFO_get0_data() returns the data pointer that was passed to
    126  1.1.1.3  christos OSSL_STORE_INFO_new() if I<type> matches the type number in I<info>.
    127  1.1.1.3  christos 
    128  1.1.1.3  christos OSSL_STORE_INFO_new() and OSSL_STORE_INFO_get0_data() may be useful for
    129  1.1.1.3  christos applications that define their own STORE data, but must be used with care.
    130  1.1.1.3  christos 
    131      1.1  christos =head1 SUPPORTED OBJECTS
    132      1.1  christos 
    133      1.1  christos Currently supported object types are:
    134      1.1  christos 
    135      1.1  christos =over 4
    136      1.1  christos 
    137      1.1  christos =item OSSL_STORE_INFO_NAME
    138      1.1  christos 
    139      1.1  christos A name is exactly that, a name.
    140      1.1  christos It's like a name in a directory, but formatted as a complete URI.
    141      1.1  christos For example, the path in URI C<file:/foo/bar/> could include a file
    142      1.1  christos named C<cookie.pem>, and in that case, the returned B<OSSL_STORE_INFO_NAME>
    143      1.1  christos object would have the URI C<file:/foo/bar/cookie.pem>, which can be
    144      1.1  christos used by the application to get the objects in that file.
    145      1.1  christos This can be applied to all schemes that can somehow support a listing
    146      1.1  christos of object URIs.
    147      1.1  christos 
    148      1.1  christos For C<file:> URIs that are used without the explicit scheme, the
    149      1.1  christos returned name will be the path of each object, so if C</foo/bar> was
    150      1.1  christos given and that path has the file C<cookie.pem>, the name
    151      1.1  christos C</foo/bar/cookie.pem> will be returned.
    152      1.1  christos 
    153      1.1  christos The returned URI is considered canonical and must be unique and permanent
    154      1.1  christos for the storage where the object (or collection of objects) resides.
    155      1.1  christos Each loader is responsible for ensuring that it only returns canonical
    156      1.1  christos URIs.
    157      1.1  christos However, it's possible that certain schemes allow an object (or collection
    158      1.1  christos thereof) to be reached with alternative URIs; just because one URI is
    159      1.1  christos canonical doesn't mean that other variants can't be used.
    160      1.1  christos 
    161      1.1  christos At the discretion of the loader that was used to get these names, an
    162      1.1  christos extra description may be attached as well.
    163      1.1  christos 
    164      1.1  christos =item OSSL_STORE_INFO_PARAMS
    165      1.1  christos 
    166      1.1  christos Key parameters.
    167      1.1  christos 
    168      1.1  christos =item OSSL_STORE_INFO_PKEY
    169      1.1  christos 
    170  1.1.1.3  christos A keypair or just a private key (possibly with key parameters).
    171  1.1.1.3  christos 
    172  1.1.1.3  christos =item OSSL_STORE_INFO_PUBKEY
    173  1.1.1.3  christos 
    174  1.1.1.3  christos A public key (possibly with key parameters).
    175      1.1  christos 
    176      1.1  christos =item OSSL_STORE_INFO_CERT
    177      1.1  christos 
    178      1.1  christos An X.509 certificate.
    179      1.1  christos 
    180      1.1  christos =item OSSL_STORE_INFO_CRL
    181      1.1  christos 
    182      1.1  christos A X.509 certificate revocation list.
    183      1.1  christos 
    184      1.1  christos =back
    185      1.1  christos 
    186      1.1  christos =head1 RETURN VALUES
    187      1.1  christos 
    188      1.1  christos OSSL_STORE_INFO_get_type() returns the STORE type number of the given
    189      1.1  christos B<OSSL_STORE_INFO>.
    190      1.1  christos There is no error value.
    191      1.1  christos 
    192      1.1  christos OSSL_STORE_INFO_get0_NAME(), OSSL_STORE_INFO_get0_NAME_description(),
    193      1.1  christos OSSL_STORE_INFO_get0_PARAMS(), OSSL_STORE_INFO_get0_PKEY(),
    194      1.1  christos OSSL_STORE_INFO_get0_CERT() and OSSL_STORE_INFO_get0_CRL() all return
    195      1.1  christos a pointer to the OpenSSL object on success, NULL otherwise.
    196      1.1  christos 
    197  1.1.1.3  christos OSSL_STORE_INFO_get1_NAME(), OSSL_STORE_INFO_get1_NAME_description(),
    198  1.1.1.3  christos OSSL_STORE_INFO_get1_PARAMS(), OSSL_STORE_INFO_get1_PKEY(),
    199  1.1.1.3  christos OSSL_STORE_INFO_get1_CERT() and OSSL_STORE_INFO_get1_CRL() all return
    200      1.1  christos a pointer to a duplicate of the OpenSSL object on success, NULL otherwise.
    201      1.1  christos 
    202  1.1.1.3  christos OSSL_STORE_INFO_type_string() returns a string on success, or NULL on
    203      1.1  christos failure.
    204      1.1  christos 
    205      1.1  christos OSSL_STORE_INFO_new_NAME(), OSSL_STORE_INFO_new_PARAMS(),
    206      1.1  christos OSSL_STORE_INFO_new_PKEY(), OSSL_STORE_INFO_new_CERT() and
    207      1.1  christos OSSL_STORE_INFO_new_CRL() return a B<OSSL_STORE_INFO>
    208  1.1.1.3  christos pointer on success, or NULL on failure.
    209      1.1  christos 
    210      1.1  christos OSSL_STORE_INFO_set0_NAME_description() returns 1 on success, or 0 on
    211      1.1  christos failure.
    212      1.1  christos 
    213      1.1  christos =head1 SEE ALSO
    214      1.1  christos 
    215      1.1  christos L<ossl_store(7)>, L<OSSL_STORE_open(3)>, L<OSSL_STORE_register_loader(3)>
    216      1.1  christos 
    217      1.1  christos =head1 HISTORY
    218      1.1  christos 
    219  1.1.1.3  christos The OSSL_STORE API was added in OpenSSL 1.1.1.
    220  1.1.1.3  christos 
    221  1.1.1.3  christos The OSSL_STORE_INFO_PUBKEY object type was added in OpenSSL 3.0.
    222      1.1  christos 
    223      1.1  christos =head1 COPYRIGHT
    224      1.1  christos 
    225  1.1.1.4  christos Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
    226      1.1  christos 
    227  1.1.1.3  christos Licensed under the Apache License 2.0 (the "License").  You may not use
    228      1.1  christos this file except in compliance with the License.  You can obtain a copy
    229      1.1  christos in the file LICENSE in the source distribution or at
    230      1.1  christos L<https://www.openssl.org/source/license.html>.
    231      1.1  christos 
    232      1.1  christos =cut
    233