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