PKI Use Cases: HTTPS, S/MIME, and Code Signing
Apply PKI concepts to real-world scenarios: securing web traffic, encrypting email with S/MIME, and verifying software integrity with code-signing certificates.
PKI Use Cases: HTTPS, S/MIME, and Code Signing is a free Cloud & IT Cert Prep lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cloud & IT Cert Prep learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
PKI in Real-World Applications
Public Key Infrastructure (PKI) is the invisible backbone of secure digital communications. The certificates and CAs you've studied are applied in dozens of real-world scenarios daily. The Security+ exam tests your ability to recognize PKI use cases, understand which certificate type is appropriate for each, and identify what protection PKI provides in each context. The three most important use cases on the exam are HTTPS/TLS (web security), S/MIME (email security), and code signing (software integrity).
HTTPS: PKI for Web Security
HTTPS (HTTP over TLS) is the most visible PKI use case. When you connect to https://bank.com, your browser: (1) receives the server's TLS certificate, (2) verifies the certificate chain leads to a trusted root CA, (3) checks the hostname against the SAN fields, (4) verifies the certificate isn't revoked, and (5) uses the public key for a Diffie-Hellman key exchange to establish an encrypted session. The padlock icon in your browser signifies all these checks passed. A missing or invalid certificate results in a browser warning that stops most users from proceeding.
# Check HTTPS certificate details
curl -v https://example.com 2>&1 | grep -A 10 'SSL certificate'
# Test TLS configuration quality
openssl s_client -connect example.com:443 -tls1_3 2>/dev/null | \
grep -E 'Protocol|Cipher|Verify'
# Protocol: TLSv1.3
# Cipher: TLS_AES_256_GCM_SHA384
# Verify return code: 0 (ok)S/MIME: PKI for Email Security
S/MIME (Secure/Multipurpose Internet Mail Extensions) uses PKI certificates to provide two security services for email. Encryption: the sender encrypts the email body with the recipient's public key, so only the recipient can decrypt it — protecting confidentiality even if the email is intercepted in transit or stored on a compromised server. Digital signatures: the sender signs with their private key, proving to the recipient that the email genuinely came from the sender and has not been altered — protecting integrity and providing non-repudiation. S/MIME requires each user to have their own certificate issued by a CA.
# S/MIME email signing and encryption with OpenSSL
# Sign an email
openssl smime -sign -in email_body.txt -signer alice_cert.pem \
-inkey alice_private.key -out signed_email.eml -outform PEM
# Encrypt an email (using Bob's public key/certificate)
openssl smime -encrypt -aes256 -in email_body.txt \
-out encrypted_email.eml bob_cert.pem
# Bob decrypts with his private key
openssl smime -decrypt -in encrypted_email.eml \
-recip bob_cert.pem -inkey bob_private.keyCode Signing: PKI for Software Integrity
Code signing uses PKI to digitally sign software — executables, scripts, drivers, and installers — so users can verify the software came from a trusted publisher and has not been tampered with. The software vendor signs their code with a private key from a code-signing certificate issued by a trusted CA. When a user runs the software, the OS verifies the signature using the vendor's public key from the certificate chain. Windows SmartScreen, macOS Gatekeeper, and iOS/Android app stores all rely on code signing to establish software provenance. Unsigned software may be blocked or trigger security warnings.
# Verify code signing on Windows (PowerShell)
Get-AuthenticodeSignature -FilePath 'C:\Software\installer.exe' | Format-List
# Status: Valid
# SignerCertificate: [certificate details]
# TimeStamperCertificate: [timestamp CA details]
# On Linux/macOS, verify GPG signature of downloaded software
gpg --verify hashicorp_public.gpg terraform.zip.sig terraform.zip
# Good signature from 'HashiCorp Security (hashicorp.com/security)'Client Certificate Authentication
Client certificate authentication (also called mutual TLS or mTLS) extends the standard TLS model by requiring the client to present a certificate as well. In standard TLS, only the server is authenticated by certificate; in mTLS, both parties are mutually authenticated. This is used for: VPN authentication (smart cards or client certs instead of passwords), API authentication (machine-to-machine authentication where the client is a service, not a human), and privileged admin access (requiring administrators to use hardware tokens with embedded certificates).
# nginx configuration for mutual TLS (client certificate required)
# server {
# listen 443 ssl;
# ssl_certificate /path/to/server_cert.pem;
# ssl_certificate_key /path/to/server_key.pem;
# ssl_client_certificate /path/to/ca_cert.pem;
# ssl_verify_client on;
# ssl_verify_depth 2;
# }
# Test with a client certificate
curl --cert client_cert.pem --key client_key.pem https://api.example.com/SSH Host Key Verification
SSH uses public key cryptography for two purposes: server authentication and client authentication. Server authentication: when you first connect to an SSH server, it presents its host key (public key). Your SSH client stores this in ~/.ssh/known_hosts. On subsequent connections, if the host key changes (which could indicate a MITM attack or server rebuild), SSH warns you. Client authentication: instead of passwords, administrators use key pairs — the public key is added to the server's authorized_keys, and the private key (never sent) proves identity. SSH host keys are separate from PKI certificates but serve the same trust function.
# First-time SSH connection stores server host key
ssh user@server.example.com
# The authenticity of host 'server.example.com' can't be established.
# ED25519 key fingerprint is SHA256:abc123...
# Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
# Host key stored in: ~/.ssh/known_hosts
cat ~/.ssh/known_hosts | grep server.example.com
# If host key changes:
# WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!Document Signing and Timestamping
PKI enables legally binding digital document signing in many jurisdictions. Adobe PDF signatures, DocuSign, and government e-signature systems all use PKI certificates to sign documents. A critical complement to document signing is timestamping: a Trusted Timestamp Authority (TSA) countersigns the document's hash with a trusted time, proving the document existed at a specific point in time. Timestamping is essential for code signing as well — without a timestamp, code signatures become invalid when the signing certificate expires, even for software distributed before the expiry.
IoT Device Certificates
As IoT devices proliferate, PKI provides a mechanism to authenticate devices at scale. Each device is provisioned with a unique certificate during manufacturing (a process called device identity provisioning), allowing servers to authenticate individual devices by their certificates. This enables scenarios like: a smart meter proving its identity to the utility's server, a medical device authenticating to a hospital network, or a fleet of vehicles authenticating to a manufacturer's backend. IoT PKI must handle millions of devices with constrained resources, driving adoption of ECC certificates for their small size and fast verification.
VPN Authentication with Certificates
Certificate-based VPN authentication is significantly more secure than password-based VPN authentication. Each VPN user or device is issued a client certificate by the organization's internal CA. When connecting, the VPN gateway verifies the client certificate (ensuring it was issued by the trusted internal CA, is within its validity period, and hasn't been revoked via CRL/OCSP). When an employee leaves, revoking their certificate immediately prevents VPN access — more reliable than hoping they haven't shared their password with others.
# OpenVPN client certificate configuration
# client
# remote vpn.example.com 1194
# proto udp
# ca ca.crt <- CA certificate (trust anchor)
# cert client.crt <- Client's certificate
# key client.key <- Client's private key
# tls-auth ta.key 1
# cipher AES-256-GCM
# The VPN server verifies the client cert chain against ca.crt
# Revoked certs listed in CRL won't be acceptedCommon Certificate-Related Errors
Security professionals must be able to diagnose common certificate errors. Certificate expired: notAfter date has passed — renew the certificate. Hostname mismatch: the certificate's SAN does not match the requested hostname — verify CNs and SANs, may need a wildcard or multi-SAN cert. Self-signed certificate: no CA has vouched for this certificate — add to local trust store or replace with CA-signed cert. Incomplete chain: intermediate CA certificate not provided by the server — configure the server to send the full chain. Certificate revoked: CRL or OCSP shows revocation — immediate key compromise response needed.
# Diagnose certificate errors with openssl
openssl s_client -connect server.example.com:443 2>&1
# Common error messages:
# depth=0 ... error 10 at 0 depth lookup: certificate has expired
# depth=0 ... error 18: self-signed certificate
# depth=0 ... error 20: unable to get local issuer certificate (broken chain)
# depth=0 ... error 23: certificate revoked
# Verify return code: 0 (ok) = successWildcard vs SAN Certificates
Two certificate types handle multiple hostnames. A wildcard certificate covers all first-level subdomains of a domain: *.example.com covers www.example.com, mail.example.com, api.example.com, but NOT sub.api.example.com (two levels). One certificate, one private key for all services — convenient but risky if the key is compromised (all services affected). A multi-SAN certificate explicitly lists multiple specific domains in the SAN extension (e.g., example.com, www.example.com, api.example.com). More granular but requires updating the certificate when new domains are added.
Quick Check
Test your understanding of CompTIA Security+ (SY0-701) concepts from this lesson.
Lesson Recap
In this lesson you learned: HTTPS/TLS uses server certificates to encrypt web traffic and authenticate servers; S/MIME certificates enable email signing and encryption; code signing certificates prove software integrity and publisher identity; and client certificates enable mutual authentication for VPNs and APIs. Next up we explore Password Policies and Multi-Factor Authentication.
Frequently asked questions
Is the “PKI Use Cases: HTTPS, S/MIME, and Code Signing” lesson free?
Yes — the full text of “PKI Use Cases: HTTPS, S/MIME, and Code Signing” is free to read here on the web, and the Cloud & IT Cert Prep course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cloud & IT Cert Prep course, upgrade to CoddyKit PRO.
What will I learn in “PKI Use Cases: HTTPS, S/MIME, and Code Signing”?
Apply PKI concepts to real-world scenarios: securing web traffic, encrypting email with S/MIME, and verifying software integrity with code-signing certificates. You practise Cloud & IT Cert Prep with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Cloud & IT Cert Prep?
No prior experience is required. Cloud & IT Cert Prep on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “PKI Use Cases: HTTPS, S/MIME, and Code Signing” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Cloud & IT Cert Prep lesson?
Yes. Every Cloud & IT Cert Prep lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Certificate Authorities and Trust Chains
- X.509 Certificate Structure
- Certificate Lifecycle and Revocation
- PKI Use Cases: HTTPS, S/MIME, and Code Signing