public static int GetCipherTextBlockSize(X509Certificate2 encryptingCertificate, bool useOaep) { using (RSA rsa = encryptingCertificate.GetRSAPublicKey()) { if (rsa != null) { return rsa.KeySize / 8; } } return -1; }