知识卡片

普通读书笔记卡 · 3274

签名令牌内容仍可被读取

理解等级:中级

签名 JWT 能让接收方检查令牌内容是否被篡改,但签名不等于加密;拿到令牌的人仍可能读取声明。不要把机密信息放进可读声明。若确需隐藏内容,要采用合适的加密令牌并评估密钥管理。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      JSON Web Signatures (JWS) provides integrity to a JWT. The contents of the token are visible to anyone who receives the token; however, the claims are digitally signed, which ensures that if the contents of the token are changed, the token is immediately invalid. JSON Web Encryption (JWE) provides integrity but is also encrypted. This means that the contents of the token cannot be examined.

    参考来源

    - 位置:《Mastering API Architecture》第7章《API Authentication and Authorization》之《JSON Web Tokens (JWT)》(源文件:_epub-src/OEBPS/ch07.xhtml) - 结论依据:原文区分 JWS 的完整性保护与 JWE 的加密,明确 JWS 声明对持有者可见,不应存放机密数据。 - 原始内容:JSON Web Signatures (JWS) provides integrity to a JWT. The contents of the token are visible to anyone who receives the token; however, the claims are digitally signed, which ensures that if the contents of the token are changed, the token is immediately invalid. JSON Web Encryption (JWE) provides integrity but is also encrypted. This means that the contents of the token cannot be examined.