멘질멘질] 2023 졸업 프로젝트
JWT] Secret key 랜덤 생성
나른한 찰리
2023. 6. 16. 17:43
반응형
스프링 부트에서, application.yml 파일에서 사용할 JWT secret key 랜덤하게 생성하는 방법
파이썬 코드를 이용하여 랜덤 생성
- In the HS512 algorithm, the secret key length can vary depending on the specific implementation or library you are using. However, a common recommendation for the secret key length in HS512 is 512 bits or 64 bytes.
import secrets
# 시크릿 키 생성
secret_key = secrets.token_hex(64) # 64바이트(512비트) 길이의 무작위 헥사 문자열 생성
print(secret_key)
참고
반응형