From 00081c6542e4f876a60703c5a2649d2516d1e468 Mon Sep 17 00:00:00 2001 From: jakcron Date: Tue, 7 Aug 2018 11:47:44 +0800 Subject: [PATCH] Update readmes. --- LICENSE | 2 +- README.md | 25 ++++---------- KEYS.md => SWITCH_KEYS.md | 22 +++++++++--- programs/nstool/README.md | 73 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 24 deletions(-) rename KEYS.md => SWITCH_KEYS.md (75%) create mode 100644 programs/nstool/README.md diff --git a/LICENSE b/LICENSE index cec2ef2..24d91e4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -NXTools +NNTools Copyright (c) 2017-2018 Jack Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/README.md b/README.md index 377b1a2..7d6abae 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,22 @@ -# NXTools +# NNTools -Tools & Libraries for NX (Nintendo Switch). +Tools & Libraries for Nintendo devices. [![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE) # Tools - -* __nstool__ - read *.npdm, read/extract PartitionFS (PFS0|HFS0) blobs (including *.nsp), read/extract RomFS blobs, read/extract *.xci, read/extract *.nca, read *.cnmt, read *.nso, read *.nro, read *.nacp +* [__nstool__](/programs/nstool/README.md) - General purpose reading/extraction tool for Nintendo Switch file formats. # Libraries - * __libfnd__ - Foundation library. * __libcrypto__ - Cryptographic functions (AES,SHA,RSA). Wrapper for [mbedTLS](https://github.com/ARMmbed/mbedtls) * __libcompress__ - Compression algorithms (LZ4). Wrapper for [lz4](https://github.com/lz4/lz4) * __libpki__ - Processes Nintendo's proprietary PKI. * __libes__ - Processes Nintendo's eShop file types. -* __libnx__ - Processes NX file types. -* __libnx-hb__ - Processes NX file types (homebrew extensions). +* __libhac__ - Processes Nintendo Switch file types. +* __libhac-hb__ - Processes Nintendo Switch file types (homebrew extensions). # Building - On MacOS/Linux/WSL run `make`. -For Windows, Visual Studio 2017 is supported. - -# External Keys - -Programs/libraries don't embed any keys that are copyright protected. However keys can be imported via a keyset file. - -For programs that support it, the keyset file can be provided via the command line (see program usage for details). Alternatively a keyset file located in ___$HOME/.switch/prod.keys___ (or ___$HOME/.switch/dev.keys___ for dev) will be imported automatically if one is not provided at the command line. - -Keyset files are ASCII text files containing one key per line, in the form "__key_name = HEXADECIMALKEY__". Case and whitespace do not matter, ';' character can be used to insert comments. - -See [KEYS.md](/KEYS.md) for more details. \ No newline at end of file +For Windows, Visual Studio 2017 is supported. \ No newline at end of file diff --git a/KEYS.md b/SWITCH_KEYS.md similarity index 75% rename from KEYS.md rename to SWITCH_KEYS.md index 0a3098b..038dd1e 100644 --- a/KEYS.md +++ b/SWITCH_KEYS.md @@ -1,5 +1,19 @@ -# Format -Programs in NXTools currently recognise the following keys (## represents a hexadecimal number between 00 and 1F): + +# About +Keyset files are ASCII text files containing one key per line, in the form "__key_name = HEXADECIMALKEY__". Case and whitespace do not matter, ';' character can be used to insert comments. + +# Loading keyset files automatically +If a keyset file is located in ___$HOME/.switch/___ it will be loaded automatically. + +# General Keys (prod.keys and dev.keys) +Some switch files formats feature encryption and or cryptographic signatures. In order to process these file formats, some keys are required. These keys can be supplied via a keyfile: ___prod.keys___ (or ___dev.keys___ for devkit variants). + +This keyset file can be provided via the command line (refer to usage for details). + + + +## Format +The following keys are recognised (## represents a hexadecimal number between 00 and 1F): ``` ; Key Sources @@ -47,8 +61,8 @@ acid_sign_key_modulus : RSA2048 Modulus (0x100 bytes) acid_sign_key_private : RSA2048 Private Exponent (0x100 bytes) ``` -# Compatibility with hactool keyset files -NXTools keyset files share the same keyset file format as [hactool](https://github.com/SciresM/hactool/blob/master/KEYS.md), but names of keys may differ. For compatibility, hactool names for equivalent keys are accepted. +## Compatibility with hactool keyset files +`prod.keys` (and `dev.keys`) keyset files share the same keyset file format as [hactool](https://github.com/SciresM/hactool/blob/master/KEYS.md), but names of keys may differ. For compatibility, hactool names for equivalent keys are accepted. ``` titlekek_source : hactool alias for ticket_commonkey_source header_key_source : hactool alias for nca_header_key_source diff --git a/programs/nstool/README.md b/programs/nstool/README.md new file mode 100644 index 0000000..9fb5dab --- /dev/null +++ b/programs/nstool/README.md @@ -0,0 +1,73 @@ +# Nintendo Switch Tool (NSTool) ![DeviceTag](https://img.shields.io/badge/Device-SWITCH-e60012.svg) +General purpose reading/extration tool for Nintendo Switch file formats. + +## Supported File Formats +* NPDM (.npdm) +* PartitionFS (and HashedPartitionFS) (includes raw .nsp) +* RomFS +* GameCard Image (.xci) +* Nintendo Content Archive (.nca) +* Content Metadata (.cnmt) +* Nintendo Software Object (.nso) +* Nintendo Relocatable Software Object (.nro) +* Nintendo Application Control Property (.nacp) +* ES Ticket (v2 only) (.tik) +* PKI Certificate (.cert) + +# Usage +``` +Usage: nstool [options... ] + + General Options: + -d, --dev Use devkit keyset. + -k, --keyset Specify keyset file. + -t, --type Specify input file type. [xci, pfs, romfs, nca, npdm, cnmt, nso, nro, nacp, aset, cert, tik] + -y, --verify Verify file. + + Output Options: + --showkeys Show keys generated. + --showlayout Show layout metadata. + -v, --verbose Verbose output. + + XCI (GameCard Image) + nstool [--listfs] [--update --logo --normal --secure ] <.xci file> + --listfs Print file system in embedded partitions. + --update Extract "update" partition to directory. + --logo Extract "logo" partition to directory. + --normal Extract "normal" partition to directory. + --secure Extract "secure" partition to directory. + + PFS0/HFS0 (PartitionFs), RomFs, NSP (Ninendo Submission Package) + nstool [--listfs] [--fsdir ] + --listfs Print file system. + --fsdir Extract file system to directory. + + NCA (Nintendo Content Archive) + nstool [--listfs] [--bodykey --titlekey ] [--part0 ...] <.nca file> + --listfs Print file system in embedded partitions. + --titlekey Specify title key extracted from ticket. + --bodykey Specify body encryption key. + --tik Specify ticket to source title key. + --part0 Extract "partition 0" to directory. + --part1 Extract "partition 1" to directory. + --part2 Extract "partition 2" to directory. + --part3 Extract "partition 3" to directory. + + NSO (Nintendo Software Object), NRO (Nintendo Relocatable Object) + nstool [--listapi --listsym] [--insttype ] + --listapi Print SDK API List. + --listsym Print Code Symbols. + --insttype Specify instruction type [64bit|32bit] (64bit is assumed). + + ASET (Homebrew Asset Blob) + nstool [--listfs] [--icon --nacp --fsdir ] + --listfs Print filesystem in embedded RomFS partition. + --icon Extract icon partition to file. + --nacp Extract NACP partition to file. + --fsdir Extract RomFS partition to directory. +``` + +# External Keys +NSTool doesn't embed any keys that are copyright protected. However keys can be imported via various keyset files. + +See [SWITCH_KEYS.md](/SWITCH_KEYS.md) for more info. \ No newline at end of file