[Mono-winforms-list] TripleDESCryptoServiceProvider _NewEncryptor returns null
sharkal
wolfgang.ginner at kapsch.net
Wed Jun 13 10:15:36 UTC 2012
Hi,
i think mono has a bug with the private method "_NewEncryptor", since i get
null, when i want to get the method by "GetMethod":
TripleDES tripleDESalg = TripleDES.Create();
TripleDESCryptoServiceProvider sm = tripleDESalg as
TripleDESCryptoServiceProvider;
sm.Mode = CipherMode.ECB;
sm.Padding = PaddingMode.None;
*MethodInfo mi = sm.GetType().GetMethod("_NewEncryptor",
BindingFlags.NonPublic | BindingFlags.Instance);*
if (mi != null)
{
object[] Par = { keyValue, sm.Mode, iVValue, sm.FeedbackSize, 0
}; // encrypt 0
ICryptoTransform trans = mi.Invoke(sm, Par) as
ICryptoTransform;
// CreateEnrypt doesn't work for Weak Keys
//ICryptoTransform trans = sm.CreateEncryptor(keyValue,
iVValue);
byte[] resultArray = trans.TransformFinalBlock(bytes, 0,
bytes.Length);
return resultArray;
}
else
{
throw new Exception("Decryption failed. Method _NewEncryptor
not found");
}
I can't use the CreateEnrypt Method, since most times i will have to deal
with Weak Keys.
So does anyone has a solution, how i can get it work under mono?
--
View this message in context: http://mono.1490590.n4.nabble.com/TripleDESCryptoServiceProvider-NewEncryptor-returns-null-tp4649909.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.
More information about the Mono-winforms-list
mailing list