コード例 #1
0
        private void AddKeysToDb(RegisterModel model)
        {
            var user = _context.Users.FirstOrDefault(u => u.Email == model.Email);
            var encryptionServices = new EncryptionServices();
            var aesIv = EncryptionServices.GetAesIV();

            user.AesIv      = aesIv;
            user.PrivateKey = encryptionServices.GetPrivateKey();
            _context.PublicKeyStores.Add(new PublicKeyStore
            {
                Email     = model.Email,
                PublicKey = encryptionServices.GetPublicKey()
            });
            _context.SaveChanges();
        }