What Is Perfect Forward Secrecy?
Perfect forward secrecy: the problem it solves
Without forward secrecy, the session key can be derived using the server's long-term private key (classic RSA key exchange). An attacker who records encrypted traffic today and steals or obtains the key years later could decrypt everything they saved. With PFS, the long-term key is used only to prove identity. The session key is agreed through a temporary exchange and then discarded, so there is nothing to recover afterward.
How it works in short
- Client and server each generate a temporary key pair for this session.
- They exchange the public parts and compute the same shared secret.
- The server signs part of the exchange with its certificate key to prove who it is.
- Both sides delete the temporary keys when the session ends.
Perfect forward secrecy: which settings give it
| Setting | Forward secrecy? |
|---|---|
| TLS 1.3, any suite | Yes, always |
| TLS 1.2 with ECDHE-... | Yes |
| TLS 1.2 with DHE-... (strong parameters) | Yes |
| TLS 1.2 with plain RSA key exchange (AES128-GCM-SHA256 style names) | No |
| TLS 1.0 and 1.1, deprecated in RFC 8996 | Depends on suite, and the protocols themselves should be disabled |
Enable it on Nginx
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;
ssl_prefer_server_ciphers off;
ssl_session_tickets off;
Enable it on Apache
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384
SSLSessionTickets off
Session tickets are mentioned on purpose. If a server reuses a long-lived ticket key, an attacker who obtains it could decrypt resumed sessions, weakening the benefit. Turning tickets off, or rotating the ticket key often, avoids that. TLS 1.3 handles this better by design, but resumption keys still deserve care.
Test it
Use the TLS checker to see which protocols and suites you accept, and the SSL checker for the certificate. From the command line:
openssl s_client -connect example.com:443 -servername example.com < /dev/null 2>/dev/null | grep -E "Protocol|Cipher|Server Temp Key"
A "Server Temp Key" line (or an ECDHE cipher, or TLS 1.3) shows an ephemeral exchange was used. For more on picking suites, read checking SSL cipher suites.
Trade-offs
- Compatibility: Very old clients lack ECDHE support. This rarely matters for public websites today.
- Performance: ECDHE is fast on modern hardware. DHE with large parameters is slower, so prefer ECDHE.
- Monitoring: Forward secrecy means network inspection tools that rely on a copy of the server key can no longer decrypt traffic. Plan for that in internal debugging.
Related reading: Best TLS Configuration for Nginx and Apache, the TLS version checker, protecting against HTTPS downgrade attacks and testing with OpenSSL.
Frequently Asked Questions
Does PFS protect me if the server is hacked right now?
No. It protects past recorded sessions against a later key leak, not live sessions on a compromised machine.
Is PFS enabled by default?
On current software with default or recommended settings, usually yes through TLS 1.3 and ECDHE suites. Always verify.
Do I need a special certificate?
No. Any certificate works, because PFS depends on the key exchange, not the certificate.
Is it required for compliance?
Many security baselines recommend or require it. Check the standard that applies to you.
✅ Post-Installation Verification & SEO Checklist
After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:
- Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
- Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
- Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
- Confirm both root and
wwwversions resolve cleanly to one canonical HTTPS URL. - Verify your HTTPS property and
sitemap.xmlinside Google Search Console and Bing Webmaster Tools.