I have the following code (which was borrowed from the Microsoft site) and when I run it, it shows the public and private keys being identical. This does not seem correct. In addition, when I try to USE the private key, I get the message "Object contains only the public half of a key pair. A private key must also be provided."
I am usin...
I google it from web, find many samples to generate a new x509Certificate2 from a file in .net, but there is no one sample to show how to generate a completely new x509Certificate2 from the beginning in .net.
Is there any one that can tell me how to do it in .net?
Thank you very much.
...
I take some days and still can not find any way to do X.509 Certificate creation in .net.
Is there anyone who can give me an answer or some hints?
Thanks.
...
I'm trying to port a piece of Java code into .NET that takes a Base64 encoded string, converts it to a byte array, and then uses it to make a X.509 certificate to get the modulus & exponent for RSA encryption.
This is the Java code I'm trying to convert:
byte[] externalPublicKey = Base64.decode("base 64 encoded string");
KeyFactory key...
I've got a .PEM file that I want to convert to a PKCS12 file (PFX) and I know I can easily accomplish this using the following openssl command:
Create a PKCS#12 file:
openssl pkcs12 -export -in file.pem -out file.p12 -name "My Certificate"
Which is great, but I'd like to do this programmatically using openssl calls. Unfortunately...
I'm trying to construct an X509Certificate2 from a PKCS#12 blob in a byte array and getting a rather puzzling error. This code is running in a desktop application with administrator rights on Windows XP.
The stack trace is as follows, but I got lost trying to troubleshoot because _LoadCertFromBlob is marked [MethodImpl(MethodImplOption...
hey there..
I'm trying to create a CngKey object using the X509Certificate2.GetPublicKey() method.
i tried:
X509Certificate2 cert = new X509Certificate2(@"C:\Temp\cert.cer");
byte[] certPublicKey = cert.GetPublicKey();
CngKey key = CngKey.Import(certPublicKey, CngKeyBlobFormat.GenericPublicBlob);
an internal ...
I have an X.509 certificate and need to get the size of its key (in bits) - e.g., 1024 2048 etc. I have looked at X509Certificate2 and also the bouncycastle X509Certificate classes but can't see how to get the key size.
...