Jump to content
Korean Random
Sign in to follow this  
blueferret

ciphertext error

Recommended Posts

Posted (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 by blueferret

Share this post


Link to post

Short link
Share on other sites

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.

Share this post


Link to post

Short link
Share on other sites

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

Share this post


Link to post

Short link
Share on other sites
1 минуту назад, blueferret сказал:

so forget about the RSA encryption

Exactly. When loginApp 'handshake' is complete, forget about RSA existence unless another client decides to connect.

Share this post


Link to post

Short link
Share on other sites
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?

Share this post


Link to post

Short link
Share on other sites
1 минуту назад, blueferret сказал:

this?

Yes, this one is to decrypt all packets sent by client *after* the loginApp stage.

Share this post


Link to post

Short link
Share on other sites
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

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...