Here is my code:
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(128);
try
{
string publicKeyXML = rsa.ToXmlString(false);
string privateKeyXML = rsa.ToXmlString(true);
int size = rsa.KeySize;
}
finally
{
rsa.PersistKeyInCsp = false;
}
I just keep getting the same error "Invalid flags specified". If I use the no-argument constructor, no exception is thrown and the keysize is 1024.