/// <summary>
 /// Initializes a new instance of the <see cref="RijndaelSymmetricCrypto"/> class.
 /// </summary>
 /// <param name="configuration">Contains the configuration options.</param>
 public RijndaelSymmetricCrypto(RijndaelSymmetricCryptoConfiguration configuration)
     : this(configuration.Password,
     configuration.RgbInitVector,
     configuration.MinimumSaltLength,
     configuration.MinimumSaltLength,
     configuration.KeySize,
     configuration.SaltValue,
     configuration.PasswordIterations)
 {
 }
        /// <summary>
        /// Generate a new crypto configuration and serializes the output
        /// to <paramref name="stream"/>.
        /// </summary>
        /// <param name="stream">The stream to serialize the output to.</param>
        public void GenerateNewCryptoConfiguration(Stream stream)
        {
            RijndaelSymmetricCryptoConfiguration cryptoConfiguration = new RijndaelSymmetricCryptoConfiguration();
            RandomString generator = new RandomString();
            cryptoConfiguration.Password = generator.NextXml(16);
            cryptoConfiguration.RgbInitVector = generator.NextXml(16);
            cryptoConfiguration.SaltValue = generator.NextXml(16);

            using (XmlWriter writer = XmlWriter.Create(stream, new XmlWriterSettings { Indent = true, IndentChars = "    " }))
            {
                new XmlSerializer(cryptoConfiguration.GetType()).Serialize(writer, cryptoConfiguration);
            }
        }