Esempio n. 1
0
        private void SaveKeyPair(KeyAlgorithmPair pair, string xmlToUse)
        {
            KeyAlgorithmStorageProviderFactory factory  = new KeyAlgorithmStorageProviderFactory(CreateContext(xmlToUse));
            IKeyAlgorithmPairStorageProvider   provider = factory.Create();

            provider.Save(pair);
        }
 public void CreateTest()
 {
     using (ConfigurationContext context = GetConfigurationContext(xmlString))
     {
         KeyAlgorithmStorageProviderFactory factory = new KeyAlgorithmStorageProviderFactory(context);
         IKeyAlgorithmPairStorageProvider   keyAlgorithmPairStorageProvider = factory.Create();
         Assert.IsNotNull(keyAlgorithmPairStorageProvider);
     }
 }
        private void SetDataToBeEncrypted(ConfigurationContext context)
        {
            KeyAlgorithmStorageProviderFactory factory  = new KeyAlgorithmStorageProviderFactory(context);
            IKeyAlgorithmPairStorageProvider   provider = factory.Create();

            keyAlgorithmPair = provider.Load();
            if (null == keyAlgorithmPair)
            {
                throw new InvalidOperationException(SR.ExceptionKeyAlgorithmPairLoad);
            }

            encrypted = true;
        }