[Mono-list] How to debug mono, or, How to fix this cert

Edward Ned Harvey (mono) edward.harvey.mono at clevertrove.com
Mon Jan 13 22:32:26 UTC 2014

I have some code that works on windows, using the Mono.Security assembly to generate a self-signed SSL cert, to be used by SslStream.  

(I create a Mono.Security.X509.X509CertificateBuilder, set some parameters, and then Sign().  I then create a Mono.Security.X509.PKCS12, with the signed bytes from the builder, and the private key, and return the PKCS12 bytes.  I then create a new System.Security.Cryptography.X509Certificates.X509Certificate2 which is required by SslStream.)

Unfortunately, when I run this under mono (on mac) it fails.  I haven't yet tried to run on linux, but the intended target platform is linux.  I'm just using the mac for convenience and expectation that mono on mac will behave the same as mono on linux.

So my question is this:

Either (a)
I would like to download the mono source, and build my project against the mono source, so I can step through the code inside the mono.security assembly.  So I can figure out what's going wrong, and how to fix it.  But naturally, developing in Xamarin Studio on mac, by default, my project gets linked against the MDK that I installed prerequisite to running Xamarin Studio.  I'm not sure how to link my project against mono assembly source for debugging.  How can I do this?  Or is it a nightmare, such that I should be trying to do something else?

Or (b)
Alternatively, I could eliminate my need for the above, if there is *any* known way to create a self signed cert in mono, and from it, create an X509Certificate2 suitable for use by SslStream.  I'm looking for suggestions if you have any.  I built and stepped through makecert, which successfully generated the self signed cert, but then I'm failing with System.Security.Cryptography.CryptographicException.  Unable to decode certificate.


More information about the Mono-list mailing list