]> git.ipfire.org Git - thirdparty/openssl.git/blame - README-PROVIDERS.md
PROV: Add type specific MSBLOB and PVK decoding for the MS->key decoders
[thirdparty/openssl.git] / README-PROVIDERS.md
CommitLineData
a0ca1eed
DMSP
1Providers
2=========
3
4 - [Standard Providers](#standard-providers)
5 - [The Default Provider](#the-default-provider)
6 - [The Legacy Provider](#the-legacy-provider)
7 - [The FIPS Provider](#the-fips-provider)
8 - [The Base Provider](#the-base-provider)
9 - [The Null Provider](#the-null-provider)
10 - [Loading Providers](#loading-providers)
11
12
13Standard Providers
14==================
15
16Providers are containers for algorithm implementations. Whenever a cryptographic
17algorithm is used via the high level APIs a provider is selected. It is that
18provider implementation that actually does the required work. There are five
19providers distributed with OpenSSL. In the future we expect third parties to
20distribute their own providers which can be added to OpenSSL dynamically.
21Documentation about writing providers is available on the [provider(7)]
22manual page.
23
24 [provider(7)]: https://www.openssl.org/docs/manmaster/man7/provider.html
25
26
27The Default Provider
28--------------------
29
30The default provider collects together all of the standard built-in OpenSSL
31algorithm implementations. If an application doesn't specify anything else
32explicitly (e.g. in the application or via config), then this is the provider
33that will be used. It is loaded automatically the first time that we try to
34get an algorithm from a provider if no other provider has been loaded yet.
35If another provider has already been loaded then it won't be loaded
36automatically. Therefore if you want to use it in conjunction with other
37providers then you must load it explicitly.
38
39This is a "built-in" provider which means that it is compiled and linked
40into the libcrypto library and does not exist as a separate standalone module.
41
42The Legacy Provider
43-------------------
44
45The legacy provider is a collection of legacy algorithms that are either no
46longer in common use or considered insecure and strongly discouraged from use.
47However, some applications may need to use these algorithms for backwards
48compatibility reasons. This provider is **not** loaded by default.
49This may mean that some applications upgrading from earlier versions of OpenSSL
50may find that some algorithms are no longer available unless they load the
51legacy provider explicitly.
52
53Algorithms in the legacy provider include MD2, MD4, MDC2, RMD160, CAST5,
54BF (Blowfish), IDEA, SEED, RC2, RC4, RC5 and DES (but not 3DES).
55
56The FIPS Provider
57-----------------
58
59The FIPS provider contains a sub-set of the algorithm implementations available
60from the default provider, consisting of algorithms conforming to FIPS standards.
61It is intended that this provider will be FIPS140-2 validated.
62
63In some cases there may be minor behavioural differences between algorithm
64implementations in this provider compared to the equivalent algorithm in the
65default provider. This is typically in order to conform to FIPS standards.
66
67The Base Provider
68-----------------
69
70The base provider contains a small sub-set of non-cryptographic algorithms
71available in the default provider. For example, it contains algorithms to
72serialize and deserialize keys to files. If you do not load the default
73provider then you should always load this one instead (in particular, if
74you are using the FIPS provider).
75
76The Null Provider
77-----------------
78
79The null provider is "built-in" to libcrypto and contains no algorithm
80implementations. In order to guarantee that the default provider is not
81automatically loaded, the null provider can be loaded instead.
82
83This can be useful if you are using non-default library contexts and want
84to ensure that the default library context is never used unintentionally.
85
86
87Loading Providers
88=================
89
90
91Providers to be loaded can be specified in the OpenSSL config file.
92See the [config(5)] manual page for information about how to configure
93providers via the config file, and how to automatically activate them.
94
95 [config(5)]: https://www.openssl.org/docs/manmaster/man5/config.html
96
97The following is a minimal config file example to load and activate both
98the legacy and the default provider in the default library context.
99
100 openssl_conf = openssl_init
101
102 [openssl_init]
103 providers = provider_sect
104
105 [provider_sect]
106 default = default_sect
107 legacy = legacy_sect
108
109 [default_sect]
110 activate = 1
111
112 [legacy_sect]
113 activate = 1
114
115
116It is also possible to load providers programmatically. For example you can
117load the legacy provider into the default library context as shown below.
118Note that once you have explicitly loaded a provider into the library context
119the default provider will no longer be automatically loaded. Therefore you will
120often also want to explicitly load the default provider, as is done here:
121
122
123 #include <stdio.h>
124 #include <stdlib.h>
125
126 #include <openssl/provider.h>
127
128 int main(void)
129 {
130 OSSL_PROVIDER *legacy;
131 OSSL_PROVIDER *deflt;
132
133 /* Load Multiple providers into the default (NULL) library context */
134 legacy = OSSL_PROVIDER_load(NULL, "legacy");
135 if (legacy == NULL) {
136 printf("Failed to load Legacy provider\n");
137 exit(EXIT_FAILURE);
138 }
139 deflt = OSSL_PROVIDER_load(NULL, "default");
140 if (deflt == NULL) {
141 printf("Failed to load Default provider\n");
142 OSSL_PROVIDER_unload(legacy);
143 exit(EXIT_FAILURE);
144 }
145
146 /* Rest of application */
147
148 OSSL_PROVIDER_unload(legacy);
149 OSSL_PROVIDER_unload(deflt);
150 exit(EXIT_SUCCESS);
151 }