Blame doc/man3/OSSL_STORE_SEARCH.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
OSSL_STORE_SEARCH,
Packit c4476c
OSSL_STORE_SEARCH_by_name,
Packit c4476c
OSSL_STORE_SEARCH_by_issuer_serial,
Packit c4476c
OSSL_STORE_SEARCH_by_key_fingerprint,
Packit c4476c
OSSL_STORE_SEARCH_by_alias,
Packit c4476c
OSSL_STORE_SEARCH_free,
Packit c4476c
OSSL_STORE_SEARCH_get_type,
Packit c4476c
OSSL_STORE_SEARCH_get0_name,
Packit c4476c
OSSL_STORE_SEARCH_get0_serial,
Packit c4476c
OSSL_STORE_SEARCH_get0_bytes,
Packit c4476c
OSSL_STORE_SEARCH_get0_string,
Packit c4476c
OSSL_STORE_SEARCH_get0_digest
Packit c4476c
- Type and functions to create OSSL_STORE search criteria
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/store.h>
Packit c4476c
Packit c4476c
 typedef struct ossl_store_search_st OSSL_STORE_SEARCH;
Packit c4476c
Packit c4476c
 OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name);
Packit c4476c
 OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name,
Packit c4476c
                                                       const ASN1_INTEGER
Packit c4476c
                                                       *serial);
Packit c4476c
 OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest,
Packit c4476c
                                                         const unsigned char
Packit c4476c
                                                         *bytes, int len);
Packit c4476c
 OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias);
Packit c4476c
Packit c4476c
 void OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search);
Packit c4476c
Packit c4476c
 int OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion);
Packit c4476c
 X509_NAME *OSSL_STORE_SEARCH_get0_name(OSSL_STORE_SEARCH *criterion);
Packit c4476c
 const ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH
Packit c4476c
                                                   *criterion);
Packit c4476c
 const unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH
Packit c4476c
                                                   *criterion, size_t *length);
Packit c4476c
 const char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion);
Packit c4476c
 const EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH
Packit c4476c
                                             *criterion);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
