Пример #1
0
        public SymmetricAlgorithm GetEncryptionAlgorithm()
        {
            // We suppress CS0618 since some of the algorithms we support are marked with [Obsolete].
            // These deprecated algorithms are *not* enabled by default. Developers must opt-in to
            // them, so we're secure by default.
#pragma warning disable 618
            switch (this.encryption)
            {
            case "AES":
            case "Auto":         // currently "Auto" defaults to AES
                return(CryptoAlgorithms.CreateAes());

            case "DES":
                return(CryptoAlgorithms.CreateDES());

            case "3DES":
                return(CryptoAlgorithms.CreateTripleDES());

            default:
                return(null);        // unknown

#pragma warning restore 618
            }
        }