-
Notifications
You must be signed in to change notification settings - Fork 51
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
Decryption failure on first payload : Noise_XX_25519_AESGCM_SHA256 #1
Comments
That's odd. Is the service in question on the public network? If you can make a test program for me that simulates the issue I can take a look to try to figure out what is going wrong. My direct e-mail address is in the README.md file for Noise-Java. |
hi ryhs, thanks for reply, hopefully I missed something here, |
Can you tell what was the problem? I'm trying to implement WA noise handshake and have the same issue. I first send my ephemeral, then receive server ephemeral and static, and on static key I get bad tag error. |
The problem was never solved by me. Noise-Java implements the current open Noise standard. There is no guarantee that WA is using Noise in exactly the same way. They might be using a prologue value, or they are using an older specification, or a different pattern, or anything. I cannot guess as to how to fix interoperability with such a closed system. |
From first post it looks like @assegaf has solved this problem. Probably he knows what was wrong, |
@poma wa dont use the same protocol and implementation as the same as rwheather implement, I tried to make server vs client in this rwheater implementation and its working, but when I tried to make a client my own and server to wa , its not working, not even fail login event. but for sure its using local private and public key now. |
Hmmm, I still have the same problem. |
When reading the message with a WhatsApp server, the noise-java/src/main/java/com/southernstorm/noise/protocol/AESGCMOnCtrCipherState.java Line 303 in e5c4138
|
Also, when using the fallback CipherState, then the noise-java/src/main/java/com/southernstorm/noise/protocol/AESGCMFallbackCipherState.java Line 247 in e5c4138
|
To fix it, I disabled the throwing of the exception. Then, when the |
Disabling that line removes the check of the authentication tag. If the decrypted data is correct, but the tag check fails, it usually indicates that key is right but the associated data is different to that which was used when the packet was encrypted. Check that you have the same associated data on both ends of the communication. |
Hmmm okay. Instead of connecting to the WhatsApp server, I made my own server now. I have to disable the same lines still to get it working. However, after the handshake I'm able to send and receive messages from both client and server. So, the things I need to fix are:
Also see: tgalal/yowsup#3037 |
@rweather I don't use |
The encrypted data is 16 bytes longer than the unencrypted data. That extra 16 bytes is the authentication tag. However, checking that tag fails. |
@rweather Somebody found out what was the problem. In WhatsApp, you need a prologue BEFORE starting the handshake: HandshakeState hs = new HandshakeState("Noise_XX_25519_AESGCM_SHA256",HandshakeState.INITIATOR);
hs.setPrologue(new byte[]{(byte)'W',(byte)'A',0x04,0x00},0,4);
hs.start(); After that,you will not get any errors and also receive FunXMPP from the server. |
@ben221199 I still got this error after setPrologue ... |
Maybe you can take a look at https://github.com/ben221199/WAPI (look for branch |
Hello @rweather
nevermind found the problem,
well.
The text was updated successfully, but these errors were encountered: