Skip to content

Commit

Permalink
Merge pull request #31 from TwoTenPvP/cryptography-2
Browse files Browse the repository at this point in the history
Cryptography 2
  • Loading branch information
TwoTenPvP authored Mar 31, 2018
2 parents cf34bc3 + ec0ba47 commit a27e4de
Show file tree
Hide file tree
Showing 8 changed files with 541 additions and 17 deletions.
1 change: 1 addition & 0 deletions MLAPI/Data/NetworkedClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ public class NetworkedClient
public int ClientId;
public GameObject PlayerObject;
public List<NetworkedObject> OwnedObjects = new List<NetworkedObject>();
public byte[] AesKey;
}
}
15 changes: 8 additions & 7 deletions MLAPI/Data/NetworkingConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class NetworkingConfiguration
public List<string> MessageTypes = new List<string>();
public List<string> PassthroughMessageTypes = new List<string>();
internal HashSet<ushort> RegisteredPassthroughMessageTypes = new HashSet<ushort>();
public HashSet<int> EncryptedChannels = new HashSet<int>();
public List<string> RegisteredScenes = new List<string>();
public int MessageBufferSize = 65535;
public int ReceiveTickrate = 64;
Expand All @@ -28,11 +29,12 @@ public class NetworkingConfiguration
public byte[] ConnectionData = new byte[0];
public float SecondsHistory = 5;
public bool HandleObjectSpawning = true;
//TODO
public bool CompressMessages = false;
//Should only be used for dedicated servers and will require the servers RSA keypair being hard coded into clients in order to exchange a AES key
//TODO
public bool EncryptMessages = false;

public bool EnableEncryption = true;
public bool SignKeyExchange = true;
public string RSAPrivateKey = "<RSAKeyValue><Modulus>vBEvOQki/EftWOgwh4G8/nFRvcDJLylc8P7Dhz5m/hpkkNtAMzizNKYUrGbs7sYWlEuMYBOWrzkIDGOMoOsYc9uCi+8EcmNoHDlIhK5yNfZUexYBF551VbvZ625LSBR7kmBxkyo4IPuA09fYCHeUFm3prt4h6aTD0Hjc7ZsJHUU=</Modulus><Exponent>EQ==</Exponent><P>ydgcrq5qLJOdDQibD3m9+o3/dkKoFeCC110dnMgdpEteCruyBdL0zjGKKvjjgy3XTSSp43EN591NiXaBp0JtDw==</P><Q>7obHrUnUCsSHUsIJ7+JOrupcGrQ0XaYcQ+Uwb2v7d2YUzwZ46U4gI9snfD2J0tc3DGEh3v3G0Q8q7bxEe3H4aw==</Q><DP>L34k3c6vkgSdbHp+1nb/hj+HZx6+I0PijQbZyolwYuSOmR0a1DGjA1bzVWe9D86NAxevgM9OkOjG8yrxVIgZqQ==</DP><DQ>OB+2gyBuIKa2bdNNodrlVlVC2RtXnZB/HwjAGjeGdnJfP8VJoE6eJo3rLEq3BG7fxq1xYaUfuLhGVg4uOyngGQ==</DQ><InverseQ>o97PimYu58qH5eFmySRCIsyhBr/tK2GM17Zd9QQPJZRSorrhIJn1m6gwQ/G5aJLIM/3Yl04CoyqmQGsPXMzW2w==</InverseQ><D>CxAR1i22w4vCquB7U0Pd8Nl9R2Wxez6rHTwpnoszPB+rkAzlqKj7e5FMgpykhoQfciKPyWqQZKkAeTMIRbN56JinvpAt5POId/28HDd5xjGymHE81k3RzoHqzQXFIOF1TSYKUWzjPPF/TU4nn7auD4i6lOODATsMqtLr5DRBN/0=</D></RSAKeyValue>"; //CHANGE THESE FOR PRODUCTION!
public string RSAPublicKey = "<RSAKeyValue><Modulus>vBEvOQki/EftWOgwh4G8/nFRvcDJLylc8P7Dhz5m/hpkkNtAMzizNKYUrGbs7sYWlEuMYBOWrzkIDGOMoOsYc9uCi+8EcmNoHDlIhK5yNfZUexYBF551VbvZ625LSBR7kmBxkyo4IPuA09fYCHeUFm3prt4h6aTD0Hjc7ZsJHUU=</Modulus><Exponent>EQ==</Exponent></RSAKeyValue>"; //CHANGE THESE FOR PRODUCTION!

public bool AllowPassthroughMessages = true;
public bool EnableSceneSwitching = false;

Expand Down Expand Up @@ -72,8 +74,7 @@ public byte[] GetConfig(bool cache = true)
}
}
writer.Write(HandleObjectSpawning);
writer.Write(CompressMessages);
writer.Write(EncryptMessages);
writer.Write(EnableEncryption);
writer.Write(AllowPassthroughMessages);
writer.Write(EnableSceneSwitching);
}
Expand Down
9 changes: 9 additions & 0 deletions MLAPI/MLAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
</PropertyGroup>
<ItemGroup>
<Reference Include="IntXLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1744b76c74eaee1e, processorArchitecture=MSIL">
<HintPath>..\packages\IntX.1.0.1.0\lib\net20\IntXLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
Expand All @@ -62,6 +65,9 @@
<Compile Include="Data\TrackedPointData.cs" />
<Compile Include="MonoBehaviours\Prototyping\NetworkedAnimator.cs" />
<Compile Include="MonoBehaviours\Prototyping\NetworkedNavMeshAgent.cs" />
<Compile Include="NetworkingManagerComponents\CryptographyHelper.cs" />
<Compile Include="NetworkingManagerComponents\DiffieHellman.cs" />
<Compile Include="NetworkingManagerComponents\EllipticCurve.cs" />
<Compile Include="NetworkingManagerComponents\LagCompensationManager.cs" />
<Compile Include="MonoBehaviours\Core\NetworkedBehaviour.cs" />
<Compile Include="Data\NetworkedClient.cs" />
Expand All @@ -79,5 +85,8 @@
<Compile Include="Data\ClientIdKey.cs" />
<Compile Include="NetworkingManagerComponents\MessageChunker.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Loading

0 comments on commit a27e4de

Please sign in to comment.