摘要:
我看到有人使用UUID進行認證令牌生成.然而,在RFC 4122
年,它表示
Do not assume that UUIDs are hard to guess; they should not be usedas security capabilities (...
我看到有人使用UUID進行認證令牌生成.然而,在
ofollow,noindex" target="_blank">RFC 4122
年,它表示
Do not assume that UUIDs are hard to guess; they should not be usedas security capabilities (identifiers whose mere possession grantsaccess), 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