Skip to content

[BUG] NCA Key Area is formatted incorrectly #91

Description

@jakcron

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 |
    <--------------------------------------------------------------------------->

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions