blueferret 14 Posted May 11, 2022 (edited) basically i'm trying to make a mock baseapp for an offline server and for some unknown reason, i'm getting a decrypting error after the client logs in and is communicating with said BaseApp. File "C:\Python39\lib\site-packages\Crypto\Cipher\PKCS1_OAEP.py", line 167, in decrypt raise ValueError("Ciphertext with incorrect length.") client is sending this: b'\x01\x00\x00\x08\x00BW\x01\x00\x00\x00\xbe\xbe\xbe\xbe\x00\x00\x00\x00\x02\x00' keys match; not the problem. while True: readable, writeable, exceptional = select.select(sockets, empty, empty) for sock in readable: data, addr = sock.recvfrom(5000) if sock.getsockname()[1] == 20015: data_cut = data[15:-2] packet_decoded = decrypt_priv(privkey, data_cut) Edited May 11, 2022 by blueferret 1 Quote Share this post Link to post Short link Share on other sites
DrWeb7_1 181 #517465 Posted May 11, 2022 You don't have to use RSA as the client gets to baseApp. You should use the Blowfish key sent to the server by the client. Quote Share this post Link to post Short link Share on other sites
blueferret 14 #517466 Posted May 11, 2022 i also should add that when logging in, it works fine. same methods are used. Just now, DrWeb7_1 said: You don't have to use RSA as the client gets to baseApp. You should use the Blowfish key sent to the server by the client. so forget about the RSA encryption 1 Quote Share this post Link to post Short link Share on other sites
DrWeb7_1 181 #517467 Posted May 11, 2022 1 минуту назад, blueferret сказал: so forget about the RSA encryption Exactly. When loginApp 'handshake' is complete, forget about RSA existence unless another client decides to connect. Quote Share this post Link to post Short link Share on other sites
blueferret 14 #517468 Posted May 11, 2022 Just now, DrWeb7_1 said: Exactly. When loginApp 'handshake' is complete, forget about RSA existence unless another client decides to connect. def blowfish_decrypt(INPUT, BLOWFISH_KEY): blowfish_ecb = Blowfish.new(BLOWFISH_KEY, Blowfish.MODE_ECB) decrypted_data = blowfish_ecb.decrypt(INPUT) print(f'[BASEAPP_DECRYPTED] Got {decrypted_data.hex()}') return decrypted_data this? Quote Share this post Link to post Short link Share on other sites
DrWeb7_1 181 #517469 Posted May 11, 2022 1 минуту назад, blueferret сказал: this? Yes, this one is to decrypt all packets sent by client *after* the loginApp stage. Quote Share this post Link to post Short link Share on other sites
blueferret 14 #517470 Posted May 11, 2022 Just now, DrWeb7_1 said: Yes, this one is to decrypt all packets sent by client *after* the loginApp stage. yeah i think im just over complicating it Quote Share this post Link to post Short link Share on other sites