public static CipherKeyGenerator GetKeyGenerator(string algorithm) { string canonicalKeyGeneratorAlgorithm = GeneratorUtilities.GetCanonicalKeyGeneratorAlgorithm(algorithm); if (canonicalKeyGeneratorAlgorithm == null) { throw new SecurityUtilityException("KeyGenerator " + algorithm + " not recognised."); } int num = GeneratorUtilities.FindDefaultKeySize(canonicalKeyGeneratorAlgorithm); if (num == -1) { throw new SecurityUtilityException(string.Concat(new string[] { "KeyGenerator ", algorithm, " (", canonicalKeyGeneratorAlgorithm, ") not supported." })); } if (canonicalKeyGeneratorAlgorithm == "DES") { return(new DesKeyGenerator(num)); } if (canonicalKeyGeneratorAlgorithm == "DESEDE" || canonicalKeyGeneratorAlgorithm == "DESEDE3") { return(new DesEdeKeyGenerator(num)); } return(new CipherKeyGenerator(num)); }
internal static int GetDefaultKeySize(string algorithm) { string canonicalKeyGeneratorAlgorithm = GeneratorUtilities.GetCanonicalKeyGeneratorAlgorithm(algorithm); if (canonicalKeyGeneratorAlgorithm == null) { throw new SecurityUtilityException("KeyGenerator " + algorithm + " not recognised."); } int num = GeneratorUtilities.FindDefaultKeySize(canonicalKeyGeneratorAlgorithm); if (num == -1) { throw new SecurityUtilityException(string.Concat(new string[] { "KeyGenerator ", algorithm, " (", canonicalKeyGeneratorAlgorithm, ") not supported." })); } return(num); }