How does RpcSecure work?

Options
In PUN 1.9, how does calling RpcSecure() work when encryption is set to true? What is actually getting encrypted? Does the client encrypt the data for the parameters, send the encrypted data to sever, and then the server decrypts it, before reencrypting it with the other client's key, and sending to the other clients? Or is the data encrypted in such a way that the server can't decrypt it before sending to the other clients.

Basically what I'm trying to figure out is: what gets encrypted by RpcSecure? And, is it possible for the server to decrypt that data before the clients get it?

Best Answers

  • Tobias
    Tobias admin
    Answer ✓
    Options
    I updated our encryption doc and it will be up within the next days here:
    https://doc.photonengine.com/en-us/pun/current/reference/encryption

    This gets clarified:

    In PUN, you can send RPCs and events with encryption on demand. The frequent and regular updates for networked objects, are not encrypted.

    To call an RPCs in a secure way, use RpcSecure() on any PhotonView.

    PhotonNetwork.RaiseEvent() can be used to send custom events with or without encryption.

    In both cases, the server will decrypt the message and re-encrypt it to send it the other players. A Server Plugin could make use of the data, read or change it.

    When an operation is sent encrypted, any data you send and all operation paramters are serialized and then encrypted. A lean header per message (length, etc.) remains unencrypted.



    Hope that helps.
  • jam_car
    jam_car
    Answer ✓
    Options
    @Tobias thank you for the answer, that does answer my questions.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Answer ✓
    Options
    Hi @jam_car,

    Thank you for choosing Photon!

    I wanted to let you know that @Tobias's changes on the "Encryption" documentation page are now live.

Answers

  • Tobias
    Tobias admin
    Answer ✓
    Options
    I updated our encryption doc and it will be up within the next days here:
    https://doc.photonengine.com/en-us/pun/current/reference/encryption

    This gets clarified:

    In PUN, you can send RPCs and events with encryption on demand. The frequent and regular updates for networked objects, are not encrypted.

    To call an RPCs in a secure way, use RpcSecure() on any PhotonView.

    PhotonNetwork.RaiseEvent() can be used to send custom events with or without encryption.

    In both cases, the server will decrypt the message and re-encrypt it to send it the other players. A Server Plugin could make use of the data, read or change it.

    When an operation is sent encrypted, any data you send and all operation paramters are serialized and then encrypted. A lean header per message (length, etc.) remains unencrypted.



    Hope that helps.
  • jam_car
    jam_car
    Answer ✓
    Options
    @Tobias thank you for the answer, that does answer my questions.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Answer ✓
    Options
    Hi @jam_car,

    Thank you for choosing Photon!

    I wanted to let you know that @Tobias's changes on the "Encryption" documentation page are now live.
  • jam_car
    Options
    @JohnTube thanks for updating the docs, it's very helpful.