Decoding JWT tokens without the secret

后端 未结 1 1138
孤街浪徒
孤街浪徒 2021-02-13 15:54

I created a token with the private key by JWT, but when I try to decode it on http://kjur.github.io/jsjws/tool_jwt.html, I found that the token can be decoded without any key gi

1条回答
  •  盖世英雄少女心
    2021-02-13 15:57

    There are two ways in which a public/private keys can be used by a JWT: signing and encryption.

    If you use a private key for signing, it allows for the recipient to identify the sender of the JWT and the integrity of the message but not to hide its contents from others (confidentiality). Note that it would be the sender's private key that is used to sign the JWT and produce a JSON Web Signature (JWS) object. Apparently that applies to the JWT that you're looking at.

    When using a public key for encryption it can be used to hide content from anyone but the intended recipient. The result is a JSON Web Encryption object. Note that it would be the public key of the recipient that is used to encrypt the JWT. Apparently that is what you're looking for.

    See: http://jose.readthedocs.org/en/latest/

    0 讨论(0)
提交回复
热议问题