Throw a better error when we try and fail to load something.
This commit is contained in:
parent
3136228e76
commit
490a8d1b04
@ -128,10 +128,19 @@ namespace EduNetworkBuilder
|
|||||||
EncryptedXml exml = new EncryptedXml();
|
EncryptedXml exml = new EncryptedXml();
|
||||||
|
|
||||||
// Decrypt the element using the symmetric key.
|
// Decrypt the element using the symmetric key.
|
||||||
byte[] rgbOutput = exml.DecryptData(ed, algValue);
|
try
|
||||||
|
{
|
||||||
|
//Do the decryption
|
||||||
|
byte[] rgbOutput = exml.DecryptData(ed, algValue);
|
||||||
|
// Replace the encryptedData element with the plaintext XML elemnt.
|
||||||
|
exml.ReplaceData(encryptedElement, rgbOutput);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
//The decryption failed.
|
||||||
|
throw new LoginException("Key/Salt unable to decrypt.");
|
||||||
|
}
|
||||||
|
|
||||||
// Replace the encryptedData element with the plaintext XML elemnt.
|
|
||||||
exml.ReplaceData(encryptedElement, rgbOutput);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,4 +195,19 @@ namespace EduNetworkBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a simple login exception that we can throw when we try to decrypt and it fails
|
||||||
|
/// </summary>
|
||||||
|
public class LoginException : System.Exception
|
||||||
|
{
|
||||||
|
public LoginException() : base()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public LoginException(String message) : base(message)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public LoginException(String message, Exception innerException) : base(message, innerException)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user