Photon Voice Encryption

AvikDas
✭
in Photon Voice
In our application, we have rooms of people talking to each other, but the communication shouldn't leak outside of that room, including to external parties who might intercept the network data. I understand with PUN I can secure RPCs using
Thanks in advance.
RpcSecure
, but what about the voice?Thanks in advance.
0
Comments
-
Hi @AvikDas,
Thank you for choosing Photon!
If you want to enable encryption for Photon Voice you need to change the code a bit:
In "LoadBalancingPeer.cs":public class RaiseEventOptions { // code skipped public bool Encrypt; // UNCOMMENT THIS } public virtual bool OpRaiseEvent(byte eventCode, object customEventContent, bool sendReliable, RaiseEventOptions raiseEventOptions) { // code skipped return this.OpCustom((byte) OperationCode.RaiseEvent, this.opParameters, sendReliable, raiseEventOptions.SequenceChannel, raiseEventOptions.Encrypt); // LAST PARAMETER UPDATED }
In "LoadBalancingFrontend.cs":public void SendFrame(object content, int channelId, LocalVoice localVoice) { var opt = new LoadBalancing.RaiseEventOptions(); opt.Encrypt = true; // LINE ADDED
1 -
@JohnTube: Implementing this change was easy, but how do I check if it's actually working? I've captured network traffic and viewed it using Wireshark, both before and after implementing the change. But, since the protocol isn't fully documented (only the high-level format is, as far as I can tell), I'm not sure if the encryption is working.
Additonally, I'm not sure what to look out for in the voice data.
Basically, we want to make sure no sensitive data is being sent unencrypted, specifically the RPC parameters. The fact that RPCs are being made, or the avatar position/rotation data is fine to send. (Also, we'd ideally not send the room name in cleartext either, but that can be worked around). What's the best way to check that this is the case?
Thanks!0 -
Basically, we want to make sure no sensitive data is being sent unencrypted, specifically the RPC parameters. The fact that RPCs are being made, or the avatar position/rotation data is fine to send. (Also, we'd ideally not send the room name in cleartext either, but that can be worked around). What's the best way to check that this is the case?I see now! I thought you wanted to encrypt the voice stream/messages! That is what the code changes I suggested are about. But I think that you want to enable encryption for PUN's RPCs. The PhotonNetwork.RpcSecure methods are enough. You can also take a look at this discussion here.0
-
@JohnTube:I thought you wanted to encrypt the voice stream/messages!
I did, and I already usedRpcSecure
to encrypt the RPCs separately. However, now I want to make sure that the encryption actually had an effect, both for RPCs and for voice (after making the change you suggested above).
Any way to verify that sensitive information is no longer being sent after using those two mechanisms (RpcSecure
and the change you mentioned above)?
Thanks.0 -
Hi @AvikDas,
Well the wireshark stuff is tricky.
Theoretically if you try to send same thing twice (once with encryption disabled and once enabled) and identify it (not obvious I know) each time and compare that should do it.
Maybe easiest thing is to send plain "text" string.
In any case maybe our internal serialization hides things and make it harder.
Maybe @Tobias may have an idea here.0 -
Sending some string in an RPC and tracing it with Wireshark is the simplest way in this case, yes.
You want to confirm that the encryption is being applied and the only way that "guarantees" that, is to look at the sent data.
You can simplify matters somewhat by doing a test client which sends the RPC on demand (key-press), so you know when it should show up in Wireshark. Compare it with an unencrypted RPC.0 -
@Tobias: Thanks for the information. I've been looking at the traffic in Wireshark, and even in the unencrypted case, I wasn't able to pull out the plain strings. Plus, this doesn't help verify the voice encryption.
For now, I'm happy to trust that the Photon code, when called correctly, will do the right thing. Thanks for all the help!0 -
Hi,
I used both PUN classic V1.92 and Photon Voice classic v1.15 in my Unity project. I want to enable encryption for my Photon Voice according to the method provided by JohnTube above. However I found 2 LoadBalancingPeer.cs scripts, one is in "Assets\Plugins\PhotonLoadbalancingApi" and the other is in "Assets\Photon Unity Networking\Plugins\PhotonNetwork", which one should I modify?
Thanks.0 -
Hi @iruan0820,
Thank you for choosing Photon!
No need to modify anything if you want to encrypt voice streams.
Latest Photon Voice classic version has encryption setting available out-of-the-box.
In PhotonVoiceSettings component, added to the scene or via code setPhotonVoiceSettings.Instance.Encrypt
to true or check/tick it from the inspector.0