public void EncryptionStringRSATest() { var rsa = new RSACryptoServiceProvider(); rsa.ImportRSAPrivateKey(Convert.FromBase64String(privatekey), out _); var encrmessage = rsa.EncryptStringRSA(SourceMessage); rsa.ImportRSAPublicKey(Convert.FromBase64String(publickey), out _); var message = rsa.DecryptStringRSA(encrmessage); Assert.AreEqual(message, SourceMessage); }