Skip to content

Commit 90f61ce

Browse files
committed
Added missing security related XML comments
1 parent e24e745 commit 90f61ce

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

MLAPI/NetworkingManagerComponents/Cryptography/CryptographyHelper.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,34 @@ namespace MLAPI.Cryptography
1212
/// </summary>
1313
public static class CryptographyHelper
1414
{
15+
/// <summary>
16+
/// The delegate type used to validate certificates
17+
/// </summary>
18+
/// <param name="certificate">The certificate to validate</param>
19+
/// <param name="hostname">The hostname the certificate is claiming to be</param>
1520
public delegate bool VerifyCertificateDelegate(X509Certificate2 certificate, string hostname);
21+
/// <summary>
22+
/// The delegate to invoke to validate the certificates
23+
/// </summary>
1624
public static VerifyCertificateDelegate OnValidateCertificateCallback = null;
1725

26+
/// <summary>
27+
///
28+
/// </summary>
29+
/// <param name="certificate">The certificate to validate</param>
30+
/// <param name="hostname">The hostname the certificate is claiming to be</param>
31+
/// <returns>Whether or not the certificate is considered valid</returns>
1832
public static bool VerifyCertificate(X509Certificate2 certificate, string hostname)
1933
{
2034
if (OnValidateCertificateCallback != null) return OnValidateCertificateCallback(certificate, hostname);
2135
return certificate.Verify() && (hostname == certificate.GetNameInfo(X509NameType.DnsName, false) || hostname == "127.0.0.1");
2236
}
2337

38+
/// <summary>
39+
/// Gets the aes key for any given clientId
40+
/// </summary>
41+
/// <param name="clientId">The clientId of the client whose aes key we want</param>
42+
/// <returns>The aes key in binary</returns>
2443
public static byte[] GetClientKey(uint clientId)
2544
{
2645
if (NetworkingManager.singleton.isServer)
@@ -44,6 +63,10 @@ public static byte[] GetClientKey(uint clientId)
4463
}
4564
}
4665

66+
/// <summary>
67+
/// Gets the aes key for the server
68+
/// </summary>
69+
/// <returns>The servers aes key</returns>
4770
public static byte[] GetServerKey()
4871
{
4972
if (NetworkingManager.singleton.isServer)

0 commit comments

Comments
 (0)