System.ArgumentOutOfRangeException: ‘IDX10603: The algorithm: ‘http://www.w3.org/2001/04/xmldsig-more#hmac-sha256' requires the SecurityKey.KeySize to be greater than ‘128’ bits. KeySize reported: ‘24’.’
1 min readJun 5, 2018
I found a error in my usercontroller and resolved the error
userController.cs
[AllowAnonymous][HttpPost(“authenticate”)]public IActionResult Authenticate([FromBody]LoginUserModel loginUserModel){var user = _userService.Authenticate(loginUserModel.UserName, loginUserModel.Password);//Console.WriteLine(user);if (user == null){return Unauthorized();}var tokenHandler = new JwtSecurityTokenHandler();var key = Encoding.ASCII.GetBytes(_appSettings.Secret);var tokenDescriptor = new SecurityTokenDescriptor{Subject = new ClaimsIdentity(new Claim[]{new Claim(ClaimTypes.Name, loginUserModel.UserName)}),Expires = DateTime.UtcNow.AddMinutes(10),SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)