1provider-pkcs11(7)         Configuration directives         provider-pkcs11(7)
2
3
4

NAME

6       pkcs11-provider - An OpenSSL provider that allows to directly interface
7       with pkcs11 drivers.
8

DESCRIPTION

10       Starting with version 3.0 the OpenSSL project introduced a new  modular
11       system to extend OpenSSL that replaces the deprecated Engines modules.
12
13       Providers(1)  are  loaded  via  configuration directives in the openssl
14       configuration file (or directly loaded by applications).
15
16       The pkcs11 provider allows applications linked to openssl to  use  keys
17       and  cryptographic  operations  from  a  hardware or software token via
18       their PKCS#11(2) driver and the use of pkcs11 URIs(3).
19
20       The pkcs11 provider can be configured to be  automatically  loaded  via
21       openssl.cnf
22

CONFIGURATION

24       Configuration options recognized by the provider
25
26   pkcs11-module-path
27       A file path to the pkcs11 driver to be used
28
29       Default:  If compiled with p11-kit defaults to its proxy driver, other‐
30       wise none.
31
32       NOTE: See also PKCS11_PROVIDER_MODULE in the environment variables sec‐
33       tion.
34
35       Example:
36
37       pkcs11-module-path = /usr/lib64/opensc-pkcs11.so
38
39   pkcs11-module-init-args
40       Non-standard  initialization  arguments  some  pkcs11  driver may need.
41       Generally not used, but some software tokens like NSS’s softokn require
42       this.
43
44       Default: None
45
46       Example:
47
48       pkcs11-module-init-args = configDir=/etc/pki/token
49
50   pkcs11-module-token-pin
51       The user PIN to be used with the token.  If a PIN is not set in config‐
52       uration  it  can  be  asked  interactively  (if  the  application  uses
53       prompters), or it can be specified together with the key identifiers in
54       the pkcs11 URI directly.  When a file is specified the file must  be  a
55       text file containing just the PIN on the first line and a terminator.
56
57       Default: None
58
59       Example:
60
61       pkcs11-module-token-pin = file:/etc/pki/pin.txt
62
63              cat /etc/pki/pin.txt
64              123456
65
66   pkcs11-module-allow-export
67       Whether  the  pkcs11  provider will allow to export public keys through
68       OpenSSL.  OpenSSL often tries to export public  keys  from  non-default
69       providers  to  the default provider, and then use OpenSSL own functions
70       to handle whatever operation is associated with the public  key.   This
71       option  can  be useful to force public key operations to be executed on
72       the token, for example in case the pkcs11 is an  accelerator  that  has
73       better  performance on signature checking or asymmetric encryption than
74       OpenSSL’s code.
75
76       Default: 0 (Allow Export)
77
78       Example:
79
80       pkcs11-module-allow-export = 1 (This disallows export of public keys)
81
82   pkcs11-module-cache-keys
83       Whether the pkcs11-provider should ask the token to cache token keys in
84       the  session.   This  is used in some tokens as a performance optimiza‐
85       tions.  For example software tokens that store keys encrypted can  keep
86       a copy of the key in the session to speed up access.  Or Networked HSMs
87       that allow exporting key material can cache the key in the session  in‐
88       stead of re-requesting it over the network.
89
90       Two options are available: * true * false
91
92       Default:  true  (Note:  if  the token does not support session caching,
93       then caching will be auto-disabled after the first attempt)
94
95       Example:
96
97       pkcs11-module-cache-keys = false (Disable any attempt of  caching  keys
98       in the session)
99
100   pkcs11-module-cache-pins
101       Whether  the  pkcs11-provider should cache a pin entered interactively.
102       This is useful to allow starting a service and providing the  pin  only
103       manually,  yet  let  the service perform multiple logins as needed, for
104       example after forking.
105
106       Only one option is currently available: * cache: Caches the PIN
107
108       Default: unset (No caching)
109
110       Example:
111
112       pkcs11-module-cache-pins = cache (Will cache a pin that  has  been  en‐
113       tered manually)
114
115   pkcs11-module-cache-sessions
116       Allows to tune how many pkcs11 sessions may be kept open and cached for
117       rapid use.  This parameter is adjusted based on the maximum  number  of
118       sessions  the token declares as supported.  Note that the login session
119       is always cached to keep the token operable.
120
121       Default: 5
122
123       Example:
124
125       pkcs11-module-cache-sessions = 0 (Disables caching)
126
127   pkcs11-module-login-behavior
128       Whether the pkcs11 provider will attempt to login to the token  when  a
129       public key is being requested.
130
131       Three  options are available: * auto: Try without but fallback to login
132       behavior if no keys are found * always: Always login before  trying  to
133       load  public  keys (this is required by some HSMs) * never: Never login
134       for public keys
135
136       Default: “auto”
137
138       Example:
139
140       pkcs11-module-login-behavior = always (Always  tries  to  login  before
141       loading public keys)
142
143   pkcs11-module-load-behavior
144       Whether the pkcs11-provider immediately loads an initializes the pkcs11
145       module as soon as OpenSSL loads the provider (generally at  application
146       startup),  or defer initialization until the first time a pkcs11 key is
147       loaded  (or  some  other  operation  explicitly  requiring  the  pkcs11
148       provider is requested).
149
150       Only  one option is available: * early: Loads the pkcs11 module immedi‐
151       ately
152
153       Default: unset (Loads only at first use)
154
155       Example:
156
157       pkcs11-module-load-behavior = early (Loads pkcs11 module immediately at
158       application startup)
159
160   pkcs11-module-quirks
161       Workarounds  that  may be needed to deal with some tokens and cannot be
162       autodetcted yet are not appropriate defaults.
163
164       The only quirk currently implemented is “no-deinit” It prevent de-init‐
165       ing  when  OpenSSL  winds down the provider.  NOTE this option may leak
166       memory and may cause some modules to misbehave if the  application  in‐
167       tentionally unloads and reloads them.
168
169       Default: none
170
171       Example:
172
173       pkcs11-module-quirks = no-deinit (Disables deinitialization)
174

