diff options
Diffstat (limited to 'OpenGrid.Framework.Data.MySQL/MySQLGridData.cs')
-rw-r--r-- | OpenGrid.Framework.Data.MySQL/MySQLGridData.cs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs b/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs new file mode 100644 index 0000000..65a0fff --- /dev/null +++ b/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs | |||
@@ -0,0 +1,51 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenGrid.Framework.Data; | ||
5 | |||
6 | namespace OpenGrid.Framework.Data.MySQL | ||
7 | { | ||
8 | public class MySQLGridData : IGridData | ||
9 | { | ||
10 | MySQLManager database; | ||
11 | |||
12 | public void Initialise() | ||
13 | { | ||
14 | database = new MySQLManager("localhost", "db", "user", "password", "false"); | ||
15 | } | ||
16 | public SimProfileData GetProfileByHandle(ulong handle) | ||
17 | { | ||
18 | return new SimProfileData(); | ||
19 | } | ||
20 | public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid) | ||
21 | { | ||
22 | return new SimProfileData(); | ||
23 | } | ||
24 | public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey) | ||
25 | { | ||
26 | throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); | ||
27 | } | ||
28 | |||
29 | /// <summary> | ||
30 | /// Provides a cryptographic authentication of a region | ||
31 | /// </summary> | ||
32 | /// <remarks>This requires a security audit.</remarks> | ||
33 | /// <param name="uuid"></param> | ||
34 | /// <param name="handle"></param> | ||
35 | /// <param name="authhash"></param> | ||
36 | /// <param name="challenge"></param> | ||
37 | /// <returns></returns> | ||
38 | public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge) | ||
39 | { | ||
40 | System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed(); | ||
41 | System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding(); | ||
42 | |||
43 | byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); | ||
44 | byte[] hash = HashProvider.ComputeHash(stream); | ||
45 | |||
46 | return false; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | |||
51 | } | ||