Creating Certificates, Keystore and Truststore for MTLS (Mutual TLS)
To run keytool commands, you must be in the path where Java is installed or Java’s bin directory must be defined in your environment variables.It is recommended that you use Java version 1.8.400 or later for private keys to be created correctly.
Step 1: Creating CA Certificate and Key
The CA certificate is used to sign both client and server certificates. This ensures that both parties can verify each other. Create CA private keyca-key.pem: CA private keyca-cert.pem: CA certificate
Step 2: Creating Keystore and Certificate for Server
The server needs its own certificate to be verified by the client. This certificate must be signed by the CA. Create server private key and CSRserver-key.pem: Server private keyserver.csr: Server CSRserver-cert.pem: Server certificateserver-keystore.pfx: Server keystore file (in PFX format)
Step 3: Creating Keystore and Certificate for Client
The client needs its own certificate to be verified by the server. This certificate must be signed by the CA. Create client private key and CSRclient-key.pem: Client private keyclient.csr: Client CSRclient-cert.pem: Client certificateclient-keystore.pfx: Client keystore file (in PFX format)
Step 4: Creating TrustStore
TrustStore is used to verify the certificates of the other party. Both the server and client sides must have the CA certificate. Import CA certificate into server truststore (If you have done this before, you can skip this step. This operation will be done once on the server side, do not repeat for each client! )server-truststore.pfx: Server truststore file (in PFX format)client-truststore.pfx: Client truststore file (in PFX format)
Summary
“As a result of these steps, we have the following files:” On the CA Side, “the following files to be used to sign client and server certificates were created:”ca-key.pem: CA private keyca-cert.pem: CA certificate
server-key.pem: Server private keyserver.csr: Server CSRserver-cert.pem: Server certificateserver-keystore.pfx: Server keystore file (in PFX format)server-truststore.pfx: Server truststore file (in PFX format)
client-key.pem: Client private keyclient.csr: Client CSRclient-cert.pem: Client certificateclient-keystore.pfx: Client keystore file (in PFX format)client-truststore.pfx: Client truststore file (in PFX format)
Setting Up Client Certificate for Apinizer
After these operations are completed, the user-truststore.pfx file is created for the client’s certificate to be verified in Apinizer and added to Apinizer from the KeyStores screen.The .p12 and .pfx extensions actually specify the same file format - PKCS#12. PKCS#12 is a file format that typically contains a server certificate, associated private key, and optionally any intermediate certificates..pfx is generally used on Windows platform, while .p12 is generally used on Unix or Linux-based systems. However, there is no difference between these two file extensions and you do not need to perform any operation to convert one extension to another.
- The following command can be used to convert p12 format to jks:
- The following command can be used to convert jks format to pfx/p12:
Uploading Created User Truststore to Apinizer
Click the Create button from the Key Stores screen.



Making Necessary Settings on Apinizer Environments
For the mTLS policy to be usable, SSL Offloading must be done on Apinizer Environment’s and the mTLS option must be selected. For this, the HTTPS Enabled option and the mTLS options that come with it are activated on the Gateway Environment’s deployment settings.


Adding mTLS Authentication Policy to API Proxy
Click the Add Policy link from the Development (Develop) tab of the API Proxy.


Click here for detailed information about mTLS Settings.
Credential’s mTLS Settings
The username information of the credential must be the same as the “cn name” information in the “issuer” value in the certificate owned by the client. The API Proxy with mTLS policy added must be added to the API Proxy ACL tab of the credential. Truststore is added to the mTLS Settings tab of the credential as shown in the image below:

