public void EncryptionUtilitiesFullE2E() { byte[] originalData = new byte[] { 1, 2, 3, 4 }; ManagedRSAEncryption managed = new ManagedRSAEncryption(); X509Certificate2 testCert = new X509Certificate2(Convert.FromBase64String(TestCertBase64Encoded), TestCertPassword); byte[] encryptedWithLocal = managed.EncryptWithLocalKey(TestProvider, TestKeyName, originalData); byte[] recryptedWithDeviceCert = managed.RecryptPfxImportMessage(encryptedWithLocal, testCert, TestProvider, TestKeyName); byte[] decryptedWithDeviceCert = managed.DecryptWithCertificate(recryptedWithDeviceCert, testCert); CollectionAssert.AreEqual(originalData, decryptedWithDeviceCert); CollectionAssert.AreNotEqual(originalData, encryptedWithLocal); CollectionAssert.AreNotEqual(originalData, recryptedWithDeviceCert); CollectionAssert.AreNotEqual(encryptedWithLocal, recryptedWithDeviceCert); CollectionAssert.AreNotEqual(encryptedWithLocal, decryptedWithDeviceCert); CollectionAssert.AreNotEqual(recryptedWithDeviceCert, decryptedWithDeviceCert); }