Unable to create RSACryptoServiceProvider [closed]

0 votes

I testing out your library Mail.dll

First, I created a key pair (RSA) with another software (xp_crypt).
This was generated with a 2048 bit, and with a passphrase.

So, I already have the .pem private key file, it looks like this:

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,FCE0E689C823BD7A

-----END RSA PRIVATE KEY-----

Now I am trying to test using your library to decrypt a hardcoded (for test)

String password = "MySecretPassword";
String pemFilename = @"C:\privatekey.pem";

Limilabs.Cryptography.PemReader pem = new Limilabs.Cryptography.PemReader();

// it fails here
RSACryptoServiceProvider rsa = pem.ReadEncryptedPrivateKeyFromFile(pemFilename, password);

This fails with the error "Unable to create RSACryptoServiceProvider - unable to import RSAParameters. Legal keys sizes are: 384-16384 (in steps of 8), Your key size is 256 bits."

This is incorrect, as I created the pair using 2048 bit.

Please advise
Thanks
Cecilia

closed with the note: Cecilia: "Never mind. I was able to verify the key size with openssl. It was 256, so the error message was correct."
asked Mar 10 by Cecilia
closed Mar 10 by Limilabs support
Could you please send such pem file to our support email? You can find it in this page's footer.
...