Skip to content

ASC (.asc)

.asc file signature | application/pgp-keys

ASC is an ASCII-armored public key file format used in OpenPGP systems, originally introduced by Phil Zimmermann’s Pretty Good Privacy (PGP) and now maintained through the OpenPGP standards family. It is used to distribute, import, and verify public encryption keys in email encryption, software signing, and key-management workflows. The format is generally safe to open because it contains text-based key material, though users should still verify key fingerprints and trust sources before importing keys.

Safe

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

Sources: Wikipedia

Extension

.asc

MIME Type

application/pgp-keys

Byte Offset

0

Risk Level

Safe

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);
}

How to validate .asc files in Go

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

See the full API documentation for all endpoints and parameters.

Related Formats

Frequently Asked Questions

What is a .asc file?

A .asc file is identified by the magic bytes 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 at byte offset 0. ASC is an ASCII-armored public key file format used in OpenPGP systems, originally introduced by Phil Zimmermann’s Pretty Good Privacy (PGP) and now maintained through the OpenPGP standards family. It is used to distribute, import, and verify public encryption keys in email encryption, software signing, and key-management workflows. The format is generally safe to open because it contains text-based key material, though users should still verify key fingerprints and trust sources before importing keys.

What are the magic bytes for .asc files?

The magic bytes for ASC files are 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 at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .asc file?

To validate a .asc 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 47 50 20 50 55 42 4C 49 43 20 4B 45 49 20 42 4C 4F 43 4B 2D 2D 2D 2D 2D) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .asc files?

The primary MIME type for .asc files is application/pgp-keys.

Is it safe to open .asc files?

ASC (.asc) 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.