aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Framework/Remoting.cs
diff options
context:
space:
mode:
authorAdam Frisby2007-04-27 02:16:57 +0000
committerAdam Frisby2007-04-27 02:16:57 +0000
commit3659e64274fd601d43cbabd249476f65111974e6 (patch)
tree8aaa9a3ddbdbdae10916940f2d4efbf3ae5095a5 /OpenSim.Framework/Remoting.cs
parentCryptographic framework for authenticating and verifying remoting messages. M... (diff)
downloadopensim-SC-3659e64274fd601d43cbabd249476f65111974e6.zip
opensim-SC-3659e64274fd601d43cbabd249476f65111974e6.tar.gz
opensim-SC-3659e64274fd601d43cbabd249476f65111974e6.tar.bz2
opensim-SC-3659e64274fd601d43cbabd249476f65111974e6.tar.xz
Added challenge generation function to generate cryptographic strength challenges.
Diffstat (limited to 'OpenSim.Framework/Remoting.cs')
-rw-r--r--OpenSim.Framework/Remoting.cs19
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>