Bug 13214 - RSA.FromXmlString does not work with xml namespaces
Summary: RSA.FromXmlString does not work with xml namespaces
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: master
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2013-07-12 15:22 UTC by Jonathan Gagnon
Modified: 2015-04-28 13:34 UTC (History)
2 users (show)

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

Usage example of RSA.FromXmlString that throws an exception. (907 bytes, text/plain)
2013-07-12 15:22 UTC, Jonathan Gagnon

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:

Description Jonathan Gagnon 2013-07-12 15:22:14 UTC
Created attachment 4338 [details]
Usage example of RSA.FromXmlString that throws an exception.

RSA.FromXmlString does not work with an xml string that contains a namespace, it throws an exception.  The same code works with .NET.

Here's a little example :

string rsakey = "<RSAKeyValue><Modulus>sjanng8QA1Puw5S563eglnZgwlQOMcLgAZWHVmWVzAfUotsKc+9HhLpobPdjPsjdJE64Jbx/1oQdjMtx5z9ty+5dlW5fausb4UbFfLSH38Nci/k/qasHCphiuJMtqCYNBYvisf/2rUsj0d5nSxvNNtp37SRbIZ7bDFpmp53kAJU=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";
string dsrsakey = "<ds:RSAKeyValue><ds:Modulus>sjanng8QA1Puw5S563eglnZgwlQOMcLgAZWHVmWVzAfUotsKc+9HhLpobPdjPsjdJE64Jbx/1oQdjMtx5z9ty+5dlW5fausb4UbFfLSH38Nci/k/qasHCphiuJMtqCYNBYvisf/2rUsj0d5nSxvNNtp37SRbIZ7bDFpmp53kAJU=</ds:Modulus><ds:Exponent>AQAB</ds:Exponent></ds:RSAKeyValue>";

RSA rsa = RSA.Create();

rsa.FromXmlString(rsakey); // works in .NET and mono

rsa.FromXmlString(dsrsakey); // works in .NET, mono throws a System.Security.Cryptography.CryptographicException
Comment 1 Marek Safar 2015-04-28 13:34:03 UTC
Fixed in master