Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Switch > NPDM Files

The main.npdm file defines the permissions for a title, such as which system calls and IPC services it is allowed to use. It is stored in the exefs of the title.

NPDM files are encoded in little-endian byte order.

File Format

OffsetSizeDescription
0x04Magic number (META)
0x44Signature flags
0x84Always 0
0xC1Address space flags
0xD1Security flags
0xE1Main thread priority
0xF1Main thread core number
0x104Unknown
0x144System resource size
0x184Version
0x1C4Main thread stack size
0x2016Application name
0x3016Product code (always empty?)
0x4048Padding
0x704Offset to ACI0 section (absolute)
0x744Size of ACI0 section
0x784Offset to ACID section (absolute)
0x7C4Size of ACID section
0x80ACID section
ACI0 section

Signature Flags

FlagDescription
1Use alternative public key

When the alternative public key flag is set, a different public key is used to verify the RSA signature in the ACID section. This flag does not seem to be used in games.

Address Space Flags

MaskDescription
0x01Is 64 bit
0x0EAddress space type
0x10OptimizeMemoryAllocation
0x20DisableDeviceAddressSpaceMerge
0x40EnableAddressSanitizer
0x80Must be 0

Address Space Type

ValueDescription
0AddressSpace32Bit
1AddressSpace64Bit36
2AddressSpace32BitNoReserved
3AddressSpace64Bit39
4AddressSpace64Bit42

ACID Section

The ACID section starts with an RSA signature that is calculated over the remaining part of the ACID section (over the NCA public key and ACID payload). The public key that is used to validate the signature is described below. The signature algorithm is standard RSASSA-PSS with SHA256.

The ACID section defines the maximum permissions that may be requested by the ACI0 section.

Nintendo Switch:

OffsetSizeDescription
0x0256RSA signature over remaining part of ACID section
0x100256NCA public key
0x200ACID payload

Nintendo Switch 2:

OffsetSizeDescription
0x0384RSA signature over remaining part of ACID section
0x180384NCA public key
0x300ACID payload

ACID Payload

The offsets here are relative to the start of the ACID section.

OffsetSizeDescription
0x04Magic number (ACID)
0x44Total size of ACID section, including NCA public key but excluding RSA signature
0x84Always 0
0xC4Flags
0x108Minimum title id
0x188Maximum title id
0x204Offset to file access control limits
0x244Size of file access control limits
0x284Offset to service access control limits
0x2C4Size of service access control limits
0x304Offset to kernel capability limits
0x344Size of kernel capabilitty limits
0x388Always 0
0x40File access control limits
Service accesss control limits
Kernel capability limits

ACID Flags

MaskDescription
0x01Is production
0x02UnqualifiedApproval
0x3FMemory region
0x40Unknown
0x80LoadBrowserCoreDll

Memory Region

ValueDescription
0Application
1Applet
2SecureSystem
3NonSecureSystem

ACID Signature Keys

This section describes the public keys that are used to verify the RSA signature in the ACID section. The public exponent is always 65537. The public modulus depends on the signature key revision that is specified in the header, and whether the hardware is a development or production unit.

Production unit, standard key:

27997716596311541054315493530229540803505084731323289243013132616045273369204979312211842998785955093203642059372921527880191651695936461591719352645690869117826992797976340551708660832480102892592969563432180807173240490853739571897126628512565666877754127130023316366790781882931483296497257762639972134330053161888461055239242400438683135131231961598648922750627358068491266046679946591608055821848346257813744678527534516494532765431671669636848256131421225091796654655528106219358050699832607089542146847809895402945211973474212057977624801451696506640815762543577831097231381510003892546332593417075037872399101

Production unit, alternative key:

29244951347492957548716520011745572453259893268825204698245515963623102396947022752845081010438742714558376702167125579272860040720361779531287335336053587055367687644218533724424333517655598330814738421911495311853375338447930859847119376614829441486819820275862764726829681141461622163253253883091014864460735900835180315947002629401281228024683244517882388041664972065074267396589021062720577691777553507503160683047100360962389741341844600150431287628683863404612731059592456358708511465323179603995138219647750363460097532365037819227526390603887652696823972274959181993527602554045727617068761710519851231955203

Development unit, standard key:

27040958154750948586911961271681771310305446650335602917489851512067658899176520268361986720704370970874673107950888378219339796280610913401914597664670705892844052067365292933141422607936863528846762485637105996325019265988529401236477356358585829094893904836261483917584986843393621171971559475745166845940193464274907095508035505843308532549159193971869950308732327152958605109273824569884440349831826726529554603852364406505323385110545748840535021591394665604594181729393294606915762139617049724104742966403692733616975360161919330055497457866406557391689189631268077424517252735578306916879134820852671147444329

Development unit, alternative key:

23814371002902656965440080134421761115206477806703422383473416260825878340642860401068897582575058601946371951546405630764981623594327434003580957693798714699565491287764864124080852856000126359450182158238309131003312031024266851295611566174311510465342603415510978858118055736761976136244244250361129237774157136359031255821304074117244385565433127930836150809025587201021666801824662293626591400668945102195159436225710623079833889274071908300366088224423055931387311897402335017003578919067348341029865373492485811022003941421914190773365561921813580731430842481384882235255522669642476762454277543128009969906283

