예제 #1
0
        public static PasswordGenerator GetPwdGenerator(SPMScheme scheme, List <string> salts, bool overrideProcess = false, SPMSchemeProcessType process = SPMSchemeProcessType.NO_EFFECT)
        {
            if (scheme == null || salts == null || scheme.Fields.Count != salts.Count)
            {
                return(null);
            }

            PasswordGenerator gen = new PasswordGenerator(GetHashingServiceProvider(scheme.Crypto),
                                                          GetPostHashingProcessor(overrideProcess ? process : scheme.ProcessType));

            for (int i = 0; i < scheme.Fields.Count; ++i)
            {
                gen.AddSalt(GetSaltingServiceProvider(scheme.Fields[i].SaltingType), salts[i]);
            }

            return(gen);
        }