Every time you visit a secure website, connect to an API, or configure an encrypted service, certificates help establish who you are communicating with and which cryptographic keys that service is authorized to use.
SSL certificates are essential building blocks of modern network security. They help protect information in transit, authenticate servers, and support digital signatures and encrypted email.
Despite the name, modern secure connections use TLS (Transport Layer Security), the successor to SSL. The term "SSL certificate" remains common, even though SSL itself is obsolete.
This guide starts with the fundamentals, explains the differences between certificate formats and trust models, and finishes with practical OpenSSL commands you can use to generate, inspect, and verify certificates and keys.
01 · FUNDAMENTALS
What Is an SSL Certificate?
Think of a digital certificate as an identity document that connects a name to a public cryptographic key.
An SSL/TLS certificate is a digitally signed data structure, usually following the X.509 standard. It contains information about the identity it represents, its public key, its issuer, its validity period, and other attributes that help clients decide whether to trust it.
For a website, the certificate typically identifies one or
more domain names, such as example.com and
www.example.com.
A certificate is not the same thing as a private key, and it does not encrypt every connection by itself. Instead, it helps a client authenticate a server and establish a secure connection using TLS.
What does a certificate contain?
- Subject: The entity or identity represented by the certificate.
- Subject Alternative Name (SAN): The DNS names or IP addresses for which the certificate is valid.
- Public key: The public portion of an asymmetric cryptographic key pair.
- Issuer: The certificate authority or other entity that signed the certificate.
- Validity period: The dates between which the certificate is intended to be valid.
- Serial number: An identifier assigned by the issuer.
- Extensions: Additional information such as permitted key usage, server authentication, and certificate authority constraints.
- Digital signature: A cryptographic signature used to verify the certificate's integrity and its relationship to the issuer's signing key.
A certificate is not a security guarantee.
A valid certificate does not prove that a website is honest, that its software is secure, or that its owner will protect your information. It helps establish the identity of the endpoint you connected to and supports the security of the connection.
02 · PURPOSE
Why Do We Use Certificates?
Encryption is valuable, but encryption without authentication can leave you vulnerable to impersonation.
-
01
Confidentiality
Protect information in transit
TLS encrypts network traffic so that an observer generally cannot read the contents of a properly secured connection.
Certificates help authenticate the endpoint and support the cryptographic handshake used to establish that encrypted session.
ExampleA customer submits payment information to your website over HTTPS rather than sending it as readable HTTP traffic.
-
02
Authentication
Help verify who you are connecting to
A client validates the certificate's chain of trust, checks the requested hostname, and evaluates its validity before accepting the connection.
ExampleA browser checks that the certificate presented by
shop.example.comis valid for that hostname and chains to a trusted authority. -
03
Integrity
Help detect tampering
TLS uses authenticated encryption to protect data in transit against undetected modification. Certificate signatures also help clients detect unauthorized changes to certificate contents.
ExampleAn attacker who modifies encrypted application traffic should not be able to make those changes pass the connection's integrity checks.
-
04
Digital identity
Support signatures and identity-based security
Certificates can associate public keys with identities for email signing, code signing, client authentication, and other security systems.
ExampleAn organization signs software releases so that users can verify the signature against the corresponding public key and certificate.
03 · UNDER THE HOOD
How Do SSL/TLS Certificates Work?
Three ideas work together: asymmetric cryptography, certificate validation, and a secure session.
First, understand the two keys
Asymmetric cryptography uses a mathematically related public key and private key.
- Public key: Shared openly and included in the certificate.
- Private key: Protected by its owner and never intentionally distributed with the certificate.
Depending on the algorithm and operation, the keys can support digital signatures, key establishment, or other cryptographic functions.
Modern TLS typically uses the certificate's public key to authenticate the server's signature during the handshake. The session's traffic keys are established separately using the TLS key exchange process.
What happens during a typical HTTPS connection?
- Connection begins. The client and server negotiate supported TLS parameters.
- The server presents its certificate. It may also send intermediate certificates needed to build a chain of trust.
- The client validates the certificate. It checks the chain, hostname, validity period, and applicable security requirements.
- The server proves possession of its private key. In modern TLS, this typically includes a handshake signature verified using the certificate's public key.
- Session keys are established. Both sides derive cryptographic keys used to protect the connection.
- Application data is exchanged. HTTP requests and responses travel inside the protected TLS connection.
Does the certificate encrypt the connection?
Not directly. The certificate provides a public key and signed identity information. TLS uses cryptographic algorithms and the handshake to authenticate endpoints and establish the symmetric session keys that protect application traffic.
Why use symmetric encryption after the handshake?
Public-key operations are useful for authentication and key establishment, but symmetric algorithms are generally more efficient for protecting large amounts of data.
Modern TLS commonly uses authenticated encryption with associated data (AEAD), such as AES-GCM or ChaCha20-Poly1305. These algorithms protect confidentiality and detect unauthorized modification.
04 · CLASSIFICATION
What Different Types of Certificates Are There?
Certificates can be categorized by the identities they cover, the purpose they serve, and how they are trusted.
By validation level
DOMAIN VALIDATION
DV — Domain Validated
The certificate authority verifies control of the requested domain or identifier.
Common for websites, blogs, APIs, and small businesses. DV certificates can provide the same strong TLS encryption as other publicly trusted certificates when configured with equivalent modern cryptography.
A DV certificate does not independently verify the legal identity of the business operating the website.
ORGANIZATION VALIDATION
OV — Organization Validated
The certificate authority performs additional checks on the organization behind the certificate.
OV may be appropriate when an organization needs documented organizational validation or must meet a particular procurement or compliance requirement.
OV does not automatically make the TLS connection more strongly encrypted than an equivalent DV connection.
EXTENDED VALIDATION
EV — Extended Validation
The issuing authority performs more extensive identity checks under the applicable EV requirements.
EV is used in certain organizational and regulatory contexts. Its value depends on the organization's identity-assurance requirements.
EV does not guarantee that a business is trustworthy, and modern browsers generally do not give EV certificates a special, prominent address-bar treatment.
By the identity or purpose they cover
-
Single-name certificate:
Covers one DNS name, such as
api.example.com. -
Wildcard certificate:
Can cover names one label below a wildcard, such as
*.example.com. It does not ordinarily coverexample.comitself orapi.eu.example.com. - Multi-name certificate: Uses Subject Alternative Names to cover several DNS names or supported IP address identifiers.
- Server authentication certificate: Used by a server to authenticate itself to clients.
- Client authentication certificate: Used by a client to authenticate itself to a server, as in mutual TLS (mTLS).
- Email certificate: Can support S/MIME email signing and encryption when issued with appropriate identity information and permitted key usages.
- Code-signing certificate: Used to sign software or other code artifacts so recipients can verify the signature and signer identity.
- CA certificate: Used by a certificate authority to issue or validate other certificates, subject to its constraints.
Publicly trusted vs. privately trusted
A publicly trusted certificate chains to a root certificate recognized by the relevant browser or operating system. A privately trusted certificate chains to an internal root distributed through an organization's trust-management system.
Private PKI is common for internal APIs, corporate devices, development systems, and services that should not rely on public certificate authorities.
05 · CRYPTOGRAPHY
Does the Encryption Type Matter?
Yes, but it helps to separate the algorithm in the certificate from the algorithms used to protect a session.
Several cryptographic components work together in a TLS connection. They have different jobs and should not be treated as interchangeable.
RSA
RSA is a public-key algorithm used for digital signatures and, historically, key transport.
- Widely supported.
- Uses larger keys than common elliptic-curve alternatives.
- A 2048-bit RSA key is a common baseline for conventional deployments; follow current platform and policy guidance.
ECDSA
Elliptic Curve Digital Signature Algorithm (ECDSA) provides digital signatures using elliptic-curve cryptography.
- Usually offers smaller keys and signatures than RSA.
- Supported by modern browsers and TLS implementations.
- Compatibility should be checked for older clients, appliances, and legacy software.
Ed25519
Ed25519 is a modern digital-signature scheme. It is useful in many cryptographic applications, but certificate issuance and TLS support depend on the client, server, certificate authority, and algorithm profile.
Do not assume every public TLS certificate provider supports it for web-server certificates.
What about AES and ChaCha20?
AES and ChaCha20 are symmetric encryption algorithms. They commonly protect the actual data exchanged after the TLS handshake.
AES-GCM and ChaCha20-Poly1305 combine encryption with authentication, helping prevent an attacker from silently modifying encrypted traffic.
What should a business choose?
- Use a currently supported TLS version, preferably TLS 1.3 where the environment permits it.
- Use modern, approved cipher suites and key sizes.
- Prefer algorithms supported by your clients, server software, and certificate authority.
- Keep private keys secure and monitor certificate expiry.
- Do not choose an algorithm solely because it has the longest key or sounds the most advanced.
A bigger key is not always a better choice.
Algorithm security depends on the algorithm, key size, implementation, and use case. RSA-4096 is not automatically preferable to a well-configured elliptic-curve key. Compatibility, performance, policy, and lifecycle management also matter.
06 · TRUST
What Is a Certificate Authority?
A Certificate Authority (CA) is an entity responsible for issuing and managing certificates under defined validation and security policies.
When a browser connects to a website, it needs a way to determine whether the certificate should be trusted. A trusted CA helps establish that trust by signing the certificate, or by signing an intermediate CA certificate that eventually connects to a trusted root.
Why do I need a CA?
Without an established trust mechanism, a client cannot reliably distinguish a legitimate server's public key from a key supplied by an impostor.
A trusted CA provides a way to verify that a certificate was issued according to the CA's validation process. The browser still needs to check the certificate's hostname, validity, chain, and applicable policy.
Public CAs are commonly used for public websites. Internal CAs are often used when an organization controls the clients and can distribute its own trusted root securely.
What is a root CA?
A root CA certificate is typically self-signed and explicitly trusted through a trust store. Root private keys are especially sensitive and are commonly kept offline or protected by dedicated security controls.
What is an intermediate CA?
An intermediate CA is authorized to issue other certificates under constraints established by its issuer. Intermediates allow certificate issuance to be separated from the root's highly protected private key.
Trust is a decision made by the client.
A certificate can be mathematically valid and still be untrusted. A self-signed certificate, for example, may have a valid signature but will not be accepted by a typical browser unless an appropriate trust arrangement exists.
07 · TRUST MODELS
What Is a Self-Signed Certificate?
A self-signed certificate is signed using the private key corresponding to the public key contained in that certificate.
A publicly trusted website certificate is normally issued through a trusted CA chain. A self-signed certificate does not establish that kind of third-party trust by itself.
However, self-signed certificates are not inherently insecure. They can be useful in controlled environments where the certificate is securely distributed and trusted through an independent process.
When does self-signing make sense?
- Local development and testing.
- Temporary test services and isolated lab environments.
- Internal systems where trust is managed explicitly.
- Creating a private root CA for an organization, provided it is properly secured and managed.
When should you avoid it?
Avoid using an untrusted self-signed certificate for a public-facing website when users are expected to connect without manual trust configuration.
Browser warnings can train users to ignore security alerts, and an attacker may exploit that behavior.
OPENSSL · DEVELOPMENT
Create a self-signed certificate
The following example creates a private key and a certificate for local testing.
openssl req -x509 -newkey rsa:3072 \
-keyout dev.key \
-out dev.crt \
-sha256 \
-days 30 \
-addext "subjectAltName=DNS:localhost,IP:127.0.0.1"
What this command does
- Generates an RSA private key.
- Creates a self-signed X.509 certificate.
- Adds SAN entries for localhost and 127.0.0.1.
- Sets a 30-day validity period for this example.
OpenSSL prompts for a passphrase because the private key is encrypted by default in this command. Follow the prompts to supply the certificate's subject information.
08 · FILE FORMATS
What Is the Difference Between PEM and CRT?
One of the most confusing parts of certificate management is that filenames and encoding formats are not the same thing.
.pem, .crt, .cer,
and .key are filename extensions. They often
suggest a file's contents, but the extension alone does
not prove what the file contains or how it is encoded.
PEM
PEM is a text-based encoding commonly used to represent certificates, private keys, certificate requests, and other cryptographic objects.
-----BEGIN CERTIFICATE-----
MIID...
-----END CERTIFICATE-----
The Base64-encoded data is surrounded by BEGIN and END markers. The underlying object is commonly DER-encoded data.
CRT / CER
These extensions commonly indicate a certificate. The certificate might be PEM-encoded text or binary DER data.
Always inspect the file or explicitly specify the encoding when a tool requires it.
KEY
A .key file commonly contains a private
key, but the extension is not a guarantee.
Treat the file as sensitive until its contents and purpose are confirmed.
CSR
A Certificate Signing Request is a request for a CA to issue a certificate. It contains a public key and requested identity information, and is signed using the corresponding private key.
A CSR is not itself a certificate and does not establish trust.
Quick comparison
| Extension | Common contents | Sensitive? |
|---|---|---|
.pem |
Certificate, key, CSR, or chain | Depends on contents |
.crt |
Usually a certificate | Usually public |
.cer |
Usually a certificate | Usually public |
.key |
Usually a private key | Yes, if private |
.csr |
Certificate request | Usually public |
.der |
Binary ASN.1 encoding | Depends on contents |
.p12 / .pfx |
PKCS#12 bundle | Potentially highly sensitive |
Convert PEM to DER
openssl x509 -in certificate.pem \
-outform DER \
-out certificate.der
Convert DER to PEM
openssl x509 -inform DER \
-in certificate.der \
-outform PEM \
-out certificate.pem
Inspect a certificate without guessing its contents
openssl x509 -in certificate.crt -noout -text
If OpenSSL reports that it cannot parse the input, verify the file format and encoding before attempting a conversion.
09 · IDENTITY
Why Does a Certificate Need My Business Information?
The answer depends on the certificate's validation level and intended use.
Certificates can contain different identity attributes. A certificate issued for a public website usually identifies the domain names it covers. An OV or EV certificate also involves additional organizational validation.
Domain validation
For a typical DV certificate, the CA verifies control of the requested domain using an approved validation method. The certificate does not need to display your company's legal name to provide secure HTTPS.
Organization validation
OV and EV processes require additional checks of the organization. Depending on the product and policy, the CA may request legal names, registration details, contact information, or other evidence.
Why the distinction matters
- Domain identity answers which hostname the certificate is valid for.
- Organizational identity provides additional evidence about the entity requesting the certificate.
- A certificate containing a business name does not guarantee the business is honest or secure.
- Never place unnecessary sensitive personal or business information in public certificate fields.
Public certificates are not private documents.
Publicly trusted TLS certificates can be visible to clients and may appear in Certificate Transparency logs. Do not assume that information entered into certificate fields will remain confidential.
10 · PROTOCOLS
What Is the Difference Between SSL and TLS?
SSL and TLS are related protocols, but they are not interchangeable in modern security configurations.
Secure Sockets Layer (SSL) was the predecessor to Transport Layer Security (TLS). TLS was developed to provide secure communications and evolved through multiple protocol versions.
| Protocol | Status | Guidance |
|---|---|---|
| SSL 2.0 / 3.0 | Obsolete | Do not use |
| TLS 1.0 / 1.1 | Deprecated | Disable |
| TLS 1.2 | Widely supported | Use secure configuration |
| TLS 1.3 | Modern | Prefer where supported |
What changed with TLS 1.3?
- A streamlined handshake reduces connection setup latency in common scenarios.
- Legacy cryptographic options were removed.
- Modern key establishment and authenticated encryption are integral to the protocol.
- Static RSA key exchange and several older cipher-suite options are no longer supported.
Does my certificate determine the TLS version?
No. The certificate and the TLS protocol are separate components. The certificate provides identity information and a public key, while the server and client negotiate a mutually supported TLS version and cipher suite.
Your server software, cryptographic libraries, operating system, and configuration determine which protocol versions are enabled.
OPENSSL · CONNECTION TEST
Connect using TLS 1.3
openssl s_client \
-connect example.com:443 \
-servername example.com \
-tls1_3
What to look for
- The negotiated protocol version.
- The selected cipher suite.
- The certificate chain.
- Hostname and verification results.
This command requests TLS 1.3. If the server or your local OpenSSL build does not support it, the connection may fail.
11 · REAL-WORLD USE
Where Are Certificates Used?
Certificates support far more than the HTTPS padlock.
-
01
Websites and web applications
HTTPS uses TLS to protect browser-to-server communication and authenticate the server.
Typical components include a server certificate, its private key, and the necessary intermediate certificates.
-
02
APIs and microservices
Service-to-service connections can use TLS to protect requests and responses.
Mutual TLS adds client certificate authentication, allowing both endpoints to authenticate each other.
-
03
Email security
S/MIME certificates can support digitally signed email and, when configured appropriately, email encryption.
Email transport protocols such as SMTP, IMAP, and POP3 can also use TLS to protect connections.
-
04
Remote access and network devices
VPN gateways, administrative interfaces, reverse proxies, load balancers, and other network services can use certificates for authentication.
The specific certificate requirements depend on the product and protocol.
-
05
Code and document signing
Digital certificates can associate public keys with identities used in software signing, document signing, and other signature-verification systems.
The receiving application must support the relevant signature format and trust policy.
-
06
Device identity and enterprise PKI
Organizations can issue certificates to laptops, servers, mobile devices, and network equipment.
These certificates can support authentication, access control, and automated device management.
12 · AUTOMATED CERTIFICATES
What Is Let's Encrypt?
Let's Encrypt is a free, automated, publicly trusted certificate authority operated by the Internet Security Research Group (ISRG).
Let's Encrypt makes it possible to obtain publicly trusted certificates without purchasing them from a commercial certificate provider. Its ACME protocol allows compatible software to request, renew, and manage certificates automatically.
How does it work?
- You configure an ACME client, such as Certbot, for your domain.
- The client requests a certificate from the ACME service.
- Let's Encrypt asks the client to demonstrate control of the requested domain.
- The client completes a challenge, such as HTTP-01 or DNS-01.
- Once validation succeeds, the certificate is issued.
- Your web server installs the certificate and uses its corresponding private key for TLS.
HTTP-01 vs. DNS-01
| Challenge | How it works | Best suited for |
|---|---|---|
| HTTP-01 | Places a validation token at a specific HTTP URL. | Many ordinary public websites. |
| DNS-01 | Publishes a DNS TXT record proving domain control. | Wildcard certificates and environments where HTTP validation is unsuitable. |
| TLS-ALPN-01 | Performs validation over a specially configured TLS connection. | Specialized TLS-terminating infrastructure. |
Getting a certificate with Certbot
On a compatible Linux server running Nginx, a common workflow is:
sudo certbot --nginx -d example.com -d www.example.com
This example assumes Certbot is installed, Nginx is configured, and the requested domain names point to the server. Installation instructions vary by operating system and deployment method.
Certbot can obtain the certificate and configure Nginx when the necessary prerequisites are satisfied.
Do not forget renewal
Certificates expire. A production deployment should automatically renew certificates before expiration and reload the relevant service when appropriate.
Confirm that the renewal mechanism works instead of assuming that an installed ACME client will renew successfully forever.
Protect ACME credentials.
DNS-based automation may require credentials that can modify DNS records. Use narrowly scoped credentials where supported, restrict access to them, and avoid exposing them in shell history, public repositories, or application logs.
13 · HANDS-ON WORKSHOP
Working with Certificates Using OpenSSL
OpenSSL is a widely used cryptographic toolkit for generating keys, creating certificate requests, inspecting certificates, and testing TLS connections.
The following examples use conventional command-line syntax. Options and defaults can differ between OpenSSL versions, operating systems, and service configurations.
STEP 1 · KEY GENERATION
Generate a private key
Start by creating the private key that will correspond to the certificate's public key.
openssl genpkey \
-algorithm RSA \
-pkeyopt rsa_keygen_bits:3072 \
-out server.key
What this does
- Uses the RSA public-key algorithm.
- Generates a 3072-bit private key.
- Writes the private key to
server.key.
The generated key is unencrypted unless encryption is explicitly requested. Restrict its file permissions and protect it from unauthorized access.
STEP 2 · CERTIFICATE REQUEST
Generate a CSR
A certificate signing request packages your public key and requested identity information for a CA.
openssl req -new \
-key server.key \
-out server.csr \
-sha256 \
-addext "subjectAltName=DNS:example.com,DNS:www.example.com"
What to know
- The CSR is signed using the private key.
- The CA uses the CSR and its own validation process to determine whether to issue a certificate.
- The SAN extension requests the listed DNS names.
- The CA may enforce its own rules for which requested extensions are included in the issued certificate.
OpenSSL prompts for subject fields unless you specify them through configuration or command-line options.
STEP 3 · REQUEST VALIDATION
Verify the CSR signature
openssl req \
-in server.csr \
-noout \
-verify
This checks the signature on the CSR. It does not prove that a CA issued a certificate or that the requested domain belongs to you.
STEP 4 · CERTIFICATE ISSUANCE
Submit the CSR to your CA
Submit server.csr through your certificate
provider's approved workflow. After validation and
issuance, the provider supplies the signed certificate
and any required intermediate certificates.
The private key normally stays with you. You should not need to send it to a public CA when requesting a conventional TLS certificate.
STEP 5 · INSPECTION
Read the certificate details
openssl x509 \
-in server.crt \
-noout \
-text
Look for these fields
- Subject and issuer.
- Validity dates.
- Subject Alternative Name.
- Public-key algorithm and size.
- Signature algorithm.
- Key Usage and Extended Key Usage.
This command parses the certificate and displays its contents. It does not, by itself, establish that the certificate chains to a trusted CA.
STEP 6 · KEY MATCHING
Verify that the certificate matches the private key
A certificate and private key must contain the corresponding public and private components.
openssl x509 -in server.crt -pubkey -noout \
| openssl pkey -pubin -outform DER \
| openssl dgst -sha256
openssl pkey -in server.key -pubout -outform DER \
| openssl dgst -sha256
How to interpret the result
Compare the two SHA-256 digests. If they match, the certificate and private key correspond to the same public key.
This method works for RSA and elliptic-curve keys supported by OpenSSL. It compares the DER-encoded public-key representations, not the entire certificate.
STEP 7 · TRUST VALIDATION
Verify the certificate chain
openssl verify \
-CAfile trusted-roots.pem \
-untrusted intermediate.pem \
server.crt
What the files represent
-
trusted-roots.pemcontains the root certificates you intend to trust. -
intermediate.pemcontains the intermediate certificates needed to build the chain. -
server.crtis the certificate being verified.
The appropriate trust store and intermediate certificates depend on the environment. This command verifies the chain under the supplied trust configuration; it is not a substitute for checking that the certificate matches the hostname your application actually uses.
STEP 8 · FINGERPRINT
Generate a certificate fingerprint
openssl x509 \
-in server.crt \
-noout \
-fingerprint \
-sha256
What is a fingerprint?
A fingerprint is a digest calculated from the certificate's encoded contents. It can help identify a specific certificate and compare copies obtained from different sources.
Two certificates containing the same public key can have different fingerprints if other certificate fields differ.
A fingerprint is not a secret and does not encrypt anything. Compare it against a value obtained through a trusted channel when using it to confirm identity.
STEP 9 · KEY INSPECTION
Extract information from a private key
openssl pkey \
-in server.key \
-noout \
-text
This displays key details supported by the selected key type. Depending on the algorithm, output may include key parameters and private components.
Because this command can display private-key material, run it only in a secure environment. Avoid capturing the output in logs or sharing terminal recordings.
STEP 10 · PUBLIC KEY EXPORT
Export the public key
openssl pkey \
-in server.key \
-pubout \
-out server-public.pem
This exports the public key associated with the private key. The resulting public-key file can be shared when the application requires it.
It does not export the private key.
STEP 11 · FIELD EXTRACTION
Extract specific certificate information
# Subject
openssl x509 -in server.crt -noout -subject
# Issuer
openssl x509 -in server.crt -noout -issuer
# Validity dates
openssl x509 -in server.crt -noout -dates
# Serial number
openssl x509 -in server.crt -noout -serial
# Subject Alternative Name
openssl x509 -in server.crt -noout -ext subjectAltName
# Public-key algorithm and parameters
openssl x509 -in server.crt -noout -pubkey \
| openssl pkey -pubin -noout -text
These commands are useful for audits, certificate inventory, troubleshooting, and automated checks. Always verify the output against the expected domain, issuer, and validity period.
STEP 12 · LIVE SERVER TEST
Inspect a server's TLS connection
openssl s_client \
-connect example.com:443 \
-servername example.com \
-verify_hostname example.com \
-verify_return_error \
-showcerts
What this checks
- Connects to the server on port 443.
- Sends the requested hostname using SNI.
- Requests hostname verification.
- Enforces verification failure reporting.
- Displays certificates sent by the server.
Successful verification depends on the local trust store and server configuration. Inspect the negotiated TLS version and certificate chain as well as the final verification result.
STEP 13 · FORMAT CONVERSION
Export a certificate and key as a PKCS#12 bundle
openssl pkcs12 -export \
-out server.p12 \
-inkey server.key \
-in server.crt \
-certfile intermediate.pem
PKCS#12 can package a certificate, its corresponding private key, and optional additional certificates into a single bundle. It is commonly used for importing certificates into applications and operating systems.
OpenSSL normally prompts for an export password. Protect the resulting file as sensitive material because it may contain the private key.
Before installing a certificate
Confirm that the private key matches the certificate, the requested hostname appears in the SAN extension, the certificate is within its validity period, and the chain validates against the intended trust store. Then verify the live service after deployment.
14 · PRIVATE-KEY SECURITY
When Should You Encrypt a Private Key with a Passphrase?
A passphrase can add protection if an encrypted private-key file is copied or stolen.
An encrypted private key requires a passphrase to decrypt and use the key. This helps protect the key at rest, provided the passphrase is sufficiently strong and appropriately managed.
A passphrase does not protect a key that has already been decrypted in memory or exposed through an insecure process.
Generate an encrypted RSA private key
openssl genpkey \
-algorithm RSA \
-aes-256-cbc \
-pkeyopt rsa_keygen_bits:3072 \
-out server-encrypted.key
OpenSSL prompts for a passphrase to encrypt the key. Use a strong, unique passphrase and store it securely.
When is encryption useful?
- Private keys stored in backups or offline archives.
- Keys transferred between administrators or systems through approved secure procedures.
- Keys stored on systems where interactive passphrase entry is practical.
What about automated web servers?
An encrypted server key may require an operator or a configured secret-management mechanism to unlock it when the service starts.
If the server must restart unattended, teams commonly use a dedicated secret manager, hardware security module, key-management service, or tightly controlled service-specific key storage.
Some deployments use an unencrypted private key so that the service can start automatically. If you choose that model, compensate with strict file permissions, restricted host access, secure backups, and appropriate monitoring.
Encryption is not a substitute for access control.
A strong passphrase provides another layer of protection, but it cannot compensate for a compromised server, exposed secrets, weak permissions, or careless key handling.
15 · KEY MANAGEMENT
How Do You Export a Key from a Passphrase-Protected Key?
OpenSSL can read an encrypted private key and write an unencrypted copy when an application requires it.
First, confirm that you are authorized to modify the key and that the destination is protected. Removing the passphrase reduces protection if the resulting file is stolen.
Export an unencrypted private key
openssl pkey \
-in server-encrypted.key \
-out server-unencrypted.key
OpenSSL prompts for the original passphrase and writes the decrypted private key to the output file.
Protect the output file
chmod 600 server-unencrypted.key
On Unix-like systems, this restricts access to the file's owner. File permissions are only one layer of protection; also consider ownership, backups, system access, and the storage environment.
Re-encrypt a private key
openssl pkey \
-in server-unencrypted.key \
-aes-256-cbc \
-out server-reencrypted.key
This command prompts for a new passphrase and writes an encrypted private key.
16 · CERTIFICATE EXTENSIONS
Digital Signature, Key Encipherment, and Key Usage
Certificate extensions describe which cryptographic operations and application purposes are permitted.
The X.509 Key Usage extension defines permitted uses for a certificate's public key. Extended Key Usage identifies broader application purposes, such as server authentication or email protection.
Digital Signature
The digitalSignature usage indicates that
the key may be used for digital signatures, subject
to the certificate's other restrictions.
TLS 1.2 and TLS 1.3 commonly use certificate private keys to sign handshake data, depending on the selected authentication algorithm.
Digital signatures can also be used for signed email, signed software, and other applications.
Key Encipherment
The keyEncipherment usage historically
supported RSA key transport in older TLS configurations.
This mechanism is not used in TLS 1.3, and static RSA
key exchange is no longer supported by modern TLS.
Key encipherment remains relevant to certain legacy systems and applications, but should not be added automatically to every new certificate.
Key Agreement
The keyAgreement usage is associated
with key-agreement operations. Whether it is appropriate
depends on the key type and application.
Extended Key Usage
- Server Authentication: Permits use for TLS server authentication when other certificate requirements are satisfied.
- Client Authentication: Permits use for TLS client authentication.
- Email Protection: Supports appropriate email security applications.
- Code Signing: Identifies certificates intended for code-signing applications.
Inspect key usage in a certificate
openssl x509 \
-in server.crt \
-noout \
-ext keyUsage,extendedKeyUsage
The certificate's extensions should match the intended use. The exact requirements depend on the application and the applicable certificate policy.
Do not copy legacy certificate templates blindly.
A certificate intended for an older RSA key-transport workflow may contain extensions that are unnecessary for a modern TLS deployment. Use current CA guidance and the requirements of your software rather than assuming every certificate needs every usage bit.
17 · EMAIL SECURITY
How Are Certificates Used in Email?
Email security involves several different mechanisms. Certificates may authenticate a mail server, sign a message, or support encryption of its contents.
Transport encryption
Mail servers and clients can use TLS to protect the connection between them. This helps prevent network observers from reading or modifying the traffic in transit.
Transport encryption does not automatically encrypt the message end to end. A message may be stored or forwarded through systems where different security controls apply.
S/MIME digital signatures
Secure/Multipurpose Internet Mail Extensions (S/MIME) can use certificates and public-key cryptography to sign email messages.
A sender creates a digital signature using the appropriate private key. A recipient verifies it using the corresponding public key and evaluates the associated certificate and trust information.
A valid signature can help establish message integrity and associate the signature with a certified identity. It does not prove that the sender's message is truthful or that the sender's private key has never been compromised.
S/MIME email encryption
Email encryption protects message contents from unauthorized readers. In a common public-key workflow, a sender encrypts the message for the recipient using a cryptographic process that only the recipient's corresponding private key can complete.
The sender generally needs an appropriate public encryption key for each recipient. A recipient's certificate must support the intended email-protection use, and both parties' email software must support the selected S/MIME features.
Can OpenSSL sign an email?
OpenSSL can perform cryptographic signing operations, but signing a standards-compliant S/MIME message requires the correct MIME structure, certificate, private key, and compatible message-processing workflow.
For everyday business email, it is usually easier to configure S/MIME in a supported email client than to construct signed messages manually.
Signing and encryption are not the same thing.
A digital signature helps recipients verify integrity and the association with a signing key. Encryption protects confidentiality. Some messages use both; others use only one.
18 · OPERATIONS
Certificate Lifecycle: From Creation to Renewal
A certificate is not a one-time installation. It is part of an ongoing operational process.
Generate the key
Create a cryptographic key pair using an appropriate algorithm and protect the private key.
Create the CSR
Prepare the certificate request with the public key and requested identity information.
Validate and issue
The CA validates the requested identity and issues the certificate under its policies.
Install and verify
Install the certificate and required intermediate chain, configure the service, and test the live connection.
Monitor and renew
Track expiration, renew before the deadline, deploy the replacement certificate, and confirm that clients can connect successfully.
Revoke or replace when necessary
If a private key is compromised or a certificate is no longer trustworthy, follow the relevant revocation, replacement, and incident-response procedures.
19 · TROUBLESHOOTING
Common SSL/TLS Certificate Problems
Many certificate errors are caused by a mismatch between the certificate, server configuration, and client's trust requirements.
Hostname mismatch
Symptom: The certificate is not valid for the requested hostname.
Check: Inspect the SAN extension and verify that the requested hostname appears among the certificate's identifiers.
openssl x509 -in server.crt -noout -ext subjectAltName
Expired certificate
Symptom: The certificate's validity period has ended.
Check: Inspect the validity dates and confirm that the renewed certificate has actually been installed.
openssl x509 -in server.crt -noout -dates
Incomplete certificate chain
Symptom: Some clients cannot build a trusted chain to a root certificate.
Check: Verify that the server presents the required intermediate certificates and that the client has the intended trust anchors.
openssl s_client \
-connect example.com:443 \
-servername example.com \
-showcerts
Certificate and key do not match
Symptom: The server cannot use the configured certificate and key together.
Check: Compare the SHA-256 digests of the certificate's and private key's public-key representations using the commands in the OpenSSL workshop.
Untrusted self-signed certificate
Symptom: A client reports that the certificate is not trusted.
Check: Determine whether the certificate should chain to a public CA or whether the correct private root CA needs to be distributed through a trusted administrative process.
Private-key passphrase problems
Symptom: The service cannot load its private key or fails during startup.
Check: Confirm the passphrase, file format, permissions, and service-specific secret configuration. Avoid removing encryption without considering the security consequences.
Build a repeatable verification checklist
- Is the certificate currently valid?
- Does the SAN extension contain the correct hostname?
- Does the certificate match the private key?
- Is the chain complete and trusted?
- Are the intended TLS versions enabled?
- Is the private key stored with appropriate permissions?
- Does automatic renewal work?
- Has the live endpoint been tested after deployment?
20 · SECURITY CHECKLIST
SSL/TLS Certificate Best Practices
Good certificate management is a combination of cryptography, access control, automation, and monitoring.
-
01
Protect private keys
Restrict file permissions, minimize copies, protect backups, and keep private keys out of public repositories and logs.
-
02
Use current TLS configurations
Disable obsolete SSL and deprecated TLS versions. Prefer TLS 1.3 where supported and configure TLS 1.2 securely when compatibility requires it.
-
03
Automate renewal
Use a supported certificate-management workflow and monitor renewal failures. A certificate that expires can interrupt business operations.
-
04
Maintain a certificate inventory
Record the domains, owners, expiry dates, issuing authorities, and deployment locations of your certificates.
-
05
Validate before deployment
Check the hostname, chain, key match, validity dates, and intended certificate usages before putting a certificate into production.
-
06
Plan for key compromise
Know how to revoke or replace a certificate, rotate a private key, update dependent services, and investigate unauthorized access.
QUICK REFERENCE
Your Certificate Security Checklist
Use these checks before deploying a new certificate or reviewing an existing environment.
- Confirm the certificate is intended for the correct domain or service.
- Verify the certificate's validity dates and chain.
- Confirm that the certificate matches the private key.
- Check that SAN and key-usage extensions are appropriate.
- Protect the private key with appropriate access controls.
- Configure modern TLS versions and cipher suites.
- Automate certificate renewal and monitor failures.
- Test the live endpoint after every certificate change.
FINAL THOUGHTS
Certificates Are the Beginning of Trust, Not the End
SSL/TLS certificates connect identities to cryptographic keys, helping applications establish secure and authenticated communications.
Understanding certificates means understanding more than encryption. It means knowing how public and private keys work together, why certificate authorities matter, how trust is established, and what happens when a certificate expires or a private key is compromised.
With OpenSSL, you can generate keys, create certificate requests, inspect certificate details, compare public keys, calculate fingerprints, and troubleshoot live TLS connections. Combined with automated renewal and sound key-management practices, these skills help keep services reliable and secure.
The most important takeaway is simple: use the right certificate for the right purpose, protect its private key, validate the chain of trust, and keep the entire lifecycle under control.
KEEP LEARNING
Build a Stronger Security Foundation
Certificates are one part of a secure network. Continue learning about intrusion detection, network monitoring, and practical incident response to strengthen your organization's overall security posture.
Explore Network SecurityFURTHER READING
Authoritative References
Use the following documentation to explore certificate standards, OpenSSL commands, TLS protocols, and automated certificate management in more detail.
- Let's Encrypt Documentation — Certificate issuance, renewal, trust chains, and ACME challenges.
- Let's Encrypt Challenge Types — How domain control is validated.
- OpenSSL req Documentation — Creating and inspecting certificate requests.
- OpenSSL x509 Documentation — Inspecting and processing X.509 certificates.
- OpenSSL pkey Documentation — Processing public and private keys.
- OpenSSL verify Documentation — Certificate-chain verification.
- RFC 5280 — X.509 certificates, certificate extensions, and certificate-chain infrastructure.
- RFC 8446 — The TLS 1.3 protocol specification.
- RFC 8555 — The ACME protocol used for automated certificate management.