mirror of
https://github.com/SabreTools/NDecrypt.git
synced 2026-09-22 06:45:07 +00:00
keys.bin is only needed for 3DS, better docs
This commit is contained in:
@@ -51,14 +51,18 @@ namespace NDecrypt.N3DS
|
||||
/// <summary>
|
||||
/// Represents if all of the keys have been initialized properly
|
||||
/// </summary>
|
||||
public static bool IsReady { get; private set; }
|
||||
public static bool? IsReady { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Setup all of the necessary constants
|
||||
/// </summary>
|
||||
/// <remarks>keys.bin should be in little endian format</remarks>
|
||||
static Constants()
|
||||
public static void Init()
|
||||
{
|
||||
// If we're already attempted to set the constants, don't try to again
|
||||
if (IsReady != null)
|
||||
return;
|
||||
|
||||
string keyfile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "keys.bin");
|
||||
if (!File.Exists(keyfile))
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using NDecrypt.N3DS;
|
||||
|
||||
namespace NDecrypt
|
||||
{
|
||||
@@ -43,14 +42,6 @@ namespace NDecrypt
|
||||
break;
|
||||
}
|
||||
|
||||
// Ensure the constants are all set
|
||||
new Constants();
|
||||
if (!Constants.IsReady)
|
||||
{
|
||||
Console.WriteLine("Could not read keys from keys.bin. Please make sure the file exists and try again");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = start; i < args.Length; i++)
|
||||
{
|
||||
if (File.Exists(args[i]))
|
||||
@@ -68,6 +59,10 @@ namespace NDecrypt
|
||||
Console.WriteLine("Processing failed!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"{args[i]} is not a file or folder. Please check your spelling and formatting and try again.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +75,18 @@ namespace NDecrypt
|
||||
if (!string.IsNullOrWhiteSpace(err))
|
||||
Console.WriteLine($"Error: {err}");
|
||||
|
||||
Console.WriteLine("Usage: NDecrypt.exe (decrypt|encrypt) [-dev] [-f] <file|dir> ...");
|
||||
Console.WriteLine(@"Usage: NDecrypt.exe <opeation> [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):
|
||||
-dev, --development - Enable using development keys, if available
|
||||
-f, --force - Force operation by avoiding sanity checks
|
||||
|
||||
<path> can be any file or folder that contains uncompressed items.
|
||||
More than one path can be specified at a time.");
|
||||
}
|
||||
|
||||
private enum RomType
|
||||
|
||||
@@ -44,6 +44,14 @@ namespace NDecrypt
|
||||
/// </summary>
|
||||
public bool ProcessFile()
|
||||
{
|
||||
// Ensure the constants are all set
|
||||
Constants.Init();
|
||||
if (Constants.IsReady != true)
|
||||
{
|
||||
Console.WriteLine("Could not read keys from keys.bin. Please make sure the file exists and try again.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure we have a file to process first
|
||||
Console.WriteLine(filename);
|
||||
if (!File.Exists(filename))
|
||||
|
||||
19
README.md
19
README.md
@@ -16,20 +16,27 @@ This tool allows you to encrypt and decrypt your personally dumped NDS and N3DS
|
||||
|
||||
## So how do I use this?
|
||||
|
||||
NDecrypt.exe <flag> [-dev] <file|dir> ...
|
||||
NDecrypt.exe <operation> [flags] <path> ...
|
||||
|
||||
Possible values for <flag>:
|
||||
encrypt, e - Encrypt the incoming files
|
||||
decrypt, d - Decrypt the incoming files
|
||||
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):
|
||||
-dev, --development - Enable using development keys, if available
|
||||
-f, --force - Force operation by avoiding sanity checks
|
||||
|
||||
<path> can be any file or folder that contains uncompressed items.
|
||||
More than one path can be specified at a time.
|
||||
|
||||
|
||||
**Note:** This overwrites the incoming files, so make backups if you're working on your original, personal dumps.
|
||||
**Note:** This overwrites the input files, so make backups if you're working on your original, personal dumps.
|
||||
|
||||
**Note:** Mixed folders or inputs are also accepted, you can decrypt or encrypt multiple files, regardless of their type. This being said, you can only do encrypt OR decrypt at one time.
|
||||
|
||||
## I feel like something is missing...
|
||||
|
||||
You are! In fact, you may be asking, "Hey, what was that `keys.bin` you mentioned??". I'm glad you asked. It's used only for N3DS files but is required for running the program in general. If you only plan on using NDecrypt with Nintendo DS and DSi files, you can have a completely empty `keys.bin` in the folder. Since some people don't like reading code, 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:
|
||||
You are! In fact, you may be asking, "Hey, what was that `keys.bin` you mentioned??". I'm glad you asked. It's used only for Nintendo 3DS and New 3DS files. Since some people don't like reading code, 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
|
||||
- KeyX0x10
|
||||
|
||||
Reference in New Issue
Block a user