SSL/TLS certificates come in a bewildering array of formats and file extensions. If you've ever struggled with "invalid certificate format" errors when configuring a web server, installing a certificate on Windows IIS, or deploying to a cloud platform, you're not alone. Understanding certificate formats is essential for anyone managing web security infrastructure.
This comprehensive guide breaks down every major certificate format—PEM, DER, PFX/PKCS#12, P7B/PKCS#7, CER, and CRT—explaining their technical characteristics, use cases, platform compatibility, and how to convert between them.
Not sure which format you need? Try our free SSL Certificate Selector to instantly match the right SSL certificate format and type to your platform.
Understanding Encoding vs. File Extensions
Before diving into specific formats, it's important to distinguish between encoding (how data is structured) and file extensions (what the file is named).
Encoding refers to how the certificate data is represented:
- PEM: Base64-encoded text with header/footer lines
- DER: Binary encoding
File extensions are just naming conventions:
.crt,.cer,.pem,.keytypically contain PEM-encoded data.dertypically contains DER-encoded data.pfx,.p12contain PKCS#12 archives.p7b,.p7ccontain PKCS#7 structures
The confusing part: file extensions aren't always reliable indicators of the actual format inside. A .cer file might contain either PEM or DER encoding. You often need to examine the file contents to know for sure.
PEM Format (Privacy-Enhanced Mail)
PEM is the most common certificate format, especially in the Linux/Unix world. Despite the name, it has nothing to do with email anymore—the format was originally designed for secure email transmission in the 1990s but is now the de facto standard for certificate files.
Characteristics:
- Text-based format using Base64 encoding
- Readable in any text editor
- Enclosed in header/footer lines like
-----BEGIN CERTIFICATE----- - Each certificate, key, or request gets its own BEGIN/END block
- Can contain multiple certificates in a single file (certificate chain)
Example PEM Certificate:
-----BEGIN CERTIFICATE-----
MIIDXTCCAkWgAwIBAgIJAKL0UG+mRKkzMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMQ0wCwYDVQQKDARUZXN0MRIwEAYD
VQQDDAlsb2NhbGhvc3QwHhcNMjUwMTIwMDAwMDAwWhcNMjYwMTIwMDAwMDAwWjBF
... (more base64 data) ...
-----END CERTIFICATE-----
Common Uses:
- Apache, Nginx, and most Linux-based web servers
- Cloud platforms (AWS, Google Cloud, Azure)
- Let's Encrypt and other free Certificate Authorities
- OpenSSL command-line operations
- Docker containers and Kubernetes
File Extensions:
.pem- Generic PEM file.crt- Certificate (PEM-encoded).cer- Certificate (PEM-encoded on Linux, DER on Windows).key- Private key (PEM-encoded)
Advantages:
- Human-readable, easy to copy/paste
- Works across virtually all platforms
- Can concatenate multiple certificates for a full chain
- Easy to verify contents visually
- Flexible file management—store private keys separately with different permissions
- Perfect for scripting and automation with standard text processing tools
Disadvantages:
- Larger file size than DER (base64 encoding adds ~33% overhead)
- Private keys stored unencrypted by default (though can be encrypted with a passphrase)
- Easy to accidentally share private keys (they're plain text)
- Managing multiple separate files increases complexity
- Risk of misconfigured file permissions exposing private keys
DER Format (Distinguished Encoding Rules)
DER is a binary encoding of the same ASN.1 structures used in PEM. It's essentially PEM without the base64 encoding and header/footer lines—just the raw binary certificate data.
Characteristics:
- Binary format (not human-readable)
- Compact, efficient encoding
- No header/footer lines
- Single certificate per file (can't chain multiple certificates)
- Identical data to PEM, just different encoding
Common Uses:
- Java applications (Tomcat, JBoss)
- Windows environments (sometimes)
- Binary protocols where text encoding is inefficient
- Embedded systems with limited memory
File Extensions:
.der- DER-encoded certificate or key.cer- Certificate (DER-encoded on Windows, PEM on Linux)
Advantages:
- Smaller file size than PEM
- Efficient for binary protocols
- Less overhead when parsing programmatically
Disadvantages:
- Not human-readable (can't inspect in a text editor)
- Harder to copy/paste
- Less universally supported than PEM
- Can't easily concatenate certificate chains
PFX/PKCS#12 Format (Personal Information Exchange)
PFX, also known as PKCS#12 or P12, is a binary archive format that can bundle multiple cryptographic objects into a single, password-protected file. Think of it as a "certificate suitcase" that contains everything you need.
Characteristics:
- Binary archive format (like a ZIP file for certificates)
- Password-protected with strong encryption
- Can contain: certificate + private key + intermediate certificates + root CA
- Supports multiple encryption algorithms (TripleDES, AES-256, RC2)
- Self-contained—everything in one file
Example Contents: A typical PFX file contains:
- Your server certificate
- Your private key (encrypted)
- Intermediate CA certificate(s)
- Optionally, the root CA certificate
Common Uses:
- Windows servers (IIS, Exchange)
- Azure App Service
- Importing certificates into Windows Certificate Store
- Code signing certificates
- S/MIME email certificates
- iOS device profiles (requires TripleDES encryption)
File Extensions:
.pfx- Personal Information Exchange (Windows naming).p12- PKCS#12 (cross-platform naming)
Advantages:
- Everything in one convenient file
- Strong password protection for the entire archive
- Impossible to accidentally use certificate without private key
- Easy to backup and transfer securely
- Widely supported on Windows
- Single file simplifies deployment and distribution
Disadvantages:
- Binary format (not human-readable, requires tools to inspect)
- Must remember the password (unrecoverable if lost—private key is permanently inaccessible)
- Some platforms don't support it (older Linux systems)
- Different encryption algorithms cause compatibility issues
- Single point of failure—if password is compromised, everything is exposed
- Less flexible than PEM's separate file approach
Encryption Algorithms:
PFX supports multiple encryption algorithms with varying security and compatibility:
- TripleDES (3DES): Older, slower encryption but required for iOS compatibility. Use for iPhone/iPad configuration profiles.
- AES-256: Modern, strong encryption with better performance. Default in recent OpenSSL versions.
- RC2: Legacy algorithm—avoid if possible due to security weaknesses.
iOS Compatibility Note: iOS devices require PFX files to use TripleDES encryption, not AES-256. When creating a PFX file for iPhone/iPad configuration profiles, you must explicitly specify TripleDES as the encryption algorithm using specific OpenSSL flags (see conversion examples below).
P7B/PKCS#7 Format (Cryptographic Message Syntax)
P7B, also known as PKCS#7, is a container format designed to hold multiple certificates for certificate chain verification. Unlike PFX, it cannot store private keys—only certificates.
Characteristics:
- Can be either PEM or DER encoded
- Contains one or more certificates (typically a chain)
- No private key support
- Used for certificate distribution, not deployment
- Based on S/MIME and CMS standards
Example Contents: A typical P7B file contains:
- Your server certificate
- Intermediate CA certificate(s)
- Optionally, the root CA certificate
Common Uses:
- Windows Certificate Authorities
- Java keystores (Tomcat)
- Certificate chain distribution
- Microsoft platforms (Windows, IIS)
File Extensions:
.p7b- PKCS#7 certificate bundle.p7c- PKCS#7 certificate bundle
Advantages:
- Safe to distribute (no private key)
- Contains full certificate chain
- Can be base64-encoded (readable) or binary
- Widely supported on Windows
Disadvantages:
- Can't contain private keys (need separate key file)
- Less common on Linux/Apache/Nginx
- Requires conversion for many use cases
CER Format (Certificate)
CER is a file extension, not a format. CER files can contain either PEM or DER encoding, making them particularly confusing. The actual encoding depends on the platform and how the file was created.
Characteristics:
- File extension only (not a format)
- Usually PEM-encoded on Linux/macOS
- Usually DER-encoded on Windows
- Contains only the certificate (not the private key)
Common Uses:
- Windows platforms (double-click to install)
- SSL certificate downloads from CAs
- Certificate distribution
File Extensions:
.cer- Certificate (encoding varies)
Identification Tip:
Open the file in a text editor. If you see -----BEGIN CERTIFICATE-----, it's PEM-encoded. If you see binary garbage, it's DER-encoded.
CRT Format (Certificate)
Like CER, CRT is primarily a file extension rather than a distinct format. CRT files are almost always PEM-encoded on Linux/Unix systems.
Characteristics:
- File extension only
- Almost always PEM-encoded
- Contains only the certificate (not the private key)
- Common on Linux/Apache/Nginx
Common Uses:
- Linux web servers
- SSL certificate storage
- Certificate distribution on Unix systems
File Extensions:
.crt- Certificate (usually PEM-encoded)
Platform Compatibility Guide
Different platforms prefer different certificate formats:
Apache/Nginx (Linux):
- Certificate: PEM (
.crt,.pem) - Private Key: PEM (
.key) - Chain: PEM (
.pem) with multiple certificates
IIS (Windows):
- Preferred: PFX/PKCS#12 (
.pfx) - Alternative: PEM certificates + separate key (requires binding)
Java (Tomcat/JBoss):
- Java KeyStore (
.jks) created from PFX/PKCS#12 - Alternative: P7B chain + separate DER key
Cloud Platforms:
- AWS: PEM format
- Google Cloud: PEM format
- Azure: PFX/PKCS#12 or PEM
Code Signing:
- Windows: PFX/PKCS#12 (
.pfx) - Java: JKS created from PFX
iOS Configuration:
- PFX/PKCS#12 with TripleDES encryption
Converting Between Formats
Converting certificate formats is a common task. Here are the most frequently needed conversions with OpenSSL commands:
PEM to PFX (Linux to Windows)
Convert separate PEM files into a single PFX archive:
# Standard conversion with AES-256 encryption
openssl pkcs12 -export \
-out certificate.pfx \
-inkey private.key \
-in certificate.crt \
-certfile chain.crt \
-passout pass:YourStrongPassword
For iOS compatibility (TripleDES encryption):
openssl pkcs12 -export \
-out certificate.pfx \
-inkey private.key \
-in certificate.crt \
-certfile chain.crt \
-keypbe PBE-SHA1-3DES \
-certpbe PBE-SHA1-3DES \
-macalg sha1 \
-passout pass:YourStrongPassword
Or use the shorter -legacy flag (OpenSSL 3.0+):
openssl pkcs12 -export -legacy \
-out certificate.pfx \
-inkey private.key \
-in certificate.crt \
-certfile chain.crt
PFX to PEM (Windows to Linux)
Extract separate PEM files from a PFX archive:
Extract private key:
# With passphrase protection
openssl pkcs12 -in certificate.pfx \
-nocerts -out private.key \
-passin pass:YourPassword
# Without passphrase (use -nodes flag)
openssl pkcs12 -in certificate.pfx \
-nocerts -out private.key -nodes \
-passin pass:YourPassword
Extract certificate:
openssl pkcs12 -in certificate.pfx \
-clcerts -nokeys -out certificate.crt \
-passin pass:YourPassword
Extract CA chain:
openssl pkcs12 -in certificate.pfx \
-cacerts -nokeys -out chain.crt \
-passin pass:YourPassword
Create fullchain (certificate + chain):
cat certificate.crt chain.crt > fullchain.pem
Extract everything at once:
# All objects (certificate + key + chain) in one PEM file
openssl pkcs12 -in certificate.pfx \
-out everything.pem -nodes \
-passin pass:YourPassword
PEM to DER
Convert text PEM to binary DER:
openssl x509 -in certificate.crt \
-outform DER -out certificate.der
DER to PEM
Convert binary DER to text PEM:
openssl x509 -in certificate.der \
-inform DER -out certificate.crt
P7B to PEM
Extract certificates from P7B bundle:
openssl pkcs7 -print_certs \
-in certificate.p7b -out certificates.pem
PEM to P7B
Create P7B bundle from PEM certificates:
openssl crl2pkcs7 -nocrl \
-certfile certificate.crt \
-certfile chain.crt \
-out certificate.p7b
Security Considerations
When handling certificate files, security is paramount. Both PEM and PFX have specific security characteristics:
PEM Security Considerations
Private Key Exposure Risk:
PEM private keys can be unencrypted, making them vulnerable if file permissions are misconfigured. A misconfigured web server with world-readable private keys is a common security incident.
Best practices:
# Correct permissions for private keys
chmod 600 private.key # Read/write for owner only
chmod 644 certificate.crt # Readable by all, writable by owner
Encrypt Private Keys with Passphrases:
When not using automated certificate management, encrypt PEM private keys:
# Encrypt an existing private key
openssl rsa -aes256 -in private.key -out private-encrypted.key
# Generate encrypted private key during CSR creation
openssl req -new -newkey rsa:2048 -keyout private.key -out csr.pem
Accidental Disclosure:
Because PEM is text, it's easy to accidentally copy/paste private keys into insecure channels like emails, Slack messages, documentation, or public GitHub repositories. Always verify what you're sharing.
Separate File Management:
Managing multiple files (certificate, key, chain) increases the risk of:
- Forgetting to secure one of the files
- Mixing up files between different certificates or environments
- Incomplete backups (backing up certificate but not private key)
PEM Best Practices:
- Always encrypt private keys with strong passphrases in production
- Use restrictive file permissions (600 for keys, 644 for certificates)
- Store private keys in separate, more secure locations if possible
- Never commit private keys to version control (add
*.keyto.gitignore) - Use separate keys for different environments (dev/staging/prod)
- Consider hardware security modules (HSMs) for critical keys
- Rotate certificates and keys regularly
PFX Security Considerations
Password Strength is Critical:
The entire security of a PFX file depends on the password. A weak password makes the archive vulnerable to brute-force attacks. Once someone has your PFX file, they can attempt unlimited password guesses offline without detection.
Password requirements:
- Minimum 20 characters (30+ for high-security environments)
- Mix of uppercase, lowercase, numbers, and symbols
- Avoid dictionary words or predictable patterns
- Use a password manager to generate and store
Encryption Algorithm Matters:
PFX supports multiple encryption algorithms with varying security levels:
- TripleDES (3DES): Older algorithm (112-bit effective security), slower performance, but required for iOS compatibility. Still considered secure against practical attacks.
- AES-256: Modern, strong encryption with 256-bit security and better performance. Default in recent OpenSSL versions.
- RC2: Legacy algorithm with known weaknesses—avoid if possible.
Recommendation: Use AES-256 for all modern systems unless iOS compatibility requires TripleDES.
Single Point of Failure:
If someone obtains your PFX file and cracks the password, they have everything—certificate, private key, and entire chain. Unlike PEM where you can protect the private key separately, PFX bundles everything.
Defense-in-depth considerations:
- Store PFX files in encrypted directories or volumes
- Use filesystem encryption (LUKS, BitLocker, FileVault)
- Implement access logging for PFX file access
- Consider splitting storage (PFX in one location, password in another)
Password Management:
Forgetting a PFX password means losing access to the private key permanently. There is no password recovery mechanism—the encryption is unbreakable without the password.
Password storage best practices:
- Store passwords in a secure password manager (LastPass, 1Password, Bitwarden)
- Keep offline backups of critical passwords in a physical safe
- Document password location in disaster recovery procedures
- Never store passwords in plaintext alongside PFX files
PFX Best Practices:
- Use strong passwords (20+ characters minimum)
- Prefer AES-256 encryption unless iOS compatibility is required
- Store PFX files in encrypted locations with access logging
- Never email PFX files even with passwords (use encrypted file transfer)
- Keep passwords in a separate, secure password manager
- Create multiple backups stored in different physical locations
- Document password recovery procedures
- Rotate certificates regularly (annually or bi-annually)
Universal Security Practices
Secure Transfer:
- Never email private keys or PFX files (even password-protected)
- Use secure file transfer protocols (SFTP, SCP, HTTPS with client certificates)
- Consider encrypting with PGP/GPG before transfer for additional protection
- Verify recipient identity before sending sensitive certificate materials
Backup Strategy:
- Store encrypted backups of PFX files or PEM private keys offline
- Keep passwords in a separate, secure location (not with the backup)
- Test restoration procedures regularly (quarterly)
- Maintain backups in geographically distributed locations
- Document backup and restore procedures
Access Control:
- Limit who can access certificate private keys (principle of least privilege)
- Implement audit logging for certificate access
- Use role-based access control (RBAC) for certificate management systems
- Regularly review access permissions
Platform-Specific Deployment Examples
Different platforms require different certificate deployment approaches. Here are practical examples for common scenarios:
Nginx (PEM Format)
Nginx requires PEM format with separate certificate and key files:
server {
listen 443 ssl http2;
server_name example.com www.example.com;
# Full chain (certificate + intermediates)
ssl_certificate /etc/nginx/ssl/fullchain.pem;
# Private key
ssl_certificate_key /etc/nginx/ssl/private.key;
# Modern SSL configuration
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
# HSTS (optional but recommended)
add_header Strict-Transport-Security "max-age=31536000" always;
}
File structure:
/etc/nginx/ssl/
├── fullchain.pem (certificate + intermediate CA)
└── private.key (private key, chmod 600)
Apache (PEM Format)
Apache uses similar PEM format but with different directives:
<VirtualHost *:443>
ServerName example.com
SSLEngine on
# Server certificate
SSLCertificateFile /etc/ssl/certs/certificate.crt
# Private key
SSLCertificateKeyFile /etc/ssl/private/private.key
# Intermediate CA chain
SSLCertificateChainFile /etc/ssl/certs/chain.crt
# Modern SSL configuration
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite HIGH:!aNULL:!MD5
</VirtualHost>
Windows IIS (PFX Format)
IIS requires PFX format. Import via PowerShell:
# Import PFX to certificate store
$pfxPassword = ConvertTo-SecureString -String "YourStrongPassword" -Force -AsPlainText
Import-PfxCertificate `
-FilePath C:\Certs\certificate.pfx `
-CertStoreLocation Cert:\LocalMachine\My `
-Password $pfxPassword
After import, bind the certificate in IIS Manager:
- Open IIS Manager
- Select your site → Bindings
- Add HTTPS binding on port 443
- Select the imported certificate
Or bind via PowerShell:
# Get certificate thumbprint
$cert = Get-ChildItem -Path Cert:\LocalMachine\My | Where-Object {$_.Subject -like "*example.com*"}
# Bind to IIS site
New-IISSiteBinding -Name "Default Web Site" -BindingInformation "*:443:" -Protocol https -CertificateThumbPrint $cert.Thumbprint -CertStoreLocation "Cert:\LocalMachine\My"
Azure App Service (PFX Format)
Deploy certificates to Azure App Service using Azure CLI:
# Upload PFX certificate
az webapp config ssl upload \
--resource-group MyResourceGroup \
--name MyWebApp \
--certificate-file certificate.pfx \
--certificate-password "YourPassword"
# Bind certificate to custom domain
az webapp config ssl bind \
--resource-group MyResourceGroup \
--name MyWebApp \
--certificate-thumbprint <thumbprint> \
--ssl-type SNI
Or via Azure Portal:
- Navigate to App Service → Certificates
- Upload PFX file with password
- Go to Custom Domains → Add binding
- Select uploaded certificate
AWS Certificate Manager (PEM Format)
Import certificates to ACM for use with ALB, CloudFront, or API Gateway:
# Import certificate (PEM format required)
aws acm import-certificate \
--certificate fileb://certificate.crt \
--certificate-chain fileb://chain.crt \
--private-key fileb://private.key \
--region us-east-1
For CloudFront: Certificates must be imported to us-east-1 region.
Docker/Kubernetes (PEM Format)
Create Kubernetes secrets from PEM files:
# Create TLS secret
kubectl create secret tls my-tls-secret \
--cert=fullchain.pem \
--key=private.key \
-n production
Use in Ingress:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-ingress
spec:
tls:
- hosts:
- example.com
secretName: my-tls-secret
rules:
- host: example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: my-service
port:
number: 80
Common Issues and Solutions
"Invalid Certificate Format" Errors
Symptoms: Server rejects certificate with "invalid format" or "unable to load certificate"
Causes and solutions:
- Wrong format for platform: Verify you're using PEM for Linux or PFX for Windows
- Wrong encoding in .cer file: Check if file is PEM or DER by opening in text editor
- Corrupt file: Re-download or regenerate the certificate
- Incorrect line endings: Convert CRLF to LF for Linux:
dos2unix certificate.crt - Missing BEGIN/END headers: Ensure PEM files have proper
-----BEGIN CERTIFICATE-----headers
Debug command:
# Test PEM certificate
openssl x509 -in certificate.crt -text -noout
# Test DER certificate
openssl x509 -in certificate.der -inform DER -text -noout
# View PFX contents
openssl pkcs12 -info -in certificate.pfx
"Invalid Password" on PFX Files
Symptoms: Cannot open or import PFX file even with correct password
Causes and solutions:
- Password typo: Double-check case-sensitive password (no extra spaces)
- Special characters: Some systems struggle with certain special characters in passwords
- Copy/paste issues: Type password manually instead of copy/paste
- Encoding issues: Try password without UTF-8 characters if international characters were used
- Corrupt file: Re-export the PFX from the source
- Empty password: Some tools require
-password pass:(empty string) instead of omitting the flag
"Certificate Chain Incomplete" Warnings
Symptoms: Browser shows "partial chain" or "missing intermediate certificate"
Causes and solutions:
- Missing intermediate certificates: Obtain intermediate CA certificates from your CA
- Wrong certificate order: Chain should be: leaf → intermediate → root
- Incomplete concatenation: For PEM, concatenate properly:
cat cert.crt intermediate.crt > fullchain.pem - Root certificate included: Some systems reject chains with root CA (remove root, keep only intermediates)
Verify chain:
# Test certificate chain
openssl verify -CAfile chain.crt certificate.crt
# Display all certificates in chain
openssl crl2pkcs7 -nocrl -certfile fullchain.pem | openssl pkcs7 -print_certs -noout
Build proper chain:
# Correct order: server cert first, then intermediate(s)
cat certificate.crt intermediate.crt > fullchain.pem
# Verify order
openssl storeutl -noout -text -certs fullchain.pem
iOS Configuration Profile Rejects PFX
Symptoms: iPhone/iPad refuses to install configuration profile with certificate
Causes and solutions:
- Wrong encryption: iOS requires TripleDES, not AES-256
- Solution - Use legacy encryption flags:
openssl pkcs12 -export -legacy \ -out ios-compatible.pfx \ -inkey private.key \ -in certificate.crt \ -certfile chain.crt - Password too long: Some iOS versions have password length limits (try under 32 characters)
- Complex password: Avoid certain special characters that iOS may misinterpret
- Missing intermediate certificates: Ensure full chain is included in PFX
Verify iOS compatibility:
# Check encryption used in PFX
openssl pkcs12 -info -in certificate.pfx -nokeys -passin pass:YourPassword | grep "Encryption"
Should show pbeWithSHA1And3-KeyTripleDES-CBC for iOS compatibility.
Private Key Doesn't Match Certificate
Symptoms: "key values mismatch" or "certificate and private key do not match"
Causes and solutions:
- Wrong key file: Using key from different certificate
- Key/cert version mismatch: Old key with renewed certificate (or vice versa)
- Solution - Verify key and cert match:
# Get certificate modulus openssl x509 -noout -modulus -in certificate.crt | openssl md5 # Get private key modulus openssl rsa -noout -modulus -in private.key | openssl md5 # Hashes should match - PFX extraction issue: Re-extract private key and certificate from PFX
- Generate new pair: If unresolvable, generate new CSR and private key together
Certificate Expired or Not Yet Valid
Symptoms: "certificate has expired" or "certificate is not yet valid"
Causes and solutions:
- System clock wrong: Verify server time is correct with
datecommand - Time zone issues: Ensure time zone is properly configured
- Actually expired: Check expiration:
openssl x509 -in certificate.crt -noout -dates - Certificate from future: Some CAs issue certificates valid from future date
- NTP not running: Enable NTP to keep system time synchronized
Check certificate dates:
openssl x509 -in certificate.crt -noout -dates
File Permissions Cause Access Denied
Symptoms: Web server fails to read certificate or key files
Causes and solutions:
- Private key too permissive: Should be
600(owner read/write only) - Certificate not readable: Should be
644(owner read/write, others read) - Wrong owner: Files should be owned by web server user (www-data, nginx, etc.)
- SELinux blocking: Check SELinux with
getenforceand adjust contexts if needed
Fix permissions:
# Correct ownership and permissions
sudo chown www-data:www-data /etc/nginx/ssl/private.key
sudo chown www-data:www-data /etc/nginx/ssl/certificate.crt
sudo chmod 600 /etc/nginx/ssl/private.key
sudo chmod 644 /etc/nginx/ssl/certificate.crt
# For SELinux (RHEL/CentOS)
sudo restorecon -R /etc/nginx/ssl/
Conclusion
Understanding SSL/TLS certificate formats—PEM, DER, PFX/PKCS#12, P7B/PKCS#7, CER, and CRT—is essential for anyone managing web security infrastructure. While the variety of formats can be confusing, each serves specific purposes and platforms, with PEM and PFX representing two fundamentally different approaches to certificate management.
PEM's text-based, multi-file approach offers flexibility, transparency, and universal platform support, making it the standard for Linux environments, cloud platforms, and automation scenarios. PFX's binary, single-file archive provides convenience and consistent password protection, ideal for Windows environments and scenarios requiring easy backup and distribution.
Quick Decision Guide:
- Linux/Apache/Nginx: Use PEM format (
.crtand.keyfiles) - Windows/IIS/Exchange: Use PFX/PKCS#12 format (
.pfxfile) - Cloud Platforms (AWS/GCP): Use PEM format
- Azure App Service: Use PFX format
- iOS Configuration Profiles: Use PFX with TripleDES encryption (
-legacyflag) - Java Applications: Use DER format or convert PFX to JKS
- Certificate Chain Distribution: Use PEM (concatenated) or P7B format
- Code Signing: Use PFX format
- Let's Encrypt/Certbot: Generates PEM (convert to PFX if needed for Windows)
Understanding format conversion, security implications, platform-specific deployment requirements, and common troubleshooting techniques ensures you can confidently manage certificates across any platform or scenario.
Need to convert certificate formats or generate a new CSR? Try our Certificate CSR Generator & Format Converter tool—it handles all major formats with 100% client-side processing for maximum security.