Format:NSKeyedArchiver archive
| Platforms | Platform:MacOS, Platform:IOS |
|---|---|
| Magic | bplist00 container; dictionary keys $archiver, $version, $objects, $top |
| Extensions | .archive, .nib (macOS/old iOS), .plist, .dat, NSUserDefaults/blob columns |
| Endianness | big-endian (bplist00) |
| On this wiki | Facts · Code · Notes · Topics |
Apple's keyed object-graph serialization: a property list (usually binary bplist00) with $archiver = NSKeyedArchiver, $version = 100000, a flat $objects array and a $top dictionary, where objects reference each other by UID values.
Structure
The file is a Format:Property list (binary bplist00) whose root dictionary has:
- $archiver: the string "NSKeyedArchiver" (anything else, for example a legacy NSArchiver typedstream, is a different format).
- $version: integer 100000 (NSKeyedArchiveVersion).
- $top: dictionary of named entry points; the root object of a plain archiveRootObject / archivedDataWithRootObject is $top["root"] (some archives use other keys such as NSKeyedArchiveRootObjectKey).
- $objects: array of all objects. Index 0 is the string "$null". References are plist UID objects (marker 0x8n in the bplist object table) holding an index into $objects.
A non-primitive object is a dictionary with a "$class" UID, pointing at a class dictionary {$classname: "NSDictionary", $classes: ["NSDictionary", "NSObject"]}. Strings, numbers and data are stored directly in $objects; their values, if inline in a parent, are plain plist scalars.
Foundation collections
NSArray / NSMutableArray / NSSet: key NS.objects = array of UIDs. NSDictionary: NS.keys and NS.objects, two parallel UID arrays. NSDate: NS.time, seconds since 2001-01-01 (add 978307200 for Unix time; read in bpylist2). Unverified: NSData uses NS.data, NSString NS.string, NSURL NS.base and NS.relative. Custom classes store their fields under the names passed to encodeObject:forKey:, so the key names are strings in the Mach-O (usually __TEXT,__cstring) next to the class's initWithCoder:/encodeWithCoder: code.
Reading and security notes
Decode lazily from a UID; detect cycles (the format allows them via references). Never feed an untrusted archive to a real NSKeyedUnarchiver without requiresSecureCoding: class names in $classname select the instantiated class. Unverified: details of NSSecureCoding behaviour per OS version.
Tools
bpylist2 (MIT, Python; unarchive/archive, checks $archiver, $version, $top.root) was read for this page; Python plistlib also reads the container and keeps UIDs as plistlib.UID. On macOS: plutil -p. Compiled nibs of macOS are archives of this kind; iOS 6+ nibs use Format:NIBArchive.
See also Format:Assets.car (compiled asset catalog) (its CARGLOBALS block is a plain plist).
Code & repositories
- https://github.com/parabolala/bpylist2 @
73e2a76e00f73c42a5c0d0770b54ceffdda9306b· license: MIT (declared by the contributor; GitHub's detector did not recognize a license file)
Python NSKeyedArchiver reader/writer (MIT per pyproject.toml); archiver.py shows $archiver/$version/$top/$objects handling.
Tested on: source read, not run: not run; archiver.py read · checked 2026-10-18; last activity 2025-05-19