예제 #1
0
        public void EncryptAndDecryptFireInstrumentationProvider()
        {
            SymmetricProviderHelper helper = CreateHelper(DataProtectionScope.LocalMachine, CreateEntropy());

            helper.EncryptAndDecryptOneByte();

            Assert.AreEqual(1, instrumentationProvider.FireDecryptionPerformedCallCount);
            Assert.AreEqual(1, instrumentationProvider.FireEncryptionPerformedCallCount);
        }
예제 #2
0
 public void ExceptionDuringDecryptCallsInstrumentationProvider()
 {
     try
     {
         SymmetricProviderHelper helper = CreateHelper(DataProtectionScope.CurrentUser, null);
         helper.DecryptNull();
     }
     catch (ArgumentNullException)
     {
         Assert.AreEqual(0, instrumentationProvider.FireDecryptionPerformedCallCount);
         Assert.AreEqual(1, instrumentationProvider.FireCryptoFailedCallCount);
         Assert.AreEqual("The decryption operation failed.", instrumentationProvider.lastCryptoFailedMessage);
     }
 }
예제 #3
0
        public void EncryptAndDecryptOneKilobyte()
        {
            SymmetricProviderHelper helper = CreateHelper(DataProtectionScope.CurrentUser, null);

            helper.EncryptAndDecryptOneKilobyte();
        }
예제 #4
0
        public void EncryptAndDecryptOneByteMachineModeWithEntropy()
        {
            SymmetricProviderHelper helper = CreateHelper(DataProtectionScope.LocalMachine, CreateEntropy());

            helper.EncryptAndDecryptOneByte();
        }
예제 #5
0
        public void EncryptAndDecryptOneByteUserModeWithEntropy()
        {
            SymmetricProviderHelper helper = CreateHelper(DataProtectionScope.CurrentUser, CreateEntropy());

            helper.EncryptAndDecryptOneByte();
        }
예제 #6
0
        public void EncryptAndDecryptUserModeWithoutEntropy()
        {
            SymmetricProviderHelper helper = CreateHelper(DataProtectionScope.CurrentUser, null);

            helper.EncryptAndDecrypt();;
        }
예제 #7
0
        public void DecryptZeroLengthThrows()
        {
            SymmetricProviderHelper helper = CreateHelper(DataProtectionScope.CurrentUser, null);

            helper.DecryptZeroLength();
        }
예제 #8
0
        public void EncryptNullThrows()
        {
            SymmetricProviderHelper helper = CreateHelper(DataProtectionScope.CurrentUser, null);

            helper.EncryptNull();
        }