protected static int Rsa_GetPlainTextBlockSize(X509Certificate2 encryptingCertificate, bool useOaep)
{
using (RSA rsa = encryptingCertificate.GetRSAPublicKey())
{
if (rsa != null)
{
if (useOaep)
{
return rsa.KeySize / 8 - 42;
}
else
{
return rsa.KeySize / 8 - 11;
}
}
}
return -1;
}