> ## 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.

# SAP ASE

> How SAP Adaptive Server Enterprise protects its master keys with an HSM key held in an Excrypt HSM through the Futurex PKCS #11 library.

SAP Adaptive Server Enterprise (SAP ASE, formerly Sybase ASE) is a relational database server that encrypts columns and whole databases with keys that it manages itself. This guide explains how to store the SAP ASE HSM key in an Excrypt HSM (formerly Vectera Plus) through the Futurex PKCS #11 library (FXPKCS11), so that the HSM protects the master key of every database on the server.

## The SAP ASE key model

SAP ASE protects data with a hierarchy of keys:

* **Column encryption keys and database encryption keys** encrypt the data. SAP ASE stores them in the database, encrypted by the master key.
* **Master keys** (`sybencrmasterkey`) protect the keys in each database. With an external keystore, SAP ASE encrypts each master key with the HSM key.
* **The HSM key** is an AES-256 key that SAP ASE generates on the Excrypt HSM. SAP ASE uses one HSM key per server instance and records its identifier in the `master` database.

SAP ASE asks the HSM to encrypt and decrypt master keys with the HSM key. The HSM key never leaves the HSM in clear form, so a copy of the database devices or of the SAP ASE host doesn't expose the key that protects every master key.

## How the integration works

1. An HSM administrator creates an application partition and an identity for SAP ASE on the Excrypt HSM, and configures TLS on the Excrypt port.
2. The SAP ASE host installs the Futurex PKCS #11 library in `$SYBASE/ASE-16_0/lib` and its configuration file in `/etc`.
3. SAP ASE stores the identity password in its HSM credential, so `fxpkcs11.cfg` doesn't keep it.
4. When SAP ASE needs the HSM, it loads the library into the server process. The library opens a TLS session to the Excrypt port (TCP 9100 by default) and logs in as the identity.
5. `create encryption key ... on external keystore` generates the HSM key on the HSM. SAP ASE then encrypts the master keys with it.
6. After a restart, SAP ASE logs in again with the stored credential and decrypts the master keys through the HSM before it uses an encrypted key.

## Why the library version matters

SAP ASE loads the PKCS #11 library into its own server process, `dataserver`. That process includes SAP CommonCryptoLib, which exposes functions with the same names as OpenSSL functions. A PKCS #11 library that links OpenSSL dynamically resolves those names to the SAP ASE copies and stops the server with a segmentation fault. This integration therefore requires the latest 6.x version of the Futurex PKCS #11 module, which contains OpenSSL internally and exposes none of its symbols. [Install Futurex PKCS #11 (FXPKCS11)](https://docs.futurex.com/Integrations/HSM/Database/SAP_ASE/Install_Futurex_PKCS_11_FXPKCS11.md) explains how to check the build.

## Configuration tasks

1. [Check the prerequisites](https://docs.futurex.com/Integrations/HSM/Database/SAP_ASE/Before_you_start.md).
2. Install the client software:
   * [Install Futurex PKCS #11 (FXPKCS11)](https://docs.futurex.com/Integrations/HSM/Database/SAP_ASE/Install_Futurex_PKCS_11_FXPKCS11.md) on the SAP ASE host.
   * [Install Excrypt Manager (if using Windows)](https://docs.futurex.com/Integrations/HSM/Database/SAP_ASE/Install_Excrypt_Manager_If_using_windows.md) or [Install Futurex Command Line Interface (FXCLI)](https://docs.futurex.com/Integrations/HSM/Database/SAP_ASE/Install_Futurex_Command_Line_Interface_FXCLI.md) on the workstation that you use to configure the HSM.
3. [Configure the Excrypt HSM](https://docs.futurex.com/Integrations/HSM/Database/SAP_ASE/Configure_the_Excrypt_HSM/Configure_the_Excrypt_HSM.md): load major keys, create an application partition and identity for SAP ASE, and configure TLS.
4. [Edit the Futurex PKCS #11 configuration file](https://docs.futurex.com/Integrations/HSM/Database/SAP_ASE/Edit_the_Futurex_PKCS_11_configuration_file.md) and verify the connection.
5. [Configure SAP ASE and create the HSM key](https://docs.futurex.com/Integrations/HSM/Database/SAP_ASE/Configure_SAP_ASE_and_create_the_HSM_key.md).
6. [Validate the integration](https://docs.futurex.com/Integrations/HSM/Database/SAP_ASE/Validate_the_integration.md).

## Out of scope

This guide covers one SAP ASE 16.0 SP04 server on SUSE Linux Enterprise Server 15 or openSUSE Leap 15. The following topics aren't covered:

* Installing SAP ASE.
* Sharing one HSM key between several SAP ASE servers.
* Replication and high-availability clusters.

For those topics, refer to the [SAP ASE documentation](https://help.sap.com/docs/SAP_ASE), including the chapter *Key Protection Using External Keystore* in the *Database Encryption* guide.

## Guardian Series 3

If a Guardian Series 3 manages your HSMs, you can complete most of the HSM configuration from the Guardian. For details, see [Guardian Series 3: Configure HSMs for PKCS #11 integrations](https://docs.futurex.com/Integrations/HSM/Generic/Guardian_Series_3_Configure_HSMs_for_PKCS_11_Integrations/Guardian_Series_3_Configure_HSMs_for_PKCS_11_Integrations.md).
