diff options
-rw-r--r-- | OpenSim.Framework/Remoting.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/OpenSim.Framework/Remoting.cs b/OpenSim.Framework/Remoting.cs index 88f5598..12208fa 100644 --- a/OpenSim.Framework/Remoting.cs +++ b/OpenSim.Framework/Remoting.cs | |||
@@ -73,8 +73,27 @@ namespace OpenSim.Framework | |||
73 | } | 73 | } |
74 | 74 | ||
75 | /// <summary> | 75 | /// <summary> |
76 | /// Generates a new challenge string to be issued to a foreign host. Challenges are 1024-bit messages generated using the Crytographic Random Number Generator. | ||
77 | /// </summary> | ||
78 | /// <returns>A 128-character hexadecimal string containing the challenge.</returns> | ||
79 | public static string GenerateChallenge() | ||
80 | { | ||
81 | RNGCryptoServiceProvider RNG = new RNGCryptoServiceProvider(); | ||
82 | byte[] bytes = new byte[64]; | ||
83 | RNG.GetBytes(bytes); | ||
84 | |||
85 | StringBuilder sb = new StringBuilder(bytes.Length * 2); | ||
86 | foreach (byte b in bytes) | ||
87 | { | ||
88 | sb.AppendFormat("{0:x2}", b); | ||
89 | } | ||
90 | return sb.ToString(); | ||
91 | } | ||
92 | |||
93 | /// <summary> | ||
76 | /// Helper function, merges two byte arrays | 94 | /// Helper function, merges two byte arrays |
77 | /// </summary> | 95 | /// </summary> |
96 | /// <remarks>Sourced from MSDN Forum</remarks> | ||
78 | /// <param name="a">A</param> | 97 | /// <param name="a">A</param> |
79 | /// <param name="b">B</param> | 98 | /// <param name="b">B</param> |
80 | /// <returns>C</returns> | 99 | /// <returns>C</returns> |