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