jakcron / nstool

General purpose read/extract tool for Nintendo Switch file formats.
MIT License
443 stars 43 forks source link

[BUG] NCA Key Area is formatted incorrectly #91

Closed jakcron closed 9 months ago

jakcron commented 1 year ago

About

When using NSTool in verbose mode while reading a NCA with a Key Area in the header, the formatting is incorrect.

Steps to Reproduce

1) Locate an NCA that has a key area (no ticket) 2) Run NSTool in verbose mode while reading NCA nstool -v <name of nca file>

Actual Output

Pokemon Legends Arceus (decrypted key redacted):

[NCA Header]
  Format Type:     NCA3
  Dist. Type:      Game Card
  Content Type:    Program
  Key Generation:  13
  Sig. Generation: 0
  Kaek Index:      Application (0)
  Size:            0x181024000
  ProgID:          0x01001f5010dfa000
  Content Index:   0
  SdkAddon Ver.:   11.4.6 (v184813056)
  Key Area:
    <--------------------------------------------------------------------------------------------------------->
    | IDX | ENCRYPTED KEY                                   | DECRYPTED KEY                                   |
    |-----|-------------------------------------------------|-------------------------------------------------|
    |   0 | 3BA15D9CCC8F5A4795424FC2F7D5BDBE | 00000000000000000000000000000000 |
    |   1 | 3BA15D9CCC8F5A4795424FC2F7D5BDBE | 00000000000000000000000000000000 |
    |   2 | 11491FEBA949A1651ED1CB86722B1C14 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
    |   3 | 3BA15D9CCC8F5A4795424FC2F7D5BDBE | 00000000000000000000000000000000 |
    <--------------------------------------------------------------------------------------------------------->

Expected Output

Pokemon Legends Arceus (decrypted key redacted):

[NCA Header]
  Format Type:     NCA3
  Dist. Type:      Game Card
  Content Type:    Program
  Key Generation:  13
  Sig. Generation: 0
  Kaek Index:      Application (0)
  Size:            0x181024000
  ProgID:          0x01001f5010dfa000
  Content Index:   0
  SdkAddon Ver.:   11.4.6 (v184813056)
  Key Area:
    <--------------------------------------------------------------------------->
    | IDX | ENCRYPTED KEY                    | DECRYPTED KEY                    |
    |-----|----------------------------------|----------------------------------|
    |   0 | 3BA15D9CCC8F5A4795424FC2F7D5BDBE | 00000000000000000000000000000000 |
    |   1 | 3BA15D9CCC8F5A4795424FC2F7D5BDBE | 00000000000000000000000000000000 |
    |   2 | 11491FEBA949A1651ED1CB86722B1C14 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
    |   3 | 3BA15D9CCC8F5A4795424FC2F7D5BDBE | 00000000000000000000000000000000 |
    <--------------------------------------------------------------------------->
jakcron commented 9 months ago

This issue has been fixed in NSTool 1.8.0