
SpringBoot JWT 공부를 하다가 오류를 발견 했다....

오류 코드를 보면..
io.jsonwebtoken.security.WeakKeyException: The signing key's size is 240 bits which is not secure enough for the HS256 algorithm. The JWT JWA Specification (RFC 7518, Section 3.2) states that keys used with HS256 MUST have a size >= 256 bits (the key size must be greater than or equal to the hash output size). Consider using the io.jsonwebtoken.security.Keys class's 'secretKeyFor(SignatureAlgorithm.HS256)' method to create a key guaranteed to be secure enough for HS256. See https://tools.ietf.org/html/rfc7518#section-3.2 for more information.
첫 문장을 해석 해 보면
The signing key's size is 240 bits which is not secure enough for the HS256 algorithm. The JWT JWA Specification (RFC 7518, Section 3.2) states that keys used with HS256 MUST have a size >= 256 bits (the key size must be greater than or equal to the hash output size).
키가 240비트이고, HS256 알고리즘에 대해 안전하지 않다.. 라는 내용인데...
구글링을 해보니 JWT의 암호화 알고리즘을 HS256을 사용하는데 키 값 또한 256비트가 넘어야 한다.
라는 내용 이었다.
변수로 지정한 secretKey에 몇 글자 뚝딱 하니까 해결이 되었다!
'Backend > SPRINGBOOT' 카테고리의 다른 글
| [SpringBoot] 에러 페이지 설정 (0) | 2023.01.09 |
|---|---|
| [SpringBoot] 게시판 만들기 9. 검색 (0) | 2022.11.01 |
| [SpringBoot] 게시판 만들기 9. 페이징 처리 (0) | 2022.11.01 |
| [SpringBoot] 게시판 만들기 8. 파일 업로드 (0) | 2022.11.01 |
| [SpringBoot] 게시판 만들기 7. 처리 메시지 (0) | 2022.10.31 |