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

RSA Decryption Fails Using 'Record' App with latest client version #47

Open
GPRicci opened this issue Nov 24, 2020 · 6 comments
Open

RSA Decryption Fails Using 'Record' App with latest client version #47

GPRicci opened this issue Nov 24, 2020 · 6 comments

Comments

@GPRicci
Copy link

GPRicci commented Nov 24, 2020

I've just started checking out this API, so I'm not too sure on how to proceed with this error.
I ran the 'Record' app, then started the client (loginWebService modified to http://127.0.0.1:7171/).
I get my character list without issues, however when I try to connect to the game world with a character the following error pops up in the console:

ERROR System.Exception: [Connection.BeginReceiveClientCallback] RSA decryption failed.
   at OXGaming.TibiaAPI.Network.Connection.BeginReceiveClientCallback(IAsyncResult ar) in /home/dev/Documents/TibiaAPI/TibiaAPI/Network/Connection.cs:line 804
ERROR Data: 9D 00 00 00 00 00 0A 07 00 E7 04 E7 04 00 00 0B 00 31 32 2E 35 35 2E 31 30 34 35 34 DA 67 01 13 40 1E E1 B8 5F EB 1F DF 26 2B E2 B7 14 A6 7C EA 0E CA E7 2F B0 75 91 83 EA 26 C2 E0 07 F4 F5 19 DA 17 80 A7 2A 2D 4C 75 45 95 91 EB 3D EC 6E 11 76 EE 20 46 D8 44 32 CF D8 78 53 BC D4 1C FC FA AD FD DB 53 C5 7F 08 1F F1 B8 1C DA 0D 15 19 8E C3 A0 D9 5D 9C 0D E5 26 D9 71 BB CF 33 D4 01 B1 89 88 ED BA 8D E2 E3 50 35 CF 92 50 FD A5 35 18 A2 4D 1D C1 3C B3 D0 1F 2D 4B F7 EB E2 43 A8

I'm logging in to official Tibia servers using the official and latest client. Perhaps something changed in the latest version regarding the encryption of packets? RSA key changed?
Thank you beforehand.

@GPRicci
Copy link
Author

GPRicci commented Nov 25, 2020

Testing Record app on party-hunt branch throws this error when selecting a character from the character list:

ERROR Org.BouncyCastle.Crypto.DataLengthException: input too large for RSA cipher.
   at Org.BouncyCastle.Crypto.Engines.RsaCoreEngine.ConvertInput(Byte[] inBuf, Int32 inOff, Int32 inLen) in /_/crypto/src/crypto/engines/RSACoreEngine.cs:line 101
   at Org.BouncyCastle.Crypto.Engines.RsaEngine.ProcessBlock(Byte[] inBuf, Int32 inOff, Int32 inLen) in /_/crypto/src/crypto/engines/RsaEngine.cs:line 81
   at OXGaming.TibiaAPI.Network.Rsa.ProcessBlock(NetworkMessage message, Int32 index, RsaEngine engine) in /home/dev/Documents/TibiaAPI/TibiaAPI/Network/Rsa.cs:line 104
   at OXGaming.TibiaAPI.Network.Rsa.OpenTibiaDecrypt(NetworkMessage message, Int32 index) in /home/dev/Documents/TibiaAPI/TibiaAPI/Network/Rsa.cs:line 62
   at OXGaming.TibiaAPI.Network.Connection.BeginReceiveClientCallback(IAsyncResult ar) in /home/dev/Documents/TibiaAPI/TibiaAPI/Network/Connection.cs:line 797
ERROR Data: 9D 00 00 00 00 00 0A 07 00 E7 04 E7 04 00 00 0B 00 31 32 2E 35 35 2E 31 30 34 35 34 DA 67 01 BA 02 41 67 2F C2 58 BD 14 95 58 59 CA B8 31 F4 6A AB CD 50 83 56 34 14 10 D4 C0 52 A1 54 50 3D 5E 4D AA 58 C9 3D 07 2E D4 C2 09 C6 CB 2A 16 8B 0A F7 41 8C 45 B6 8E D8 BC FE 6C 35 3D 3E 66 83 9A 3C 27 9A 34 C4 BD 22 53 83 D8 8D D9 8D 27 39 5D 39 5B EC 09 F2 A1 98 F3 C7 3A D4 49 9A 41 B2 A0 0D 6F F4 58 7A CC 68 25 BB 70 6B 40 BC 15 98 42 8A 69 38 55 52 45 59 EE F0 60 EB 71 66 30 69

@Berzekz
Copy link

Berzekz commented Nov 26, 2020

They dont support 12.55, stoppeds work on 12.51. new packets.

@GPRicci
Copy link
Author

GPRicci commented Nov 27, 2020

I see. That's a shame. But I can imagine the amount of work this project required was probably formidable. Thank you for the heads-up!

@jo3bingham
Copy link
Owner

@GPRicci thanks for the report. Unless someone else submits a PR before me, it may be some time before I update it for the latest update as I am quite busy IRL.

@GPRicci
Copy link
Author

GPRicci commented Dec 3, 2020

Thank you for your answer, Joe! It's ok. RL comes first. I wish I had the knowledge to colaborate with an update.

@RafaeLeal
Copy link

@GPRicci I managed to make it work with client version 12.66.10792 (latest)
It seems like you did not change the RSA key to use the Open Tibia RSA..
Even though you are connecting to the official Tibia™, you still need to change the RSA Key because it's an asymmetric cryptography. So the tool can encrypt using the Tibia™ RSA, but it can't decrypt. If it's not able to decrypt, it's not able to store it in the .oxr file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants