public void CertKeyEncryptionE2E() { byte[] toEncrypt = new byte[] { 1, 2, 3, 4 }; ManagedRSAEncryption managed = new ManagedRSAEncryption(); X509Certificate2 testCert = new X509Certificate2(Convert.FromBase64String(TestCertBase64Encoded), TestCertPassword); byte[] encrypted = managed.EncryptWithCertificate(toEncrypt, testCert); byte[] decrypted = managed.DecryptWithCertificate(encrypted, testCert); CollectionAssert.AreNotEqual(toEncrypt, encrypted); CollectionAssert.AreNotEqual(encrypted, decrypted); CollectionAssert.AreEqual(toEncrypt, decrypted); }