Skip to content

Commit a0b419c

Browse files
committed
Add experimental support for pkcs11 in openssl_posix.c using OpenSC libp11
1 parent d57f0a9 commit a0b419c

File tree

2 files changed

+348
-25
lines changed

2 files changed

+348
-25
lines changed

platform/posix/transport/include/openssl_posix.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* copies or substantial portions of the Software.
1414
*
1515
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
* IMPLIED, INCLUDINqG BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1717
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1818
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1919
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
@@ -69,7 +69,7 @@
6969
* implementation that uses OpenSSL and POSIX sockets.
7070
*
7171
* @note For this transport implementation, the socket descriptor and
72-
* SSL context is used.
72+
* SSL context are kept.
7373
*/
7474
typedef struct OpensslParams
7575
{
@@ -137,7 +137,15 @@ typedef struct OpensslCredentials
137137
*/
138138
const char * pRootCaPath; /**< @brief Filepath string to the trusted server root CA. */
139139
const char * pClientCertPath; /**< @brief Filepath string to the client certificate. */
140-
const char * pPrivateKeyPath; /**< @brief Filepath string to the client certificate's private key. */
140+
const char * pPrivateKeyPath; /**< @brief Filepath string or PKCS11 URI to the client certificate's private key. */
141+
142+
/**
143+
* @brief Configuration options when using a pkcs11 module.
144+
*
145+
* @note These strings must be NULL-terminated because the OpenSSL API requires them to be.
146+
*/
147+
const char * pP11ModulePath; /**< @brief Filepath string to the desired pkcs11 module. */
148+
const char * pP11ModulePin; /**< @brief String containing the pin (if required) for the referenced pkcs11 module */
141149
} OpensslCredentials_t;
142150

143151
/**

0 commit comments

Comments
 (0)