Beispiel #1
0
        SymmetricAlgorithm GetAlgorithm()
        {
            MachineKeySection section = MachineKeySection.Config;

            if (section.DecryptionKey.StartsWith("AutoGenerate"))
            {
                throw new ProviderException("You must explicitly specify a decryption key in the <machineKey> section when using encrypted passwords.");
            }

            SymmetricAlgorithm sa = section.GetDecryptionAlgorithm();

            if (sa == null)
            {
                throw new ProviderException(String.Format("Unsupported decryption attribute '{0}' in <machineKey> configuration section", section.Decryption));
            }

            sa.Key = section.GetDecryptionKey();
            return(sa);
        }
 static SymmetricAlgorithm GetDecryptionAlgorithm(MachineKeySection section)
 {
     return(section.GetDecryptionAlgorithm());
 }