[Mono-bugs] [Bug 79320][Nor] New - RSACryptoServiceProvider.Decrypt() could return null
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Sep 8 07:52:52 EDT 2006
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by atsushi at ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=79320
--- shadow/79320 2006-09-08 07:52:52.000000000 -0400
+++ shadow/79320.tmp.4784 2006-09-08 07:52:52.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 79320
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: sebastien at ximian.com
+ReportedBy: atsushi at ximian.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: RSACryptoServiceProvider.Decrypt() could return null
+
+With the following example code, RSACryptoServiceProvider returns null
+while it would be expected to raise an error as the encrypted bytes would
+be invalid.
+
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+using System.Security.Cryptography.Xml;
+using System.Xml;
+
+public class Test
+{
+ public static void Main ()
+ {
+ string s = @"
+ hdphq/mn8goBi43YGPkmOfPj5vXjHrKPJkT4mLT3l+XzLttHMLC4
+ /yBYkuzlXtbrl2jtAJRb6oA8UcQFalUMnCa09LDZrgNU2yySn7Yb
+ iG8raSq7u2nfDCbPu+c8T9fyHxrCHrX0zeqqImX33csIn6rIrQZ8
+ HKcMsoQso4qtS2A=";
+ byte [] bytes = Convert.FromBase64String (s);
+ X509Certificate2 cert =
+ new X509Certificate2 ("test.pfx", "mono");
+ RSACryptoServiceProvider r =
+ (RSACryptoServiceProvider) cert.PrivateKey;
+ Console.WriteLine (r.Decrypt (bytes, true) == null);
+ }
+}
+
+
+Actual Results:
+
+It prints true i.e. Decrypt() returns null.
+
+Expected Results:
+
+something like below (.NET result):
+
+Unhandled Exception: System.Security.Cryptography.CryptographicException:
+Error occurred while decoding OAEP padding.
+ at System.Security.Cryptography.Utils._DecryptPKWin2KEnh(SafeKeyHandle
+hPubKey, Byte[] key, Boolean fOAEP, Int32& hr)
+ at System.Security.Cryptography.RSACryptoServiceProvider.Decrypt(Byte[]
+rgb, Boolean fOAEP)
+ at Test.Main()
+
+How often does this happen?
+
+consistently.
+
+Additional Information:
+
+the certificate used in the example follows.
More information about the mono-bugs
mailing list