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

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

内容简介: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 Little MLer

The Little MLer

Matthias Felleisen、Daniel P. Friedman、Duane Bibby、Robin Milner / The MIT Press / 1998-2-19 / USD 34.00

The book, written in the style of The Little Schemer, introduces instructors, students, and practicioners to type-directed functional programming. It covers basic types, quickly moves into datatypes, ......一起来看看 《The Little MLer》 这本书的介绍吧!

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

RGB HEX 互转工具

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码