email-archive-formats

PST or OST? Four header fields that tell you, and why some readers refuse OSTs

Outlook writes two kinds of data file in the same container format: a PST is a personal archive or export, an OST is the offline copy Outlook keeps of an Exchange or Microsoft 365 mailbox. Tools that open one often refuse the other, and renaming .ost to .pst changes nothing, because the file says what it is in its first 514 bytes. Notes from writing the reader in Mailward (disclosure: I build it); the fields are from Microsoft’s [MS-PST] specification and the libpff format documentation, and every output below was produced on 4 November 2026 from three public files: enron.pst from the pst-extractor package’s example/testdata/, dist-list.pst from java-libpst’s test resources, and pstextractortest@outlook.com.ost from pst-extractor’s own tests (SHA-256 daacd8d4…5f0, 16,818,176 bytes).

The fields

What Where Values
wMagicClient bytes 8–9 SM in a PST, SO in an OST
wVer — layout bytes 10–11 14 or 15: ANSI (32-bit offsets); 23: Unicode (64-bit offsets); 36: Unicode with 4,096-byte pages; 37: written with Windows Information Protection
wVerClient bytes 12–13 [MS-PST] gives 19 for the format it describes
bCryptMethod — how the data blocks are encoded byte 461 (ANSI) or 513 (Unicode) 0x00 none, 0x01 permute, 0x02 cyclic, 0x10 Windows Information Protection

[MS-PST] itself only allows SM (“MUST be { 0x53, 0x4D }”) and does not list wVer 36; both come from libpff’s documentation, which records SO as the OST value and 36 as the 64-bit 4k-page format first seen in Outlook 2013 OSTs.

The script

Python 3, standard library only:

import os, sys

CRYPT = {0x00: "NDB_CRYPT_NONE", 0x01: "NDB_CRYPT_PERMUTE", 0x02: "NDB_CRYPT_CYCLIC", 0x10: "NDB_CRYPT_EDPCRYPTED"}

path = sys.argv[1]
with open(path, "rb") as f:
    h = f.read(514)
if len(h) < 514 or h[:4] != b"!BDN":
    sys.exit(f"{path}: not a PST/OST (no !BDN signature)")
client = h[8:10]
ver = int.from_bytes(h[10:12], "little")
ver_client = int.from_bytes(h[12:14], "little")
kind = {b"SM": "PST", b"SO": "OST"}.get(client, f"unknown ({client!r})")
if ver in (14, 15):
    layout, crypt = "ANSI, 32-bit offsets, 512-byte pages", h[461]
elif ver == 36:
    layout, crypt = "Unicode, 64-bit offsets, 4,096-byte pages", h[513]
elif ver >= 23:
    layout, crypt = "Unicode, 64-bit offsets, 512-byte pages", h[513]
else:
    sys.exit(f"{path}: wVer {ver} is not a version the format defines")
print(f"{os.path.basename(path)}: {os.path.getsize(path):,} bytes")
print(f"  wMagicClient  {client.decode('latin-1')!r:6} -> {kind}")
print(f"  wVer          {ver:<6} -> {layout}" + (" (37 = written with Windows Information Protection)" if ver == 37 else ""))
print(f"  wVerClient    {ver_client}")
print(f"  bCryptMethod  0x{crypt:02x}   -> {CRYPT.get(crypt, 'not a value the format defines')}")

What it printed

enron.pst: 13,984,768 bytes
  wMagicClient  'SM'   -> PST
  wVer          23     -> Unicode, 64-bit offsets, 512-byte pages
  wVerClient    19
  bCryptMethod  0x01   -> NDB_CRYPT_PERMUTE
dist-list.pst: 271,360 bytes
  wMagicClient  'SM'   -> PST
  wVer          23     -> Unicode, 64-bit offsets, 512-byte pages
  wVerClient    19
  bCryptMethod  0x01   -> NDB_CRYPT_PERMUTE
pstextractortest@outlook.com.ost: 16,818,176 bytes
  wMagicClient  'SO'   -> OST
  wVer          36     -> Unicode, 64-bit offsets, 4,096-byte pages
  wVerClient    12
  bCryptMethod  0x00   -> NDB_CRYPT_NONE

Reading it

Mailward opens OSTs in the browser, the 4,096-byte-page ones included, without Outlook or the Exchange account the OST came from, and the file never leaves your computer.

Sources


Licensed CC BY 4.0.