public void TestAzureTableCryptoThrowsTableNotFoundException() { var keyStore = new SymmetricKeyCache(rsaHelper, tableManager); var c = new AzureCrypto(keyStore); Action action = () => c.GetEncryptor(); action.ShouldThrow<AzureCryptoException>(); }
public void EncryptionShouldWorkAsExpected() { var newKey = rsaHelper.CreateNewAesSymmetricKeyset(); tableManager.AddSymmetricKey(newKey); var keyStore = new SymmetricKeyCache(rsaHelper, tableManager); var c = new AzureCrypto(keyStore); var encryptedString = c.EncryptStringAndBase64(TestString); encryptedString.Should().NotBeNullOrEmpty("Because the encryption failed"); encryptedString.Should().NotMatch(TestString); }
public void TestAzureTableCryptoHasValidEncryptor() { var newKey = rsaHelper.CreateNewAesSymmetricKeyset(); tableManager.AddSymmetricKey(newKey); var keyStore = new SymmetricKeyCache(rsaHelper, tableManager); var c = new AzureCrypto(keyStore); c.Should().NotBeNull("At this stage the contstructor should have succeeded"); var encryptor = c.GetEncryptor(); encryptor.Should().NotBeNull("Because the keystore is initialized and there is a key"); }
public void DecryptionShouldReturnTheOriginalString() { var newKey = rsaHelper.CreateNewAesSymmetricKeyset(); tableManager.AddSymmetricKey(newKey); var keyStore = new SymmetricKeyCache(rsaHelper, tableManager); var c = new AzureCrypto(keyStore); var encryptedString = c.EncryptStringAndBase64(TestString); var decryptedString = c.DecryptStringFromBase64(encryptedString); decryptedString.ShouldBeEquivalentTo(TestString); }
public void TestAzureTableCryptoInitializesSuccessfully() { var keyStore = new SymmetricKeyCache(rsaHelper, tableManager ); var c = new AzureCrypto(keyStore); Assert.IsNotNull(c); }