Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

NDecrypt 3DS: Difference between revisions

From GameBrew
No edit summary
 
(12 intermediate revisions by one other user not shown)
Line 4: Line 4:
|description=Cartridge encrypt/decrypt.
|description=Cartridge encrypt/decrypt.
|author=SabreTools
|author=SabreTools
|lastupdated=2020/12/18
|lastupdated=2024/11/15
|type=PC Utilities
|type=File Operation
|version=0.2.2
|version=0.3.1
|license=Mixed
|license=MIT
|download=https://dlhb.gamebrew.org/3dshomebrews/ndecrypt.7z
|download=https://dlhb.gamebrew.org/3dshomebrews/ndecrypt.7z
|website=https://github.com/SabreTools/NDecrypt
|website=https://github.com/SabreTools/NDecrypt
Line 39: Line 39:


===keys.bin===
===keys.bin===
This is used only for Nintendo 3DS and New 3DS files. You need the 9 16-bit keys in little endian format (most common extraction methods produce big endian, so keep that in mind).  
This is used only for Nintendo 3DS and New 3DS files. Without getting into the codes, you need the 9 16-bit keys in little endian format (most common extraction methods produce big endian, so keep that in mind).  


It's recommended that you fill with 0x00 if you don't have access to a particular value so it doesn't mess up the read. They need to be in the following order:
It's recommended that you fill with 0x00 if you don't have access to a particular value so it doesn't mess up the read. They need to be in the following order:
Line 53: Line 53:
* DevKeyX0x2C
* DevKeyX0x2C


The last 4 are only required if you use the <code>-dev</code> flag. Once again, don't ask for these, please. If you're missing a required key, then things won't work.
The last 4 are only required if you use the <code>-dev</code> flag. Once again, don't ask for these. If you're missing a required key, then things won't work.


===Compatibility rates===
===Compatibility rates===
Line 66: Line 66:


