> ## Documentation Index
> Fetch the complete documentation index at: https://docs.futurex.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Install and configure OpenSSL engine

> Procedural guide to install and configure libp11, OpenSC, and PKCS11 engine plugin for OpenSSL.

This section describes how to install and configure the **libp11**, **OpenSC**, and **PKCS11 engine plugin** for the OpenSSL library. The following list provides an overview of these libraries:

<table>
  <thead>
    <tr>
      <th><em><strong>Library</strong></em></th>
      <th><em><strong>Description</strong></em></th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><strong>libp11</strong></td>
      <td>Provides a high-level (compared to the PKCS #11 library) interface for accessing PKCS #11 objects. It integrates with applications that use OpenSSL.</td>
    </tr>

    <tr>
      <td><strong>OpenSC</strong></td>
      <td>Provides a set of libraries and utilities to work with smart cards. It focuses on cards that support cryptographic operations and facilitates their use in security applications such as authentication, mail encryption, and digital signatures.</td>
    </tr>

    <tr>
      <td><strong>PKCS11 engine plugin</strong></td>
      <td>An engine plugin for the OpenSSL library that allows accessing PKCS #11 modules in a semi-transparent way.</td>
    </tr>
  </tbody>
</table>

## Install libp11 and OpenSC

Perform the following instructions to install **libp11** and **OpenSC** on the supported operating systems:

### Ubuntu or Debian

In a terminal, run the following sequence of commands to install **libp11** and **OpenSC** on Ubuntu or Debian:

```shell expandable lines wrap title="Shell" theme={null}
sudo apt update
sudo apt install libengine-pkcs11-openssl
sudo apt install opensc
```

### Red Hat or CentOS

In a terminal, run the following sequence of commands to install **libp11** and **OpenSC** on Red Hat or CentOS:

```shell expandable lines wrap title="Shell" theme={null}
sudo yum check-update
sudo yum install openssl-pkcs11
sudo yum install opensc
```

## Edit the OpenSSL configuration file

Perform the following steps to edit the OpenSSL configuration file for Ubuntu or Debian-based Linux distributions and Red Hat or CentOS-based distributions:

<Steps>
  <Step>
    Confirm the location of the `pkcs11.so` file on your system by running the following command in a terminal as root:

    ```shell expandable lines wrap title="Shell" theme={null}
    find / -name "pkcs11.so"
    ```
  </Step>

  <Step>
    Run the following command to determine the location of the OpenSSL configuration file for the logged-in user:

    ```shell expandable lines wrap title="Shell" theme={null}
    openssl version -d
    ```
  </Step>

  <Step>
    Open in a text editor to edit the `openssl.cnf` file for the logged-in user identified in the previous command. If you prefer, you can edit the global OpenSSL configuration file, `/etc/ssl/openssl.cnf`.
  </Step>

  <Step>
    Add the following line at the top of the file, before any sections:

    ```none expandable lines wrap title="None" theme={null}
    openssl_conf = openssl_init
    ```
  </Step>

  <Step>
    Add the following text, based on your operating system, at the bottom of the file after modifying the `MODULE_PATH` lines:

    **Ubuntu or Debian**

    ```none expandable lines wrap title="None" theme={null}
    [openssl_init] 
    engines=engine_section 
    [engine_section] 
    pkcs11 = pkcs11_section 
    [pkcs11_section] 
    engine_id = pkcs11 
    dynamic_path = /usr/lib/x86_64-linux-gnu/engines-1.1/pkcs11.so 
    MODULE_PATH = /usr/local/bin/fxpkcs11/libfxpkcs11.so 
    init = 0
    ```

    **Red Hat or CentOS**

    ```none expandable lines wrap title="None" theme={null}
    [openssl_init] 
    engines=engine_section 
    [engine_section] 
    pkcs11 = pkcs11_section 
    [pkcs11_section] 
    engine_id = pkcs11 
    dynamic_path = /usr/lib64/engines-1.1/pkcs11.so 
    MODULE_PATH = /usr/local/bin/fxpkcs11/libfxpkcs11.so
    init = 0
    ```

    <Warning>
      Set the `MODULE_PATH` parameter to the location of the Futurex PKCS #11 module installation on your system.
    </Warning>
  </Step>
</Steps>
