failed to decrypt data: msg=Padding is invalid and cannot be removed

Options
Hi

I want packet encryption.

So, i read this page (https://doc.photonengine.com/en-us/realtime/current/reference/encryption)

But, This code is not encryption.

My server peer is setting this code.
byte[] bKey = System.Text.Encoding.ASCII.GetBytes("rxONBa*&e03!%76N9mBlbR#@Xl&A&w");
peer.InitializeEncryption(bKey);

And my client setting this code.
this.peer.EstablishEncryption();
peer.OpCustom(151, data, true, 0, true); <- Send

So.. my server can't reciving. because photon server is lock.

"failed to decrypt data: msg=Padding is invalid and cannot be removed"

So how can i fixed?

Thanks.


My client version : Photon3Unity3D.dll(4.1.1.14)
My server version : Photon.SocketServer.dll(4.0.28.11245)

Comments

  • Tobias
    Options
    I think you are one level too deep. You attempt to re-implement some low level functionality, which is wrapped and supported by the LoadBalancing API on the client.

    You don't have to call peer.EstablishEncryption() yourself. Just use the LoadBalancingClient, connect and the payload encryption is setup for you and there is a callback when you are connected successfully (and all steps to get you there are finished).

    Sorry, at the moment, we don't have time to support you re-doing the APIs we provide.