The notable exceptions to this tend to be unlicensed carts which may be dumped incorrectly or have odd information stored in their secure area.
The notable exceptions to this tend to be unlicensed carts which may be dumped incorrectly or have odd information stored in their secure area.
==Changelog==
'''v0.3.1'''
*For users who wanted to start using 0.3.x, please start with this version. The previous version had undiscovered bugs related to many of the cleanup changes that I introduced over the course of a couple months. It was lightly tested and nobody reported issues, so they were not obvious until after 0.3.0 went out.
'''v0.3.0'''
*What's Changed
** Fix opeation typo by [https://github.com/soxhi8 @soxhi8] in [https://github.com/SabreTools/NDecrypt/pull/10 #10]
** add support for .nds.enc extension by [https://github.com/spiritfader @spiritfader] in [https://github.com/SabreTools/NDecrypt/pull/16 #16]
*New Contributors
** [https://github.com/soxhi8 @soxhi8] made their first contribution in [https://github.com/SabreTools/NDecrypt/pull/10 #10]
** [https://github.com/spiritfader @spiritfader] made their first contribution in [https://github.com/SabreTools/NDecrypt/pull/16 #16]
'''v0.2.5'''
* License has been correctly set to MIT instead of the "whatever" mentioned before.
* Build targets for Windows x86, Windows x64, Linux x64, and OSX x64 have been added for packaging.
* .NET Core 3.1 has been removed as a build version.
* AppVeyor has been enabled to allow for easier testing of WIP builds.
'''v0.2.4'''
* .NET 5 support has been dropped.
* .NET 6 support (hashing and encrypt/decrypt) have been fixed.
* Internal structure changed to be more library-oriented.
'''v0.2.3'''
* Add support for outputting file hashes to a companion file.
* Add support for alternate keyfile paths.
* Add support for Citra aes_keys.txt.
* Major internal cleanups and code separation.
* Converted core library to .NET Standard 2.0.
* Added .NET 6.0 as build target for main executable.
'''v0.2.2'''
* Added a couple of fixes for NDS Prince of Persia carts that have mastering oddities.
* Added the .ids iQue DS extension to matching.
* Fixed the matching criteria for some of the NDS signatures.
* Added more improperly decrypted empty secure area NDS signatures.
* Remove forced pause at end of program run.
* Make keys.bin only required for 3DS and New 3DS processing.
* Add some try/catch blocks around processing so it doesn't hard crash (issue with incorrectly-named BIOS files).
'''v0.2.1'''
* Merged two projects into one again, based on the Core version from last time. No changes to supported frameworks due to this.
* Reorganized a bit of the code internally in case other cart types get supported in the future.
* Added a couple of fixes for NDS Dragon Quest V carts that have mastering oddities.
'''v0.2.0'''
* Internal cleanup of most of the code.
* Removed .NET Framework 4.6.1 build.
* Added .NET Framework 4.8, .NET Core 3.1, and .NET 5.0 builds.
* Fixed NDS secure areas.
* Fixed larger game carts.
* Fixed encrypting N3DS carts.
* Add force flags for NDS and N3DS.


==Credits==
==Credits==
Thanks to the developers of the original programs for doing the actual hard work to figure things out.  
* Thanks to the developers of the original programs for doing the actual hard work to figure things out.  
 
* Also thanks to everyone who helped to test this against the original programs and made code suggestions.
Also thanks to everyone who helped to test this against the original programs and made code suggestions.


Disclaimer: This program is only for use with personally dumped files and keys and is not meant for enabling illegal activity.  
Disclaimer: This program is only for use with personally dumped files and keys and is not meant for enabling illegal activity.


==External links==
==External links==
* GitHub - https://github.com/SabreTools/NDecrypt
* GitHub - https://github.com/SabreTools/NDecrypt
[[Category:3DS homebrew applications]]
[[Category:PC utilities for 3DS homebrew]]

Latest revision as of 00:46, 17 November 2024

NDecrypt
Ndecrypt2.png
General
AuthorSabreTools
TypeFile Operation
Version0.3.1
LicenseMIT License
Last Updated2024/11/15
Links
Download
Website
Source

NDecrypt is a tool that allows you to encrypt and decrypt your personally dumped NDS and N3DS roms with minimal hassle. The only caveat right now is that you need a keys.bin file for your personally obtained encryption keys.

This is a code port of 3 different programs: 3ds_encrypt.py, 3ds_decrypt.py and woodsec (part of wooddumper).

User guide

How to use

NDecrypt.exe <operation> [flags] <path> ...

Possible values for <operation>:
e, encrypt - Encrypt the input files
d, decrypt - Decrypt the input files

Possible values for [flags] (one or more can be used):
-c, --citra           - Enable using aes_keys.txt instead of keys.bin
-dev, --development   - Enable using development keys, if available
-f, --force           - Force operation by avoiding sanity checks
-h, --hash            - Output size and hashes to a companion file
-k, --keyfile <path>  - Path to keys.bin or aes_keys.txt

<path> can be any file or folder that contains uncompressed items.
More than one path can be specified at a time.

Mixed folders or inputs are also accepted, you can decrypt or encrypt multiple files, regardless of their type.

Note: This overwrites the input files, so make backups if you're working on your original, personal dumps.

keys.bin

This is used only for Nintendo 3DS and New 3DS files. Without getting into the codes, you need the 9 16-bit keys in little endian format (most common extraction methods produce big endian, so keep that in mind).

It's recommended that you fill with 0x00 if you don't have access to a particular value so it doesn't mess up the read. They need to be in the following order:

  • Hardware constant
  • KeyX0x18
  • KeyX0x1B
  • KeyX0x25
  • KeyX0x2C
  • DevKeyX0x18
  • DevKeyX0x1B
  • DevKeyX0x25
  • DevKeyX0x2C

The last 4 are only required if you use the -dev flag. Once again, don't ask for these. If you're missing a required key, then things won't work.

Compatibility rates

Here's a list of the supported sets and their current compatibility percentages with woodsec and the Python scripts (as of 2020-12-19):

  • Nintendo DS - >99% compatible (Both encryption and decryption).
  • Nintendo DSi - 100% compatible (Both encryption and decryption).
  • Nintendo 3DS - 100% compatible (Both encryption and decryption).
  • Nintendo New 3DS - 100% compatible (Both encryption and decryption).

Please note the above numbers are based on the current, documented values.

The notable exceptions to this tend to be unlicensed carts which may be dumped incorrectly or have odd information stored in their secure area.

Changelog

v0.3.1

  • For users who wanted to start using 0.3.x, please start with this version. The previous version had undiscovered bugs related to many of the cleanup changes that I introduced over the course of a couple months. It was lightly tested and nobody reported issues, so they were not obvious until after 0.3.0 went out.

v0.3.0

v0.2.5

  • License has been correctly set to MIT instead of the "whatever" mentioned before.
  • Build targets for Windows x86, Windows x64, Linux x64, and OSX x64 have been added for packaging.
  • .NET Core 3.1 has been removed as a build version.
  • AppVeyor has been enabled to allow for easier testing of WIP builds.

v0.2.4

  • .NET 5 support has been dropped.
  • .NET 6 support (hashing and encrypt/decrypt) have been fixed.
  • Internal structure changed to be more library-oriented.

v0.2.3

  • Add support for outputting file hashes to a companion file.
  • Add support for alternate keyfile paths.
  • Add support for Citra aes_keys.txt.
  • Major internal cleanups and code separation.
  • Converted core library to .NET Standard 2.0.
  • Added .NET 6.0 as build target for main executable.

v0.2.2

  • Added a couple of fixes for NDS Prince of Persia carts that have mastering oddities.
  • Added the .ids iQue DS extension to matching.
  • Fixed the matching criteria for some of the NDS signatures.
  • Added more improperly decrypted empty secure area NDS signatures.
  • Remove forced pause at end of program run.
  • Make keys.bin only required for 3DS and New 3DS processing.
  • Add some try/catch blocks around processing so it doesn't hard crash (issue with incorrectly-named BIOS files).

v0.2.1

  • Merged two projects into one again, based on the Core version from last time. No changes to supported frameworks due to this.
  • Reorganized a bit of the code internally in case other cart types get supported in the future.
  • Added a couple of fixes for NDS Dragon Quest V carts that have mastering oddities.

v0.2.0

  • Internal cleanup of most of the code.
  • Removed .NET Framework 4.6.1 build.
  • Added .NET Framework 4.8, .NET Core 3.1, and .NET 5.0 builds.
  • Fixed NDS secure areas.
  • Fixed larger game carts.
  • Fixed encrypting N3DS carts.
  • Add force flags for NDS and N3DS.

Credits

  • Thanks to the developers of the original programs for doing the actual hard work to figure things out.
  • Also thanks to everyone who helped to test this against the original programs and made code suggestions.

Disclaimer: This program is only for use with personally dumped files and keys and is not meant for enabling illegal activity.

External links

Advertising: