EVP: add name traversal functions to all fetchable types
[openssl.git] / doc / man3 / EVP_KEYMGMT.pod
1 =pod
2
3 =head1 NAME
4
5 EVP_KEYMGMT,
6 EVP_KEYMGMT_fetch,
7 EVP_KEYMGMT_up_ref,
8 EVP_KEYMGMT_free,
9 EVP_KEYMGMT_provider,
10 EVP_KEYMGMT_is_a,
11 EVP_KEYMGMT_do_all_provided,
12 EVP_KEYMGMT_names_do_all
13 - EVP key management routines
14
15 =head1 SYNOPSIS
16
17  #include <openssl/evp.h>
18
19  typedef struct evp_keymgmt_st EVP_KEYMGMT;
20
21  EVP_KEYMGMT *EVP_KEYMGMT_fetch(OPENSSL_CTX *ctx, const char *algorithm,
22                                 const char *properties);
23  int EVP_KEYMGMT_up_ref(EVP_KEYMGMT *keymgmt);
24  void EVP_KEYMGMT_free(EVP_KEYMGMT *keymgmt);
25  const OSSL_PROVIDER *EVP_KEYMGMT_provider(const EVP_KEYMGMT *keymgmt);
26  int EVP_KEYMGMT_is_a(const EVP_KEYMGMT *keymgmt, const char *name);
27  void EVP_KEYMGMT_do_all_provided(OPENSSL_CTX *libctx,
28                                   void (*fn)(EVP_KEYMGMT *keymgmt, void *arg),
29                                   void *arg);
30  void EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt,
31                                void (*fn)(const char *name, void *data),
32                                void *data);
33
34 =head1 DESCRIPTION
35
36 B<EVP_KEYMGMT> is a method object that represents key management
37 implementations for different cryptographic algorithms.
38 This method object provides functionality to have providers import key
39 material from the outside, as well as export key material to the
40 outside.
41 Most of the functionality can only be used internally and has no
42 public interface, this object is simply passed into other functions
43 when needed.
44
45 EVP_KEYMGMT_fetch() looks for an algorithm within the provider that
46 has been loaded into the B<OPENSSL_CTX> given by I<ctx>, having the
47 name given by I<algorithm> and the properties given by I<properties>.
48
49 EVP_KEYMGMT_up_ref() increments the reference count for the given
50 B<EVP_KEYMGMT> I<keymgmt>.
51
52 EVP_KEYMGMT_free() decrements the reference count for the given
53 B<EVP_KEYMGMT> I<keymgmt>, and when the count reaches zero, frees it.
54
55 EVP_KEYMGMT_provider() returns the provider that has this particular
56 implementation.
57
58 EVP_KEYMGMT_is_a() checks if I<keymgmt> is an implementation of an
59 algorithm that's identifiable with I<name>.
60
61 EVP_KEYMGMT_names_do_all() traverses all names for the I<keymgmt>, and
62 calls I<fn> with each name and I<data>.
63
64 EVP_KEYMGMT_do_all_provided() traverses all key keymgmt implementations by
65 all activated providers in the library context I<libctx>, and for each
66 of the implementations, calls I<fn> with the implementation method and
67 I<data> as arguments.
68
69 =head1 NOTES
70
71 EVP_KEYMGMT_fetch() may be called implicitly by other fetching
72 functions, using the same library context and properties.
73 Any other API that uses keys will typically do this.
74
75 =head1 RETURN VALUES
76
77 EVP_KEYMGMT_fetch() returns a pointer to the key management
78 implementation represented by an EVP_KEYMGMT object, or NULL on
79 error.
80
81 EVP_KEYMGMT_up_ref() returns 1 on success, or 0 on error.
82
83 EVP_KEYMGMT_free() doesn't return any value.
84
85 EVP_KEYMGMT_provider() returns a pointer to a provider object, or NULL
86 on error.
87
88 EVP_KEYMGMT_is_a() returns 1 of I<keymgmt> was identifiable,
89 otherwise 0.
90
91 =head1 SEE ALSO
92
93 L<EVP_MD_fetch(3)>, L<OPENSSL_CTX(3)>
94
95 =head1 HISTORY
96
97 The functions described here were added in OpenSSL 3.0.
98
99 =head1 COPYRIGHT
100
101 Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
102
103 Licensed under the Apache License 2.0 (the "License").  You may not use
104 this file except in compliance with the License.  You can obtain a copy
105 in the file LICENSE in the source distribution or at
106 L<https://www.openssl.org/source/license.html>.
107
108 =cut