P7S (.p7s)
.p7s file signature | application/pkcs7-signature
P7S is a PKCS #7 digital signature file format defined by RSA Laboratories and standardized by the IETF for cryptographic message handling. It is used to verify document authenticity and integrity in email systems, signed software packages, and other applications that support S/MIME or related signature workflows. The format is not obsolete, but users should still verify signatures from trusted sources because a valid signature does not guarantee that the signed content is safe.
Magic Bytes
Offset 0
2D 2D 2D 2D 2D 42 45 47 49 4E 20 50 4B 43 53 37
Sources: Apache Tika
Extension
.p7s
MIME Type
application/pkcs7-signature
Byte Offset
0
Risk Level
Safe
Validation Code
How to validate .p7s files in Python
def is_p7s(file_path: str) -> bool:
"""Check if file is a valid P7S by magic bytes."""
signature = bytes([0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x4B, 0x43, 0x53, 0x37])
with open(file_path, "rb") as f:
return f.read(16) == signature
How to validate .p7s files in Node.js
function isP7S(buffer: Buffer): boolean {
const signature = Buffer.from([0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x4B, 0x43, 0x53, 0x37]);
return buffer.subarray(0, 16).equals(signature);
}
How to validate .p7s files in Go
func IsP7S(data []byte) bool {
signature := []byte{0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x4B, 0x43, 0x53, 0x37}
if len(data) < 16 {
return false
}
return bytes.Equal(data[:16], signature)
}
API Endpoint
/api/v1/p7s
curl https://filesignature.org/api/v1/p7s
See the full API documentation for all endpoints and parameters.
Related Formats
Frequently Asked Questions
What is a .p7s file?
A .p7s file is identified by the magic bytes 2D 2D 2D 2D 2D 42 45 47 49 4E 20 50 4B 43 53 37 at byte offset 0. P7S is a PKCS #7 digital signature file format defined by RSA Laboratories and standardized by the IETF for cryptographic message handling. It is used to verify document authenticity and integrity in email systems, signed software packages, and other applications that support S/MIME or related signature workflows. The format is not obsolete, but users should still verify signatures from trusted sources because a valid signature does not guarantee that the signed content is safe.
What are the magic bytes for .p7s files?
The magic bytes for P7S files are 2D 2D 2D 2D 2D 42 45 47 49 4E 20 50 4B 43 53 37 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .p7s file?
To validate a .p7s file, read the first bytes of the file and compare them against the known magic bytes (2D 2D 2D 2D 2D 42 45 47 49 4E 20 50 4B 43 53 37) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .p7s files?
The primary MIME type for .p7s files is application/pkcs7-signature.
Is it safe to open .p7s files?
P7S (.p7s) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.