HTTP 基本身份验证中的 Base 64 编码
我想知道使用 HTTP 基本身份验证时以 Base 64 编码字符串:“login:password”的目的是什么。
- Base 64 通常用于通过纯 ASCII 协议发送二进制数据。但是登录:密码已经是一个字符串
- 它几乎没有增加安全性
- 输出比输入长,所以它不会提高性能
我可能错过了一些东西,因为目前在我看来这种编码只是增加了不必要的复杂性层。
谢谢
I am wondering what is the purpose of encoding the String: "login:password" in base 64 when using HTTP Basic Auth.
- Base 64 is usually used to send binary data through ASCII only protocols. But the login:password is already a String
- It adds practically no security
- The output is longer than the input, so it does not improve performances
I am probably missing something since it does currently seems to me that this encoding just adds an unneeded layer of complexity.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
来自http://en.wikipedia.org/wiki/Basic_access_authentication
From http://en.wikipedia.org/wiki/Basic_access_authentication
我的第一个想法是,它以 Base64 进行编码,只是为了让它不那么明显,它实际上是一个用户名和密码。
其次,人们可以在密码中放入各种奇怪的字符——如果愿意的话,用 Base64 对其进行编码可以使数据采用一种不太“混乱”的格式。
此外,Base64 字符串输出的长度可以忽略不计;几个额外的数据包不会明显降低性能。
来自维基百科:
维基百科似乎证实了我最初的想法。干杯!
My first thought is that it's encoded in Base64 simply to make it less blatantly obvious that it's actually a username and a password.
Secondly, people can put all sorts of strange characters in their passwords -- encoding it in Base64 puts the data in a format that is less "messy", if you will.
Also, the length of the output in the Base64 string is fairly negligible; a couple extra packets of data isn't going to degrade performance any noticeable amount.
From Wikipedia:
Wikipedia seems to confirm my initial thoughts. Cheers!
使用 Base64 编码后,通常会通过 SSL 连接进行连接,然后加密编码的用户名和密码以提高安全性。
The encoding with base64 is usually followed up by connecting through an SSL connection, which will then encrypt the encoded username and password for additional security.