Why convert P7S to PEM?
PEM is the standard text format for certificates and cryptographic objects expected by most web servers, inspection tools, and code processing X.509 certificates. Re-encoding the .p7s to .pem lets you inspect the signer's certificate chain, feed it into server configuration, or use it with tools that require Base64 input without a manual binary-to-text conversion step.
How to convert P7S to PEM
OpenSSL OPEN-SOURCE
Run openssl pkcs7 -inform DER -in file.p7s -out file.pem to re-encode the binary signature as Base64 PEM; add -print_certs to also extract the signer's certificate chain into the output.
About these formats
A P7S file - usually named smime.p7s - is the digital signature attached to a signed email. It proves the sender's identity and that the message was not altered in transit. You normally do…
Open .P7S details →A PEM file is a text container for cryptographic data - most often an SSL/TLS certificate, a private key, or both. Open it in any text editor to see what the BEGIN line says, then use…
Open .PEM details →Quality & what to watch
- If the
.p7sis already Base64-encoded (it opens in a text editor starting with-----BEGIN PKCS7-----), use-inform PEMinstead of-inform DERin the OpenSSL command. - The PEM output contains only the signature and certificate data - it does not recover any email or document content, which is stored separately from a detached
.p7s. - Adding
-print_certsto the OpenSSL command embeds the signer's full certificate chain as-----BEGIN CERTIFICATE-----blocks in the output.
Frequently asked questions
Does converting to PEM validate the signature?
openssl smime -verify with the original signed content to verify the signature.What if the OpenSSL command fails with a parse error?
-inform PEM instead of -inform DER.Does the PEM file contain the email message content?
.p7s is a detached signature; neither the DER original nor the PEM output contains the message body.Can I use the PEM file in a web server configuration?
.p7s contains the signature object and certificate chain - extract individual certificates with openssl x509 for server use.