ACI0 Section

This section defines the actual permissions that are requested for the title. There is no RSA signature in this section, but the requested permissions must be a subset of the permissions that are defined in the ACID section.

The offsets in this section are relative to the start of the ACI0 section.

The ACI0 section is aligned to 16 bytes.

OffsetSizeDescription
0x04Magic number (ACI0)
0x412Always 0
0x108Title id
0x188Always 0
0x204Offset to file access controls
0x244Size of file access controls
0x284Offset to service access controls
0x2C4Size of service access controls
0x304Offset to kernel capabilities
0x344Size of kernel capabilitiies
0x388Always 0
0x40File access controls
Service accesss controls
Kernel capabilities

File Access Control Limits

This section is part of the ACID section and describes the maximum filesystem permissions that may be requested by the ACI0 section. It is aligned to 16 bytes.

OffsetSizeDescription
0x01Version number (always 1)
0x11Number of content owner ids (X)
0x21Number of save data owner ids (Y)
0x31Padding
0x48Filesystem permissions
0xC8Minimum content owner id
0x148Maximum content owner id
0x1C8Minimum save data owner id
0x248Maximum save data owner id
0x2C8 * XContent owner ids
8 * YSave data owner ids

File Access Controls

The section is part of the ACI0 section and describes the actual filesystem permissions that are requested by the application. It is aligned to 16 bytes.

OffsetSizeDescription
0x01Version number (always 1)
0x13Padding
0x48Filesystem permissions
0xC4Offset to content owner info
0x104Size of content owner info
0x144Offset to save data owner info
0x184Size of save data owner info
0x1C4Content owner info
Save data owner info

Content Owner Info

OffsetSizeDescription
0x04Number of content owner ids (N)
0x48 * NContent owner ids

Save Data Owner Info

OffsetSizeDescription
0x04Number of save data owner ids (N)
0x4NPermissions flags per save data owner id (1 = Read, 2 = Write)
8 * NSave data owner ids

Filesystem Permissions

BitDescription
0ApplicationInfo
1BootModeControl
2Calibration
3SystemSaveData
4GameCard
5SaveDataBackUp
6SaveDataManagement
7BisAllRaw
8GameCardRaw
9GameCardPrivate
10SetTime
11ContentManager
12ImageManager
13CreateSaveData
14SystemSaveDataManagement
15BisFileSystem
16SystemUpdate
17SaveDataMeta
18DeviceSaveData
19SettingsControl
20SystemData
21SdCard
22Host
23FillBis
24CorruptSaveData
25SaveDataForDebug
26FormatSdCard
27GetRightsId
28RegisterExternalKey
29RegisterUpdatePartition
30SaveDataTransfer
31DeviceDetection
32AccessFailureResolution
33SaveDataTransferVersion2
34RegisterProgramIndexMapInfo
35CreateOwnSaveData
36MoveCacheStorage
37DeviceTreeBlob
38NotifyErrorContextServiceReady
39CalibrationSystemData
40CalibrationLog
41StorageSecure
42StorageControl
43GameCardReport
44MarkBeforeEraseBis
45HtmlViewer
46ApplicationSaveDataBackUp
47StreamPlaySaveData
48TemporaryDirectory
62Debug
63FullPermission

Service Access Controls

This section describes IPC service permissions. It is aligned to 16 bytes.

The section contains one entry for every IPC service that the program is allowed to host (is_server) or access. Every entry has the following structure:

OffsetSizeDescription
0x01(len(name) - 1) | (is_server << 7)
0x1Name

Kernel Capabilities

This section describes system call permissions. It is aligned to 16 bytes.

The section contains an array of 32-bit words. In each word, the number of least significant bits that are set define the kernel capability type. The remaining bits contain values that depend on the kernel capability type. This means that, the higher the kernel capability type, the less bits are available to store parameters.

Some types of kernel capabilities, such as the enabled system calls, may have multiple entries in the array.

TypeDescription
3Thread info
4Enabled system calls
6Memory map
7I/O memory map
10Memory region map
11Enabled interrupts
13Miscellaneous values
14Kernel version
15Handle table size
16Miscellaneous flags

Thread Info

BitsDescription
4 - 9Minimum thread priority
10 - 15Maximum thread priority
16 - 23Minimum core number
24 - 31Maximum core number

Enabled System Calls

This type of entry can occur multiple times. Each entry describes which system calls are permitted for the application, for a specific range of system calls.

Every bit in the mask represents one system call. The least significant bit represents the lowest system call id in the group. The most significant bit represents the highest system call id in the group. If a bit is set, the system call may be used by the application.

The group id defines the range of system call ids that are specified by the entry. If the group id has value n, this entry affects system call id n * 24 up to n * 24 + 23.

BitsDescription
5 - 28Enabled system call mask
29 - 31Group id

References