예제 #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)
 {
 }