Question about cnmt.xml

  • Thread starter Thread starter AmeliaFox
  • Start date Start date
  • Views Views 485
  • Replies Replies 7

AmeliaFox

Well-Known Member
Member
Joined
Jan 25, 2026
Messages
184
Reaction score
206
Trophies
0
Age
25
XP
419
Country
United Kingdom
I read the cmtl.xml for the latest Super Mario Bros. Wonder update, the key required to decrypt is 0x10 (17-1). However the system version reads like it needs 14.1.1 firmware, But that firmware requires key 0xD - so how can it decrypt if it needs key 0x10? It's also built with sdk 21.4.1.0

<KeyGeneration>17</KeyGeneration>
<KeyGenerationMin>17</KeyGenerationMin>
<RequiredSystemVersion>1411383346</RequiredSystemVersion>


This RequiredSystemVersion doesn't make sense to me, can someone shed some light? I had a look at switchbrew but couldn't find out that information.

Master Key 0x00. */ fw1
...
Master key 0x12. */ fw19
Master key 0x13. */ fw20
Master key 0x14. */ fw21
Master key 0x15. */ fw22

Then on a dlc I have this:
<KeyGenerationMin>21</KeyGenerationMin>
<RequiredSystemVersion>262194</RequiredSystemVersion>

262194? WTF - is this version.

Never mind, I figured it out:

using System;

class Program
{
static void Main()
{
// Read this value from your <RequiredSystemVersion> tag in the .cnmt.xml
uint sysVer = 738263040; // Example: should give 11.0.1

string versionString = DecodeSwitchSystemVersion(sysVer);

Console.WriteLine($"Required System Version: {sysVer}");
Console.WriteLine($"Firmware version: {versionString}");
}

/// <summary>
/// Converts Nintendo Switch RequiredSystemVersion to X.Y.Z format
/// </summary>
public static string DecodeSwitchSystemVersion(uint version)
{
if (version == 0)
return "0.0.0 (No minimum)";

int major = (int)((version >> 26) & 0x3F);
int minor = (int)((version >> 20) & 0x3F);
int micro = (int)((version >> 16) & 0x0F);

return $"{major}.{minor}.{micro}";
}
}
 
Last edited by AmeliaFox,
What are you asking? You're asking about the system version and then later say that you figured it out.
 
What are you asking? You're asking about the system version and then later say that you figured it out.
I thought I was being clear - I wanted to know how reading this value - <RequiredSystemVersion>1411383346</RequiredSystemVersion>

Converts into the minimum firmware version required - 21.2.0

The c# code I posted above converts 1411383346 into 21.2.0.

Now since you are reading this, if an nsp doesn't have an xml file then we need to read .cnmt.nca file and decrypt it, then look at the header to find some bytes, we can decrypt it like this:

hactool -k keys.dat tmp/somencafilexxx.cnmt.nca --section0dir=cnmt_output

The decrypted output file goes into cnmt_output directory, I thought the RequiredSystemVersion number is also in that decrypted file, but I'm not sure where? Can you enlighten me on that?

The reason I ask is because I am updating this old program I found the source for and I just want to make sure I do it properly.

Untitled.png


I know there's better and newer programs, but that's not the point, I just want to practice my c# coding skills, but first I need to know how we get the Min Firmware (RequiredSystemVersion) from the cnmt.nca file.
 
Last edited by AmeliaFox,
I thought the RequiredSystemVersion number is also in that decrypted file, but I'm not sure where? Can you enlighten me on that?
First you check what type of CNMT you have. Offset 0xC. If it's 0x80 - Application, 0x81 - update, i cannot guarantee what happens in Extended Header for other types.

Now if you have 0x80 or 0x81, version number is stored in 0x28 offset of CNMT (0x8 offset of extended header)

For example 00 00 00 34 -> 0x34000000 -> 13.0.0
 
  • Like
Reactions: AmeliaFox
The one I am testing shows 0x80 and 0xC and the 4 bytes at 0x28 are 00 00 10 30

00 00 10 30 in little-endian = 0x30100000 = 807,403,520 (decimal)

Decoded firmware version from the function I have shows: 12.0.0, however when I check with NxFileViewer it shows this - 12.1.0.0

So I must be doing something differently?
 
Thanks, That website is handy. I'l bookmark that. The website I was using was telling me the wrong values, It was telling me for 0x54200000 the result was 16.0.0 when it should have been 21.2.0. I was looking at offset 0x28 and wondering why It wasn't working....I never knew about Offset 0xC. If it's 0x80 - Application, 0x81 , so I'll keep a note of that. Thanks.

The website I was using was converting hex to decimal wrong, 00 00 10 30 in little-endian = 0x30100000 = should be 806354944 - but the website was converting it to 807403520, so that's why the ouput was wrong.
 
Last edited by AmeliaFox,

Site & Scene News

Popular threads in this forum