ASC
application/octet-stream
Magic Bytes
Offset: 0
2D 2D 2D 2D 2D 42 45 47 49 4E 20 50 47 50 20 50 55 42 4C 49 43 20 4B 45 49 20 42 4C 4F 43 4B 2D 2D 2D 2D 2D
The ASC format is an ASCII-armored OpenPGP public key block, governed by the OpenPGP standard maintained by the Internet Engineering Task Force (IETF). It primarily facilitates the secure exchange of cryptographic keys used for verifying digital signatures and encrypting email communications or software distribution packages. While the plain text format is safe to handle, users should verify key fingerprints through independent, trusted channels to mitigate potential man-in-the-middle attacks during the distribution process.
Validation Code
How to validate .asc files in Python
Python
def is_asc(file_path: str) -> bool:
"""Check if file is a valid ASC by magic bytes."""
signature = bytes([0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x47, 0x50, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x49, 0x20, 0x42, 0x4C, 0x4F, 0x43, 0x4B, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D])
with open(file_path, "rb") as f:
return f.read(36) == signature
How to validate .asc files in Node.js
Node.js
function isASC(buffer: Buffer): boolean {
const signature = Buffer.from([0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x47, 0x50, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x49, 0x20, 0x42, 0x4C, 0x4F, 0x43, 0x4B, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D]);
return buffer.subarray(0, 36).equals(signature);
}
Go
func IsASC(data []byte) bool {
signature := []byte{0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x47, 0x50, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x49, 0x20, 0x42, 0x4C, 0x4F, 0x43, 0x4B, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D}
if len(data) < 36 {
return false
}
return bytes.Equal(data[:36], signature)
}
API Endpoint
GET
/api/v1/asc
curl https://filesignature.org/api/v1/asc