Digital Certificate as Resource

I’ve added a digital certificate into the resources for my project. I need the certificate for my FEZ Spider to host an SSL service. The certificate loads into the resources fine and I can see the bytes in debug mode. The error is when I attempt to parse bytes into the certificate object. There is not a message in the exception. I’ve tried it as a pfx file with pfx password and a cer file without a password. What am I missing here?

As a .pfx file:


byte[] b = Resources.GetBytes(Resources.BinaryResources.ResourceName);
X509Certificate cert = new X509Certificate(b, "pfxpassword");

As a .cer file:


byte[] b = Resources.GetBytes(Resources.BinaryResources.ResourceName);
X509Certificate cert = new X509Certificate(b);

I solved it. There wasn’t anything in the exception other than the stack trace ending at the parse. Apparently using a pfx or cer doesn’t work. I used this wiki http://wiki.tinyclr.com/index.php?title=Create_a_self-signed_x509_certificate to make a pem and it worked. Thanks for reply.