密码加密3种方法
一方面我有: http://forums.enterprisdb.com/posts/list/2481.page 这里我们将字段声明为 BYTEA,我们可以解密它,加密是在数据库级别的。
另一边: https://www.owasp.org/index.php/Hashing_Java 此处为 varchar,我们仅比较哈希值以进行授权。
最后 Spring 给出 http://static.springsource.org/spring-security/site/docs/3.1.x/apidocs/org/springframework/security/crypto/password/StandardPasswordEncoder.html + 每个密码应用的字符秘密值都相同吗?
哪种方法是最好的? (我倾向于 Spring,因为据我了解,它在几行代码中封装了与 OWASP 类似的逻辑?)
On one side I have:
http://forums.enterprisedb.com/posts/list/2481.page
Here we declare field as BYTEA and we can decrypt it and encryption is on db level.
On the other side:
https://www.owasp.org/index.php/Hashing_Java
Here as varchar and we only compare hashes to authorize.
Finally Spring gives http://static.springsource.org/spring-security/site/docs/3.1.x/apidocs/org/springframework/security/crypto/password/StandardPasswordEncoder.html + char secret value applied is the same for every password?
Which is the best approach? (I lean towards Spring since as I understand it encapsulates similar logic as OWASP in few lines of code?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PostgreSQL 编码:
OWASP 与 Spring:
StandardPasswordEncoder
。encode()
仅返回一个也包含 salt 的字符串(在 unix/linux 中通常如此),而 Owasp 需要一个附加的数据库属性来存储 salt 值。我会使用StandardPasswordEncoder。它更简单,并且与 Owasp 的功能相同。
PostgreSQL encoding:
OWASP vs Spring:
StandardPasswordEncoder
without secret.encode()
returns only one string which contains the salt too (as usual in unix/linux) while Owasp requires an additional database attribute for the salt value.I'd use
StandardPasswordEncoder
. It's more simple and does the same as Owasp.