Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 1948 [details]
When the attached program is run on Mono the results differ from .NET (in particular the sixth byte is 0xA4 on Mono and 0x24 on the CLR.
This difference showed up because IKVM.Reflection now uses this method to extract the public key from a key pair and this caused an mcs test failure.
0x24 means CALG_RSA_SIGN, i.e. an RSA key used for signature
0x42 means CALG_RSA_KEYX, i.e. an RSA key used for key exchange
CryptoAPI makes a difference about them, even if it's often only for storage (two key pairs per containers) but it really depends on the CSP implementation (hardware CSP are generally more restrictive).
However .NET does not differentiate them and by default returns 0x42 (for new keys). That will differ if you roundtrip a key from a CAPIBLOB because the key gets stored into CryptoAPI (using the original value).
Mono does not use CryptoAPI and it's keystore store do not support features that are not required for other parts of the framework (and that includes this bit of information). There's a few ways to solve this (some simpler than others) but I need to know which mcs test is failing ? (if only to determine the existing key check is valid).
If it helps, the scenario is exactly like the repro, ImportCspBlob followed by ExportCspBlob. This is just a way to extract the public key.
Fixed in master