ENVIRONMENT VARIABLES

176       Environment variables recognized by the provider
177
178   PKCS11_PROVIDER_MODULE
179       This  variable can be used to set a different pkcs11 driver to be used.
180       It is useful when an application needs to use a different  driver  than
181       the  rest  of  the  system.   This  environment  variable overrides the
182       pkcs11-module-path option sets in openssl.cnf
183
184       Example:
185
186       PKCS11_PROVIDER_MODULE = /usr/lib64/opensc-pkcs11.so
187
188   PKCS11_PROVIDER_DEBUG
189       This variable can be set to obtain debug information.  Two  sub-options
190       can be specified: file, level
191
192       The  normal  debug_level is 1, if a higher level is provider then addi‐
193       tional information (like all supported mechanism info for each slot) is
194       printed in the specified debug file.  The comma character separates op‐
195       tions, and the colon character is used to separate an  option  and  its
196       value.   There is no escape character, therefore the characters `,' and
197       `:' cannot be used in values.
198
199       Examples:
200
201       PKCS11_PROVIDER_DEBUG=file:/tmp/debug.log
202
203       PKCS11_PROVIDER_DEBUG=file:/dev/stderr,level:2
204

EXAMPLES

206       openssl.cnf:
207
208              HOME = .
209
210              # Use this in order to automatically load providers.
211              openssl_conf = openssl_init
212
213              [openssl_init]
214              providers = provider_sect
215
216              [provider_sect]
217              default = default_sect
218              pkcs11 = pkcs11_sect
219
220              [default_sect]
221              activate = 1
222
223              [pkcs11_sect]
224              module = /usr/lib64/ossl-modules/pkcs11.so
225              pkcs11-module-path = /usr/lib64/pkcs11/vendor_pkcs11.so
226              pkcs11-module-token-pin = /etc/ssl/pinfile.txt
227              activate = 1
228

SEE ALSO

230       1. PROVIDER(7)   man   page   -    https://www.openssl.org/docs/manmas
231          ter/man7/provider.html
232
233       2. PKCS#11   Technical  committe  and  standards  -  https://www.oasis-
234          open.org/committees/tc_home.php?wg_abbrev=pkcs11
235
236       3. PKCS#11   URI   Scheme   -   RFC   7512    -    https://www.rfc-edi
237          tor.org/rfc/rfc7512
238
239
240
241                                                            provider-pkcs11(7)
Impressum