Skip to content

DanielMarquesz/rsa-jwt-auth

Repository files navigation

RSA key pair validation with JWT

A quick test and example of using the RSA algorithm for validation of a JWT token =).

The main objective of this validation is to ensure that the JWT token was not modified when received by the server.

alt text

The flux above show the path of a JWT token in a request the main reason of using the key pair encryption is that in case of the user or a malicious person have access of the token and try to modify, then the server will detect that change by using the public key, making the requests a little more secures. =)

You can clone and try by yourself!

Steps

1 - npm install
2 - Generate a key par value: https://travistidwell.com/jsencrypt/demo/
3 - Fill the files private.key and public.key with the respective values.
4 - Copy token generated, then decode the second part after the dot using a base64 decode(you can use:https://www.base64decode.org/).
5 - After the decode change the payload value, then encode, then replace after the second dot in the original token.
6 - Paste the full alterade token in the variable altered_token, then you shold recieve a validation error.

Referências

Releases

No releases published

Packages

No packages published