private void SaveKeyPair(KeyAlgorithmPair pair, string xmlToUse)
 {
     KeyAlgorithmStorageProviderFactory factory = new KeyAlgorithmStorageProviderFactory(CreateContext(xmlToUse));
     IKeyAlgorithmPairStorageProvider provider = factory.Create();
     provider.Save(pair);
 }
        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;
        }