Bug 46175 - If the RSA will be used by multiple threads, it has a variety of exceptions.
Summary: If the RSA will be used by multiple threads, it has a variety of exceptions.
Status: VERIFIED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib (show other bugs)
Version: 4.8.0 (C9)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 4.8.0 (C9)
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2016-10-31 02:19 UTC by Ryoji.Ishikawa
Modified: 2016-11-21 11:59 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Ryoji.Ishikawa 2016-10-31 02:19:33 UTC
Sample code
==================================================
using System.Threading;
using System.Threading.Tasks;
using System.Security.Cryptography;

private const string key = "<RSAKeyValue><Modulus>vtnLJ+7rLT96dpDH2J8jXv1EooT/1P71Q6PM30f4ycBWp/SeW9Jdlh26jkfAIH9AscWSPK5gMGJYFKWn3i5bC34fWZEdumyaHPo41TcKd3Yu585eNkJTTqyZ4IUuA0GdW2b/NoqF4thkE2G0ebUBFQ3kqiyprvrJ5lG6ALDX44c=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";

private void test() {
  Parallel.For(0, 10, (val) =>
  {
    using (RSA rsa = RSA.Create())
    {
      rsa.FromXmlString(key);
    }
  });
}
==================================================


Exceptions
-Input string does not contain a valid encoding of the 'RSA' 'Modulus' parameter.
-Input string does not contain a valid encoding of the 'RSA' 'Exponent' parameter.
-Invalid length for a Base-64 char array or string.


Other
-This problem is from around April 2016.
-100% reproducibility.
-This problem occurs in the device and in iOS simulator.
-This problem does not have the .NET Framework.
Comment 1 Marek Safar 2016-10-31 12:02:08 UTC
Fixed in master and Mono 4.8.
Comment 2 Sachin Saini 2016-11-21 11:59:16 UTC
I have checked this issue with latest master and cycle9 builds and observed that this issue has been fixed now.here is the screencast for the same: http://www.screencast.com/t/I21Xqbt9

Master environment info: https://gist.github.com/sachins360/21cc4f09da3b55f343f12d4ea34b22d3
Cycle9 environment info: https://gist.github.com/sachins360/8ab3c8885f387f97ece82f8c8e7f3e91

Hence,I am verifying this issue.

Thanks!