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_SEARCH,
      6      1.1  christos OSSL_STORE_SEARCH_by_name,
      7      1.1  christos OSSL_STORE_SEARCH_by_issuer_serial,
      8      1.1  christos OSSL_STORE_SEARCH_by_key_fingerprint,
      9      1.1  christos OSSL_STORE_SEARCH_by_alias,
     10      1.1  christos OSSL_STORE_SEARCH_free,
     11      1.1  christos OSSL_STORE_SEARCH_get_type,
     12      1.1  christos OSSL_STORE_SEARCH_get0_name,
     13      1.1  christos OSSL_STORE_SEARCH_get0_serial,
     14      1.1  christos OSSL_STORE_SEARCH_get0_bytes,
     15      1.1  christos OSSL_STORE_SEARCH_get0_string,
     16      1.1  christos OSSL_STORE_SEARCH_get0_digest
     17      1.1  christos - Type and functions to create OSSL_STORE search criteria
     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_search_st OSSL_STORE_SEARCH;
     24      1.1  christos 
     25      1.1  christos  OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name);
     26      1.1  christos  OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name,
     27      1.1  christos                                                        const ASN1_INTEGER
     28      1.1  christos                                                        *serial);
     29      1.1  christos  OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest,
     30      1.1  christos                                                          const unsigned char
     31      1.1  christos                                                          *bytes, int len);
     32      1.1  christos  OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias);
     33      1.1  christos 
     34      1.1  christos  void OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search);
     35      1.1  christos 
     36      1.1  christos  int OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion);
     37      1.1  christos  X509_NAME *OSSL_STORE_SEARCH_get0_name(OSSL_STORE_SEARCH *criterion);
     38      1.1  christos  const ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH
     39      1.1  christos                                                    *criterion);
     40      1.1  christos  const unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH
     41      1.1  christos                                                    *criterion, size_t *length);
     42      1.1  christos  const char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion);
     43      1.1  christos  const EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH
     44      1.1  christos                                              *criterion);
     45      1.1  christos 
     46      1.1  christos =head1 DESCRIPTION
     47      1.1  christos 
     48      1.1  christos These functions are used to specify search criteria to help search for specific
     49      1.1  christos objects through other names than just the URI that's given to OSSL_STORE_open().
     50      1.1  christos For example, this can be useful for an application that has received a URI
     51      1.1  christos and then wants to add on search criteria in a uniform and supported manner.
     52      1.1  christos 
     53      1.1  christos =head2 Types
     54      1.1  christos 
     55      1.1  christos B<OSSL_STORE_SEARCH> is an opaque type that holds the constructed search
     56      1.1  christos criterion, and that can be given to an OSSL_STORE context with
     57      1.1  christos OSSL_STORE_find().
     58      1.1  christos 
     59      1.1  christos The calling application owns the allocation of an B<OSSL_STORE_SEARCH> at all
     60      1.1  christos times, and should therefore be careful not to deallocate it before
     61      1.1  christos OSSL_STORE_close() has been called for the OSSL_STORE context it was given
     62      1.1  christos to.
     63      1.1  christos 
     64      1.1  christos =head2 Application Functions
     65      1.1  christos 
     66      1.1  christos OSSL_STORE_SEARCH_by_name(),
     67      1.1  christos OSSL_STORE_SEARCH_by_issuer_serial(),
     68      1.1  christos OSSL_STORE_SEARCH_by_key_fingerprint(),
     69      1.1  christos and OSSL_STORE_SEARCH_by_alias()
     70      1.1  christos are used to create an B<OSSL_STORE_SEARCH> from a subject name, an issuer name
     71      1.1  christos and serial number pair, a key fingerprint, and an alias (for example a friendly
     72      1.1  christos name).
     73      1.1  christos The parameters that are provided are not copied, only referred to in a
     74      1.1  christos criterion, so they must have at least the same life time as the created
     75      1.1  christos B<OSSL_STORE_SEARCH>.
     76      1.1  christos 
     77      1.1  christos OSSL_STORE_SEARCH_free() is used to free the B<OSSL_STORE_SEARCH>.
     78  1.1.1.4  christos If the argument is NULL, nothing is done.
     79      1.1  christos 
     80      1.1  christos =head2 Loader Functions
     81      1.1  christos 
     82      1.1  christos OSSL_STORE_SEARCH_get_type() returns the criterion type for the given
     83      1.1  christos B<OSSL_STORE_SEARCH>.
     84      1.1  christos 
     85      1.1  christos OSSL_STORE_SEARCH_get0_name(), OSSL_STORE_SEARCH_get0_serial(),
     86      1.1  christos OSSL_STORE_SEARCH_get0_bytes(), OSSL_STORE_SEARCH_get0_string(),
     87      1.1  christos and OSSL_STORE_SEARCH_get0_digest()
     88      1.1  christos are used to retrieve different data from a B<OSSL_STORE_SEARCH>, as
     89      1.1  christos available for each type.
     90      1.1  christos For more information, see L</SUPPORTED CRITERION TYPES> below.
     91      1.1  christos 
     92      1.1  christos =head1 SUPPORTED CRITERION TYPES
     93      1.1  christos 
     94      1.1  christos Currently supported criterion types are:
     95      1.1  christos 
     96      1.1  christos =over 4
     97      1.1  christos 
     98      1.1  christos =item OSSL_STORE_SEARCH_BY_NAME
     99      1.1  christos 
    100      1.1  christos This criterion supports a search by exact match of subject name.
    101      1.1  christos The subject name itself is a B<X509_NAME> pointer.
    102      1.1  christos A criterion of this type is created with OSSL_STORE_SEARCH_by_name(),
    103      1.1  christos and the actual subject name is retrieved with OSSL_STORE_SEARCH_get0_name().
    104      1.1  christos 
    105      1.1  christos =item OSSL_STORE_SEARCH_BY_ISSUER_SERIAL
    106      1.1  christos 
    107      1.1  christos This criterion supports a search by exact match of both issuer name and serial
    108      1.1  christos number.
    109      1.1  christos The issuer name itself is a B<X509_NAME> pointer, and the serial number is
    110      1.1  christos a B<ASN1_INTEGER> pointer.
    111      1.1  christos A criterion of this type is created with OSSL_STORE_SEARCH_by_issuer_serial()
    112      1.1  christos and the actual issuer name and serial number are retrieved with
    113      1.1  christos OSSL_STORE_SEARCH_get0_name() and OSSL_STORE_SEARCH_get0_serial().
    114      1.1  christos 
    115      1.1  christos =item OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT
    116      1.1  christos 
    117      1.1  christos This criterion supports a search by exact match of key fingerprint.
    118      1.1  christos The key fingerprint in itself is a string of bytes and its length, as
    119      1.1  christos well as the algorithm that was used to compute the fingerprint.
    120      1.1  christos The digest may be left unspecified (NULL), and in that case, the
    121      1.1  christos loader has to decide on a default digest and compare fingerprints
    122      1.1  christos accordingly.
    123      1.1  christos A criterion of this type is created with OSSL_STORE_SEARCH_by_key_fingerprint()
    124      1.1  christos and the actual fingerprint and its length can be retrieved with
    125      1.1  christos OSSL_STORE_SEARCH_get0_bytes().
    126      1.1  christos The digest can be retrieved with OSSL_STORE_SEARCH_get0_digest().
    127      1.1  christos 
    128      1.1  christos =item OSSL_STORE_SEARCH_BY_ALIAS
    129      1.1  christos 
    130      1.1  christos This criterion supports a search by match of an alias of some kind.
    131      1.1  christos The alias in itself is a simple C string.
    132      1.1  christos A criterion of this type is created with OSSL_STORE_SEARCH_by_alias()
    133      1.1  christos and the actual alias is retrieved with OSSL_STORE_SEARCH_get0_string().
    134      1.1  christos 
    135      1.1  christos =back
    136      1.1  christos 
    137      1.1  christos =head1 RETURN VALUES
    138      1.1  christos 
    139      1.1  christos OSSL_STORE_SEARCH_by_name(),
    140      1.1  christos OSSL_STORE_SEARCH_by_issuer_serial(),
    141      1.1  christos OSSL_STORE_SEARCH_by_key_fingerprint(),
    142      1.1  christos and OSSL_STORE_SEARCH_by_alias()
    143  1.1.1.3  christos return a B<OSSL_STORE_SEARCH> pointer on success, or NULL on failure.
    144      1.1  christos 
    145      1.1  christos OSSL_STORE_SEARCH_get_type() returns the criterion type of the given
    146      1.1  christos B<OSSL_STORE_SEARCH>.
    147      1.1  christos There is no error value.
    148      1.1  christos 
    149      1.1  christos OSSL_STORE_SEARCH_get0_name() returns a B<X509_NAME> pointer on success,
    150  1.1.1.3  christos or NULL when the given B<OSSL_STORE_SEARCH> was of a different type.
    151      1.1  christos 
    152      1.1  christos OSSL_STORE_SEARCH_get0_serial() returns a B<ASN1_INTEGER> pointer on success,
    153  1.1.1.3  christos or NULL when the given B<OSSL_STORE_SEARCH> was of a different type.
    154      1.1  christos 
    155      1.1  christos OSSL_STORE_SEARCH_get0_bytes() returns a B<const unsigned char> pointer and
    156  1.1.1.3  christos sets I<*length> to the strings length on success, or NULL when the given
    157      1.1  christos B<OSSL_STORE_SEARCH> was of a different type.
    158      1.1  christos 
    159      1.1  christos OSSL_STORE_SEARCH_get0_string() returns a B<const char> pointer on success,
    160  1.1.1.3  christos or NULL when the given B<OSSL_STORE_SEARCH> was of a different type.
    161      1.1  christos 
    162      1.1  christos OSSL_STORE_SEARCH_get0_digest() returns a B<const EVP_MD> pointer.
    163  1.1.1.3  christos NULL is a valid value and means that the store loader default will
    164      1.1  christos be used when applicable.
    165      1.1  christos 
    166      1.1  christos =head1 SEE ALSO
    167      1.1  christos 
    168      1.1  christos L<ossl_store(7)>, L<OSSL_STORE_supports_search(3)>, L<OSSL_STORE_find(3)>
    169      1.1  christos 
    170      1.1  christos =head1 HISTORY
    171      1.1  christos 
    172      1.1  christos B<OSSL_STORE_SEARCH>,
    173      1.1  christos OSSL_STORE_SEARCH_by_name(),
    174      1.1  christos OSSL_STORE_SEARCH_by_issuer_serial(),
    175      1.1  christos OSSL_STORE_SEARCH_by_key_fingerprint(),
    176      1.1  christos OSSL_STORE_SEARCH_by_alias(),
    177      1.1  christos OSSL_STORE_SEARCH_free(),
    178      1.1  christos OSSL_STORE_SEARCH_get_type(),
    179      1.1  christos OSSL_STORE_SEARCH_get0_name(),
    180      1.1  christos OSSL_STORE_SEARCH_get0_serial(),
    181      1.1  christos OSSL_STORE_SEARCH_get0_bytes(),
    182      1.1  christos and OSSL_STORE_SEARCH_get0_string()
    183  1.1.1.2  christos were added in OpenSSL 1.1.1.
    184      1.1  christos 
    185      1.1  christos =head1 COPYRIGHT
    186      1.1  christos 
    187  1.1.1.4  christos Copyright 2018-2024 The OpenSSL Project Authors. All Rights Reserved.
    188      1.1  christos 
    189  1.1.1.3  christos Licensed under the Apache License 2.0 (the "License").  You may not use
    190      1.1  christos this file except in compliance with the License.  You can obtain a copy
    191      1.1  christos in the file LICENSE in the source distribution or at
    192      1.1  christos L<https://www.openssl.org/source/license.html>.
    193      1.1  christos 
    194      1.1  christos =cut
    195