Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Research/Implement Pokémon validation signatures (required for Random Matchup) #116

Open
InternalLoss opened this issue Oct 4, 2022 · 11 comments
Labels
gen5-completeness Missing/incomplete ingame features on GenV help wanted not implemented Parts of the original system, especially those which games talk to, which haven't been implemented research needed

Comments

@InternalLoss
Copy link

InternalLoss commented Oct 4, 2022

It seems Random Matchup fails currently after Wiimmfi fixed the matchmaking error, which @mm201 and I theorised is likely due to the signature not being valid (and confirmed the signature is shared to the other peer). As such, this is likely to be a blocking issue for Random Matchup Free mode (and presumably Rating Mode? @zurgeg may now be able to check since Wiimmfi's side of the communication works without issue).

Hopefully it's not an asymmetric key we don't have, or if it is we can make the DS accept our own signatures..

@mm201 mm201 added gen5-completeness Missing/incomplete ingame features on GenV not implemented Parts of the original system, especially those which games talk to, which haven't been implemented research needed help wanted labels Oct 4, 2022
@mm201
Copy link
Owner

mm201 commented Oct 4, 2022

For reference, shutter/Jon's Gen6 server can be found here: https://github.com/PretendoNetwork/PKHaX
(they're also sending a zeroed out signature)

Apparently Gen6 is using an RSA-256 signature whose public key gets downloaded once from the server and saved. I don't think Gen5 downloads a key, or, at least, I've never seen any failed requests for it in my logs, but it's something we should test for. (test with a virgin savefile and see if it hits any unique endpoints)

@InternalLoss
Copy link
Author

InternalLoss commented Oct 4, 2022

I don't think Gen5 downloads a key,

I'd hope not, since there'd likely be no way to blank (and re-download) that key, but then that might mean its static..

@zurgeg
Copy link
Contributor

zurgeg commented Oct 4, 2022

It seems Random Matchup fails currently after Wiimmfi fixed the matchmaking error, which @mm201 and I theorised is likely due to the signature not being valid (and confirmed the signature is shared to the other peer). As such, this is likely to be a blocking issue for Random Matchup Free mode (and presumably Rating Mode? @zurgeg may now be able to check since Wiimmfi's side of the communication works without issue).

Hopefully it's not an asymmetric key we don't have, or if it is we can make the DS accept our own signatures..

I'll try it in a minute.

@zurgeg
Copy link
Contributor

zurgeg commented Oct 4, 2022

Just tried. Looks like A) NoSSL is banned on Wiimmfi or B) I was autobanned for some reason or C) I was banned by a mod or D) melonDS is banned. Whatever it is, I can't connect to NAS with 23917. Which is also what happens when you're banned so...

@InternalLoss
Copy link
Author

InternalLoss commented Oct 4, 2022

melonDS is banned

you've not been banned, its probably just denied for some reason. Can you DM me your FC on Discord, and I'll ask someone?

@zurgeg
Copy link
Contributor

zurgeg commented Oct 4, 2022

melonDS is banned

you've not been banned, its probably just denied for some reason. Can you DM me your FC on Discord, and I'll ask someone?

Turns out I was using the wrong melonDS install.

@InternalLoss
Copy link
Author

Oops ;)

Let us know how it goes!

@zurgeg
Copy link
Contributor

zurgeg commented Oct 5, 2022

@InternalLoss @mm201 Can confirm. PGL side is working. So yes, this does affect rating mode

@InternalLoss
Copy link
Author

Can confirm. PGL side is working. So yes, this does affect rating mode
So even rating mode is affected by this? Ok, time to really figure out if it is truly the signature that's the issue..

@zurgeg
Copy link
Contributor

zurgeg commented Oct 5, 2022

Can confirm. PGL side is working. So yes, this does affect rating mode
So even rating mode is affected by this? Ok, time to really figure out if it is truly the signature that's the issue..

@InternalLoss You could always try the "nop everything relating to whatever isn't working and hope it works" strategy

(Sadly melonDS has no support for debugging)

@mm201 mm201 changed the title Research/Implement Pokémon validation signatures Research/Implement Pokémon validation signatures (required for Random Matchup) Feb 8, 2023
@kuroppoi
Copy link

kuroppoi commented Jul 31, 2023

What we know about this:

  • Signature algorithm used is SHA1withRSA with a key size of 1024 bits
  • Signature is over the entire encrypted party data sent to /pokemon/validate
  • RSA public key modulus is unfortunately hardcoded and is: D987D465E4EEAE582D017315F00EA3400C510B2E51E15D77D03ADCB25C830171F569FBD26A78DC69694DDD2CEFA4A9AAD1A0D9AA99705BF08038F57764EEA5AB7D6A3838678AEC262E952A1CDBB8E2FF68DC932E7F8E3AECD1FE5282EACA4161C2203FF098F79D6735E64414E185FBB3EC043D838D9B4B19072331C3F79857E5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gen5-completeness Missing/incomplete ingame features on GenV help wanted not implemented Parts of the original system, especially those which games talk to, which haven't been implemented research needed
Projects
None yet
Development

No branches or pull requests

4 participants