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-----
-----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.