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
Developer Community or GitHub 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.
In the newly released, specified version of Xamarin Studio, constructing an X509 Certificate now fails when we target iOS 4.3. We have to target this version for client support - and in the previous version (most updated version of MonoDevelop) the exact same code compiles and executes fine. Bringing the targeted iOS version up to 5.0 fixes the issue, and 6.0 also works.
Our code takes the form:
byte certificate = <certificate decoding>;
string certificatePassword = <certificate password decoding>;
cert = new X509Certificate2(certificate, certificatePassword, X509KeyStorageFlags.PersistKeySet);
Where the failure is on the third line.
Version Information follows:
=== Xamarin Studio ===
Version 4.0 (build 2003)
Installation UUID: <identifying information removed>
Mono 2.10.11 (mono-2-10/2baeee2)
Package version: 210110000
=== Apple Developer Tools ===
Xcode 4.5 (1839)
=== Xamarin.Mac ===
Xamarin.Mac: Not Installed
=== Xamarin.iOS ===
Version: 126.96.36.199 (Business Edition)
=== Xamarin.Android ===
=== Build Information ===
Git revision: Release ID: 400002003
<identifying information removed>
Build date: 2013-02-20 00:32:59+0000
Xamarin addins: b7a7aff09b352c13ded8a27439fd6d2250361511
=== Operating System ===
Mac OS X 10.7.5
<identifying information removed>
> Where the failure is on the third line.
Could you provide what's the "failure" you see ? e.g. an exception, crash ?
X509Certificate2 is a fully managed type. As such it should be independent of the iOS version it's being executed from. Also there's no recent change in the type - so it _might_ be something it depends that "acquired" a dependency on iOS 5.0 (and later).
The exception comes from the data, line #113 only throw if:
if (decoder .Tag != 0x30)
throw new CryptographicException (encoding_error);
and that's fully managed and won't change with iOS versions. Something must have occured earlier and affected the data itself.
Can you tell me which earlier version of MonoTouch worked (it's unrelated to the version of MonoDevelop) ? The differences between 6.2 and 6.0.10 are very minor, beside the rebranding, due to the iOS 6.0.1 release and the test/freeze around Xamarin 2.0.
Also if you can create a small test case it might prove useful since the bug might be hard to locate (it's not where it fails) and was not caught by our test suite.
I performed an isolation test. Correct input data results in a valid certificate on all versions including 4.3. There must be some error further up the chain which is version dependent. Therefore this particular bug report is invalid and can be closed. Thanks Xmarain team for your considered input...