DER
application/x-x509-cert;format=der
Magic Bytes
Offset: 0
30 80
Distinguished Encoding Rules (DER) is a binary serialization format maintained by the International Telecommunication Union (ITU-T) for encoding Abstract Syntax Notation One (ASN.1) structures. It provides a canonical encoding for X.509 digital certificates and private keys used within the Transport Layer Security (TLS) protocol. As a strict subset of Basic Encoding Rules (BER), it ensures a unique bitstream for cryptographic signatures, though users require specialized software to parse the binary content.
Validation Code
How to validate .der files in Python
Python
def is_der(file_path: str) -> bool:
"""Check if file is a valid DER by magic bytes."""
signature = bytes([0x30, 0x80])
with open(file_path, "rb") as f:
return f.read(2) == signature
How to validate .der files in Node.js
Node.js
function isDER(buffer: Buffer): boolean {
const signature = Buffer.from([0x30, 0x80]);
return buffer.subarray(0, 2).equals(signature);
}
Go
func IsDER(data []byte) bool {
signature := []byte{0x30, 0x80}
if len(data) < 2 {
return false
}
return bytes.Equal(data[:2], signature)
}
API Endpoint
GET
/api/v1/der
curl https://filesignature.org/api/v1/der