Ejemplo n.º 1
0
        public void GetSymmetricAlgorithmProvider()
        {
            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);
            SymmetricAlgorithmProvider     sym     = (SymmetricAlgorithmProvider)factory.CreateSymmetricCryptoProvider("symmetricAlgorithm1");

            Assert.IsNotNull(sym);
        }
Ejemplo n.º 2
0
        private ISymmetricCryptoProvider CreateProvider()
        {
            SymmetricCryptoProviderFactory         factory = new SymmetricCryptoProviderFactory(cachingConfigurationView.ConfigurationContext);
            SymmetricStorageEncryptionProviderData data    = (SymmetricStorageEncryptionProviderData)cachingConfigurationView.GetStorageEncryptionProviderData(ConfigurationName);

            return(factory.CreateSymmetricCryptoProvider(data.SymmetricInstance));
        }
        public void GetSymmetricAlgorithmProvider()
        {
            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);
            SymmetricAlgorithmProvider sym = (SymmetricAlgorithmProvider)factory.CreateSymmetricCryptoProvider("symmetricAlgorithm1");

            Assert.IsNotNull(sym);
        }
        public void GetDpapiSymmetricProvider()
        {
            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);
            DpapiSymmetricCryptoProvider dpapi =
                (DpapiSymmetricCryptoProvider)factory.CreateSymmetricCryptoProvider("dpapiSymmetric1");

            Assert.IsNotNull(dpapi);
        }
        public void GetByNameTest()
        {
            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);

            ISymmetricCryptoProvider provider = factory.CreateSymmetricCryptoProvider("provider1");
            Assert.IsNotNull(provider);
            Assert.IsTrue(provider is MockSymmetricCryptoProvider);
        }
Ejemplo n.º 6
0
        public void GetDpapiSymmetricProvider()
        {
            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);
            DpapiSymmetricCryptoProvider   dpapi   =
                (DpapiSymmetricCryptoProvider)factory.CreateSymmetricCryptoProvider("dpapiSymmetric1");

            Assert.IsNotNull(dpapi);
        }
Ejemplo n.º 7
0
        public void GetMockSymmetricCryptoProvider()
        {
            string instance = "mockSymmetric1";
            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);
            MockSymmetricCryptoProvider    store   = (MockSymmetricCryptoProvider)factory.CreateSymmetricCryptoProvider(instance);

            Assert.IsNotNull(store);
        }
        public void GetMockSymmetricCryptoProvider()
        {
            string instance = "mockSymmetric1";
            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);
            MockSymmetricCryptoProvider store = (MockSymmetricCryptoProvider)factory.CreateSymmetricCryptoProvider(instance);

            Assert.IsNotNull(store);
        }
Ejemplo n.º 9
0
        public void GetByNameTest()
        {
            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);

            ISymmetricCryptoProvider provider = factory.CreateSymmetricCryptoProvider("provider1");

            Assert.IsNotNull(provider);
            Assert.IsTrue(provider is MockSymmetricCryptoProvider);
        }
        public void FixtureSetup()
        {
            byte[] key = new byte[32];
            CryptographyUtility.GetRandomBytes(key);
            CryptographySettings settings = (CryptographySettings)context.GetConfiguration(CryptographySettings.SectionName);
            ((SymmetricAlgorithmProviderData)settings.SymmetricCryptoProviders[symmetricInstanceName]).Key = key;

            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);
            symmProvider = factory.CreateSymmetricCryptoProvider(symmetricInstanceName);
        }
        public void GetDefaultTest()
        {
            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);

            ISymmetricCryptoProvider provider = factory.CreateSymmetricCryptoProvider("provider1");
            Assert.IsNotNull(provider);

            MockSymmetricCryptoProvider mockProvider = provider as MockSymmetricCryptoProvider;
            Assert.IsNotNull(mockProvider);
            Assert.IsTrue(mockProvider.Initialized);
        }
        public void FixtureSetup()
        {
            byte[] key = new byte[32];
            CryptographyUtility.GetRandomBytes(key);
            CryptographySettings settings = (CryptographySettings)context.GetConfiguration(CryptographySettings.SectionName);

            ((SymmetricAlgorithmProviderData)settings.SymmetricCryptoProviders[symmetricInstanceName]).Key = key;

            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);

            symmProvider = factory.CreateSymmetricCryptoProvider(symmetricInstanceName);
        }
Ejemplo n.º 13
0
        public void GetDefaultTest()
        {
            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);

            ISymmetricCryptoProvider provider = factory.CreateSymmetricCryptoProvider("provider1");

            Assert.IsNotNull(provider);

            MockSymmetricCryptoProvider mockProvider = provider as MockSymmetricCryptoProvider;

            Assert.IsNotNull(mockProvider);
            Assert.IsTrue(mockProvider.Initialized);
        }
Ejemplo n.º 14
0
        private DpapiSymmetricCryptoProvider GetCryptoProvider(string instanceName)
        {
            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);

            return((DpapiSymmetricCryptoProvider)factory.CreateSymmetricCryptoProvider(instanceName));
        }
 public void ProviderNotFoundTest()
 {
     SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);
     factory.CreateSymmetricCryptoProvider("provider3");
 }
 private DpapiSymmetricCryptoProvider GetCryptoProvider(string instanceName)
 {
     SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);
     return (DpapiSymmetricCryptoProvider)factory.CreateSymmetricCryptoProvider(instanceName);
 }
Ejemplo n.º 17
0
        public void ProviderNotFoundTest()
        {
            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);

            factory.CreateSymmetricCryptoProvider("provider3");
        }