SessionId /认证令牌生成的最佳做法

栏目: Python · 发布时间: 8年前

内容简介:http://stackoverflow.com/questions/5244455/best-practices-for-sessionid-authentication-token-generation
我看到有人使用UUID进行认证令牌生成.然而,在 RFC 4122

年,它表示

Do not assume that UUIDs are hard to guess; they should not be used  as security capabilities (identifiers whose mere possession grants  access), for example.

我想知道,在 Java 和.NET中为SessionId / AuthenticationToken生成使用了什么算法.在具有超过平均安全需求的应用程序中,UUID是否不适合这些目的?

UUID生成是随机的,但随机的熵意味着你最终会容易猜出UUID.如果您使用一个好的随机数生成器,可以生成可用于会话的UUID.但是,这样做的结果是,UUID没有内置的重播预防,篡改,固定等等,你必须自己处理这个问题(请看:UUID本身不应被视为一个有效的会话ID本身).也就是说,这是一个很好的代码片段,您将如何使用 python 生成安全的UUID:

Unique session id in python

http://stackoverflow.com/questions/5244455/best-practices-for-sessionid-authentication-token-generation


以上所述就是小编给大家介绍的《SessionId /认证令牌生成的最佳做法》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。

The NSHipster Fake Book (Objective-C)

The NSHipster Fake Book (Objective-C)

Mattt Thompson / NSHipster Portland, Oregon / 2014 / USD 19.00

Fake Books are an indispensable tool for jazz musicians. They contain the melody, rhythm, and chord changes for hundreds of standards, allowing a player to jump into any session cold, and "fake it" th......一起来看看 《The NSHipster Fake Book (Objective-C)》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

URL 编码/解码
URL 编码/解码

URL 编码/解码