예제 #1
0
 public CryptionService(
     Microsoft.Extensions.Configuration.IConfiguration config,
     ILogger <CryptionService> logger)
 {
     Logger            = logger;
     symmetric         = Aes.Create();
     symmetric.Mode    = CipherMode.CBC;
     symmetric.Padding = PaddingMode.ISO10126;
     symmetric.KeySize = 256;
     symmetric.Key     = config.CryptionKey();
     symmetric.IV      = config.CryptionIV();
     hashKey           = config.CryptionHash();
     createHash        = () =>
     {
         if (hash == null)
         {
             hash = new HMACSHA512(Convert.FromBase64String(hashKey));
         }
         return(hash);
     };
     symmetric2         = Aes.Create();
     symmetric2.Mode    = CipherMode.CBC;
     symmetric2.Padding = PaddingMode.ISO10126;
     symmetric2.KeySize = 256;
     symmetric2.Key     = config.CryptionKey2();
     symmetric2.IV      = config.CryptionIV2();
 }