These functions are used to specify search criteria to help search for specific
Packit c4476c
objects through other names than just the URI that's given to OSSL_STORE_open().
Packit c4476c
For example, this can be useful for an application that has received a URI
Packit c4476c
and then wants to add on search criteria in a uniform and supported manner.
Packit c4476c
Packit c4476c
=head2 Types
Packit c4476c
Packit c4476c
B<OSSL_STORE_SEARCH> is an opaque type that holds the constructed search
Packit c4476c
criterion, and that can be given to an OSSL_STORE context with
Packit c4476c
OSSL_STORE_find().
Packit c4476c
Packit c4476c
The calling application owns the allocation of an B<OSSL_STORE_SEARCH> at all
Packit c4476c
times, and should therefore be careful not to deallocate it before
Packit c4476c
OSSL_STORE_close() has been called for the OSSL_STORE context it was given
Packit c4476c
to.
Packit c4476c
Packit c4476c
=head2 Application Functions
Packit c4476c
Packit c4476c
OSSL_STORE_SEARCH_by_name(),
Packit c4476c
OSSL_STORE_SEARCH_by_issuer_serial(),
Packit c4476c
OSSL_STORE_SEARCH_by_key_fingerprint(),
Packit c4476c
and OSSL_STORE_SEARCH_by_alias()
Packit c4476c
are used to create an B<OSSL_STORE_SEARCH> from a subject name, an issuer name
Packit c4476c
and serial number pair, a key fingerprint, and an alias (for example a friendly
Packit c4476c
name).
Packit c4476c
The parameters that are provided are not copied, only referred to in a
Packit c4476c
criterion, so they must have at least the same life time as the created
Packit c4476c
B<OSSL_STORE_SEARCH>.
Packit c4476c
Packit c4476c
OSSL_STORE_SEARCH_free() is used to free the B<OSSL_STORE_SEARCH>.
Packit c4476c
Packit c4476c
=head2 Loader Functions
Packit c4476c
Packit c4476c
OSSL_STORE_SEARCH_get_type() returns the criterion type for the given
Packit c4476c
B<OSSL_STORE_SEARCH>.
Packit c4476c
Packit c4476c
OSSL_STORE_SEARCH_get0_name(), OSSL_STORE_SEARCH_get0_serial(),
Packit c4476c
OSSL_STORE_SEARCH_get0_bytes(), OSSL_STORE_SEARCH_get0_string(),
Packit c4476c
and OSSL_STORE_SEARCH_get0_digest()
Packit c4476c
are used to retrieve different data from a B<OSSL_STORE_SEARCH>, as
Packit c4476c
available for each type.
Packit c4476c
For more information, see L</SUPPORTED CRITERION TYPES> below.
Packit c4476c
Packit c4476c
=head1 SUPPORTED CRITERION TYPES
Packit c4476c
Packit c4476c
Currently supported criterion types are:
Packit c4476c
Packit c4476c
=over 4
Packit c4476c
Packit c4476c
=item OSSL_STORE_SEARCH_BY_NAME
Packit c4476c
Packit c4476c
This criterion supports a search by exact match of subject name.
Packit c4476c
The subject name itself is a B<X509_NAME> pointer.
Packit c4476c
A criterion of this type is created with OSSL_STORE_SEARCH_by_name(),
Packit c4476c
and the actual subject name is retrieved with OSSL_STORE_SEARCH_get0_name().
Packit c4476c
Packit c4476c
=item OSSL_STORE_SEARCH_BY_ISSUER_SERIAL
Packit c4476c
Packit c4476c
This criterion supports a search by exact match of both issuer name and serial
Packit c4476c
number.
Packit c4476c
The issuer name itself is a B<X509_NAME> pointer, and the serial number is
Packit c4476c
a B<ASN1_INTEGER> pointer.
Packit c4476c
A criterion of this type is created with OSSL_STORE_SEARCH_by_issuer_serial()
Packit c4476c
and the actual issuer name and serial number are retrieved with
Packit c4476c
OSSL_STORE_SEARCH_get0_name() and OSSL_STORE_SEARCH_get0_serial().
Packit c4476c
Packit c4476c
=item OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT
Packit c4476c
Packit c4476c
This criterion supports a search by exact match of key fingerprint.
Packit c4476c
The key fingerprint in itself is a string of bytes and its length, as
Packit c4476c
well as the algorithm that was used to compute the fingerprint.
Packit c4476c
The digest may be left unspecified (NULL), and in that case, the
Packit c4476c
loader has to decide on a default digest and compare fingerprints
Packit c4476c
accordingly.
Packit c4476c
A criterion of this type is created with OSSL_STORE_SEARCH_by_key_fingerprint()
Packit c4476c
and the actual fingerprint and its length can be retrieved with
Packit c4476c
OSSL_STORE_SEARCH_get0_bytes().
Packit c4476c
The digest can be retrieved with OSSL_STORE_SEARCH_get0_digest().
Packit c4476c
Packit c4476c
=item OSSL_STORE_SEARCH_BY_ALIAS
Packit c4476c
Packit c4476c
This criterion supports a search by match of an alias of some kind.
Packit c4476c
The alias in itself is a simple C string.
Packit c4476c
A criterion of this type is created with OSSL_STORE_SEARCH_by_alias()
Packit c4476c
and the actual alias is retrieved with OSSL_STORE_SEARCH_get0_string().
Packit c4476c
Packit c4476c
=back
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
OSSL_STORE_SEARCH_by_name(),
Packit c4476c
OSSL_STORE_SEARCH_by_issuer_serial(),
Packit c4476c
OSSL_STORE_SEARCH_by_key_fingerprint(),
Packit c4476c
and OSSL_STORE_SEARCH_by_alias()
Packit c4476c
return a B<OSSL_STORE_SEARCH> pointer on success, or B<NULL> on failure.
Packit c4476c
Packit c4476c
OSSL_STORE_SEARCH_get_type() returns the criterion type of the given
Packit c4476c
B<OSSL_STORE_SEARCH>.
Packit c4476c
There is no error value.
Packit c4476c
Packit c4476c
OSSL_STORE_SEARCH_get0_name() returns a B<X509_NAME> pointer on success,
Packit c4476c
or B<NULL> when the given B<OSSL_STORE_SEARCH> was of a different type.
Packit c4476c
Packit c4476c
OSSL_STORE_SEARCH_get0_serial() returns a B<ASN1_INTEGER> pointer on success,
Packit c4476c
or B<NULL> when the given B<OSSL_STORE_SEARCH> was of a different type.
Packit c4476c
Packit c4476c
OSSL_STORE_SEARCH_get0_bytes() returns a B<const unsigned char> pointer and
Packit c4476c
sets B<*length> to the strings length on success, or B<NULL> when the given
Packit c4476c
B<OSSL_STORE_SEARCH> was of a different type.
Packit c4476c
Packit c4476c
OSSL_STORE_SEARCH_get0_string() returns a B<const char> pointer on success,
Packit c4476c
or B<NULL> when the given B<OSSL_STORE_SEARCH> was of a different type.
Packit c4476c
Packit c4476c
OSSL_STORE_SEARCH_get0_digest() returns a B<const EVP_MD> pointer.
Packit c4476c
B<NULL> is a valid value and means that the store loader default will
Packit c4476c
be used when applicable.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<ossl_store(7)>, L<OSSL_STORE_supports_search(3)>, L<OSSL_STORE_find(3)>
Packit c4476c
Packit c4476c
=head1 HISTORY
Packit c4476c
Packit c4476c
B<OSSL_STORE_SEARCH>,
Packit c4476c
OSSL_STORE_SEARCH_by_name(),
Packit c4476c
OSSL_STORE_SEARCH_by_issuer_serial(),
Packit c4476c
OSSL_STORE_SEARCH_by_key_fingerprint(),
Packit c4476c
OSSL_STORE_SEARCH_by_alias(),
Packit c4476c
OSSL_STORE_SEARCH_free(),
Packit c4476c
OSSL_STORE_SEARCH_get_type(),
Packit c4476c
OSSL_STORE_SEARCH_get0_name(),
Packit c4476c
OSSL_STORE_SEARCH_get0_serial(),
Packit c4476c
OSSL_STORE_SEARCH_get0_bytes(),
Packit c4476c
and OSSL_STORE_SEARCH_get0_string()
Packit c4476c
were added in OpenSSL 1.1.1.
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut