StefH / OpenSSL-X509Certificate2-Provider

Parses OpenSSL public and private key components and returns a X509Certificate2 with RSACryptoServiceProvider. Based on opensslkey
MIT License
53 stars 14 forks source link

Decode private key doesn't work. #13

Open digitalhuman opened 5 years ago

digitalhuman commented 5 years ago

Below code generates Exception thrown: 'System.Security.Cryptography.CryptographicException' in mscorlib.dll. I am using .NET 4.6.1 with 4096 bits RSA private key

string pkey = File.ReadAllText(@"C:\Temp\private.key");
            IOpenSSLPrivateKeyDecoder privateKeyDecode = new OpenSSLPrivateKeyDecoder();
            var rsa = privateKeyDecode.DecodeParameters(pkey);
            RSACryptoServiceProvider provider = new RSACryptoServiceProvider();
            provider.ImportParameters(rsa);
digitalhuman commented 5 years ago

Im only using OpenSSL.PrivateKeyDecode.dll. Could that be the issue?

ashikiqbal commented 4 years ago

Getting error here: Specified method is not supported.

StefH commented 4 years ago

@digitalhuman and @ashikiqbal can you provide a full working example?