The private key is the most valuable aspect of your TLS/SSL certificate as it verifies your identity and allows you to encrypt and decrypt information. If it is compromised, cybercriminals can use the private key to intercept information — leading to data breaches, fines, and loss of investor and consumer confidence.
What is a private key?
TLS/SSL certificates require both a public key and private key to encrypt and decrypt data. The public key is embedded in the TLS/SSL certificate and is used to encrypt data from the sender. The private key is in a separate file that should be stored securely on your server and can be used for both encryption and decryption. A compromised private key means that anyone with the key can decrypt the sensitive information being transmitted.
Generating a private key
In order to generate a private key, you need to request a TLS/SSL certificate from a Certificate Authority (CA) through a certificate signing request (CSR). Once the request is granted, you will receive a certificate assigned with domain name, public key and additional contact information. The private key will be generated with your CSR as a key pair and should be saved on the server you generated it on. If you lose the private key, it will be impossible to install the certificate and you will need to reissue the certificate.
Locating my private key
If you have not installed the certificate yet, your private key will be saved on the server where you initiated the CSR and generated the key pair. If your certificate is already installed then follow the steps below depending on which system you are using.
Locating a private key in Windows
Your certificate files are managed for you in a private hidden folder. Access the private key by exporting a “.pfx” file that contains the certificate and private key.
- Open Microsoft Management Console
- In the Console Root, expand Certificates (Local Computer)
- Locate the certificate in the Personal or Web Server folder
- Right click the certificate
- Select Export
- Follow the guided wizard
Locating a private key in Apache
The private key will be referenced in the main Apache configuration file (httpd.conf or apache2. conf.). The SSLCertificatekeyFile will identify the path to where your private key is located.
If using OpenSSL on Apache, your private keys are saved to /user/local/ssl by default.
Locating a private key in Nginx
The location of the private key can be found in your site’s virtual host file. Navigate to the server block for that site (typically within /var/ww/directory), open the main configuration file, and search for the ssl_certificate_key directive. This will bring up the file bath for your private key.
Locating a private key in Mac OS X
Use Terminal to navigate to the /etc/certificates folder and open the key file (usually called something similar to “.key.pem”).
If you are unable to find the key, the best thing to do is to reissue the certificate.
Compromised or misplaced private keys
If a private key is misplaced or compromised, there is a chance that it could get misused by a cybercriminal. To avoid this, contact the certificate authority (CA) to get the certificate revoked and reissued.
Managing TLS/SSL certificates
To ensure the security of your information, manage your certificates and private keys carefully. As the number of certificates in your organization increases, as will the number of private keys. Keeping a pulse on the location and security of every private key becomes an inefficient and unsecure process. Venafi’s Control Plane for Machine Identities manages the process for you and ensures that keys and certificates are secure and discoverable.