示例#1
0
        public static void AddCryptography(this IServiceCollection services,
                                           Action <CryptographyOptions> cryptographyOptionsBuilder)
        {
            var options = new CryptographyOptions();

            cryptographyOptionsBuilder(options);
            services.AddCryptography(options);
        }
示例#2
0
 public static void AddCryptography(this IServiceCollection services,
                                    CryptographyOptions cryptographyOptions)
 {
     services.AddTransient(p => cryptographyOptions);
     services.AddTransient <ICryptographer, Cryptographer>();
     services.AddTransient <HashAlgorithm, SHA256>(p => SHA256.Create());
     services.AddTransient <IHasher, Hasher>();
 }
示例#3
0
 public Cryptographer(CryptographyOptions options)
     : this(options.Password, options.KeySize, options.SaltSize)
 {
 }