JWT Signature Algorithm

JWT Signature Algorithm

JWT signature algorithm, in general, there are two options, one using HS256, the other one is using RS256.

Encrypted signature is actually a process of generating identification section (also part of the JWT) as a receiver based on whether the authentication information has been tampered with.

RS256 (SHA-256 using RSA Signature) is an asymmetric algorithm, which uses public / private key pair: the identity provider using a private key to generate a signature, the JWT the consumer obtains the public key to verify the signature. Since the public key (as compared to the private key) does not require protection, thus making it easy to identity provider most consumers to obtain and use (typically by one metadata URL).
on the other hand.
HS256 (HMAC with SHA-256 is of a symmetrical algorithm, a key shared only between the two parties. Since generate and verify signatures use the same key, so care must be taken to ensure that the key is not compromised.
Use RS256 safer.

Guess you like

Origin www.cnblogs.com/hnxxcxg/p/11367767.html