I would like to authenticate my users from an external .NET web application. Have successfully configured external DB authentication and Moodle is able to talk to the MS SQL server. But am unable to login to Moodle using the the external DB authentication credentials since the password stored in the SQL table are encrypted by the web application. The encryption method used is given below. What should I do to make the external DB authentication to work?
here is Encryption/decryption method used:
public class clsSecurity
{
private static int encryptionKey1 = 0x56;
private static int encryptionKey2 = 0x4b;
public static string Decrypt(string textToEncrypt)
{
StringBuilder builder = new StringBuilder(textToEncrypt);
StringBuilder builder2 = new StringBuilder(textToEncrypt.Length);
for (int i = 0; i < textToEncrypt.Length; i++)
{
char ch = (char) (((ushort) (builder[i] ^ encryptionKey2)) ^ encryptionKey1);
builder2.Append(ch);
}
return builder2.ToString();
}
public static string Encrypt(string textToEncrypt)
{
StringBuilder builder = new StringBuilder(textToEncrypt);
StringBuilder builder2 = new StringBuilder(textToEncrypt.Length);
for (int i = 0; i < textToEncrypt.Length; i++)
{
char ch = (char) (((ushort) (builder[i] ^ encryptionKey1)) ^ encryptionKey2);
builder2.Append(ch);
}
return builder2.ToString();
}
}