HTTP | MDN (mozilla.org)
HTTP authentication - HTTP | MDN (mozilla.org)
Using HTTP cookies - HTTP | MDN (mozilla.org)
Using HTTP cookies&secure - HTTP | MDN (mozilla.org)
核对的信息通常是指以下这些。
HTTP/1.1 使用的认证方式:
BASIC 认证(基本认证)
DIGEST 认证(摘要认证)
SSL 客户端认证(证书认证)
FormBase 认证(基于表单认证)
通信使用明文(不加密),内容可能会被窃听
不验证通信方的身份,因此有可能遭遇伪装
无法证明报文的完整性,所以有可能已遭篡改
这些问题不仅在 HTTP 上出现,其他未加密的协议中也会存在这类问题。
- 公钥(Public Key)与私钥(Private Key)是通过加密算法得到的一个密钥对(即一个公钥和一个私钥,也就是非对称加密方式)。
- 公钥可对会话进行加密、验证数字签名,只有使用对应的私钥才能解密会话数据,从而保证数据传输的安全性。
公钥是密钥对外公开的部分,
私钥则是密钥的非公开的部分,由用户自行保管。
- 通过加密算法得到的密钥对可以保证在世界范围内是唯一的。
- 使用密钥对的时候,如果用**其中一个密钥(公钥或者私钥)加密一段数据**,只能使用密钥对中的另一个密钥才能解密数据。
- 例如:用公钥加密的数据必须用对应的私钥才能解密;
- 如果用私钥进行加密也必须使用对应的公钥才能解密,否则将无法成功解密。
区分共享密钥和公共密钥
知道了共享密钥和公共密钥的基本概念,再看它们的组合应用来节约开销
遗憾的是,公开密钥加密方式还是存在一些问题的。
那就是无法证明公开密钥本身就是货真价实的公开密钥。
为了解决上述问题,可以使用由数字证书认证机构(CA,Certificate Authority)和其相关机关颁发的公开密钥证书。
关键:
- 机构对要公开的密钥做数字签名
- 客户端要用机构公开的public key(可以是事先植入浏览器的key)验证机构签名
SSL证书采用公钥体制,即利用一对互相匹配的密钥对进行数据加密和解密。
每个用户自己设定一把特定的、仅为本人所知的私有密钥(私钥),并用它进行解密和签名;
同时设定一把公共密钥(公钥)并由本人公开,为一组用户所共享,用于加密和验证签名。
由于密钥仅为本人所有,可以产生其他人无法生成的加密文件,也就是形成了数字签名。
公开密钥加密方式很好地解决了共享密钥加密的困难。
虽然使用 HTTP 协议无法确定通信方,但如果使用 SSL 则可以。
SSL 不仅提供加密处理,而且还使用了一种被称为证书的手段,可用于确定对方。
所以只要能够确认通信方(服务器或客户端)持有的证书,即可判断通信方的真实意图。
In cryptography: [krɪpˈtɑɡrəfi], a public key certificate, also known as a digital certificate or identity certificate, is an electronic document used to prove the validity of a public key.[1]
The certificate includes information about the key, information about the identity of its owner (called the subject身份主体), and the digital signature of an entity that has verified the certificate’s contents (called the issuer发行机构).
If the signature is valid, and the software examining the certificate trusts the issuer, then it can use that key to communicate securely with the certificate’s subject.
In email encryption, code signing, and e-signature systems, a certificate’s subject is typically a person or organization.
However, in Transport Layer Security (TLS) a certificate’s subject is typically a computer or other device, though TLS certificates may identify organizations or individuals in addition to their core role in identifying devices.
TLS, sometimes called by its older name Secure Sockets Layer (SSL), is notable for being a part of HTTPS, a protocol for securely browsing the web.(TLS有时候仍被称呼为SSL)
In a typical public-key infrastructure (PKI) scheme, the certificate issuer is a certificate authority (CA),[2] usually a company that charges customers to issue certificates for them.
By contrast, in a web of trust scheme, individuals sign each other’s keys directly, in a format that performs a similar function to a public key certificate.
In cryptography, a web of trust is a concept used in PGP, GnuPG, and other OpenPGP-compatible systems to establish the authenticity of the binding between a public key and its owner. Its decentralized trust model is an alternative to the centralized trust model of a public key infrastructure (PKI), which relies exclusively on a certificate authority (or a hierarchy of such). As with computer networks, there are many independent webs of trust, and any user (through their public key certificate) can be a part of, and a link between, multiple webs.
The web of trust concept was first put forth by PGP creator Phil Zimmermann in 1992 in the manual for PGP version 2.0:
As time goes on, you will accumulate keys from other people that you may want to designate as trusted introducers. Everyone else will each choose their own trusted introducers. And everyone will gradually accumulate and distribute with their key a collection of certifying signatures from other people, with the expectation that anyone receiving it will trust at least one or two of the signatures. This will cause the emergence of a decentralized fault-tolerant web of confidence for all public keys.
The most common format for public key certificates is defined by X.509.[3]
可证明组织真实性的EV SSL证书
SSL协议现已废弃:(SSL->TLS)
Transport Layer Security (TLS), the successor of the now-deprecated Secure Sockets Layer (SSL), is a cryptographic protocol designed to provide communications security over a computer network.
HTTPS was used with the SSL protocol. As SSL evolved into Transport Layer Security (TLS),
传输层安全性协议(英语:Transport Layer Security,缩写:TLS)及其前身安全套接层(英语:Secure Sockets Layer,缩写:SSL)是一种安全协议,目的是为互联网通信提供安全及数据完整性保障。
网景公司(Netscape)在1994年推出首版网页浏览器-网景导航者时,推出HTTPS协议,以SSL进行加密,这是SSL的起源。
SSL包含记录层(Record Layer)和传输层,记录层协议确定传输层数据的封装格式。
传输层安全协议使用X.509认证,之后
为达到 SSL 客户端认证的目的,需要事先将客户端证书分发给客户端。
步骤 1:
服务器接收到需要认证资源的请求,会发送 Certificate Request 报文,要求客户端提供客户端证书。
步骤 2:
用户选择要发送的客户端证书后,客户端会把客户端证书信息以 Client Certificate 报文方式发送给服务器。
步骤 3:
服务器验证客户端证书验证通过后方可领取证书内客户端的公开密钥,然后开始 HTTPS 加密通信。
- 如果在 HTTP 协议通信过程中使用未经加密的明文
- 另外,对于 HTTP 来说,服务器也好,客户端也好,都是没有办法确认通信方的。
- 很有可能并不是和原本预想的通信方在实际通信。
- 并且还需要考虑到接收到的报文在通信途中已经遭到篡改这一可能性。
为了统一解决上述这些问题,需要在 HTTP 上再加入加密处理和认证等机制。
我们把添加了加密及认证机制的 HTTP 称为 HTTPS(HTTP Secure)
HTTP 协议中没有加密机制,但可以通过和 SSL(Secure Socket Layer,安全套接层)或 TLS(Transport Layer Security,安全层传输协议)的组合使用,加密 HTTP 的通信内容。
用 SSL 建立安全通信线路之后,就可以在这条线路上进行 HTTP通信了。
与 SSL 组合使用的 HTTP 被称为 HTTPS(HTTP Secure,超文本传输安全协议)或 HTTP over TLS (早期:HTTP over SSL)。
HTTPS 协议是由 HTTP 加上 TLS/SSL 协议构建的可进行加密传输、身份认证的网络协议,主要通过数字证书、加密算法、非对称密钥等技术完成互联网数据传输加密,实现互联网传输安全保护。
设计目标主要有三个。
(1)数据保密性:保证数据内容在传输的过程中不会被第三方查看。就像快递员传递包裹一样,都进行了封装,别人无法获知里面装了什么 。
(2)数据完整性:及时发现被第三方篡改的传输内容。就像快递员虽然不知道包裹里装了什么东西,但他有可能中途调包,数据完整性就是指如果被掉包,我们能轻松发现并拒收
接收到的内容可能有误:
(3)身份校验安全性:保证数据到达用户期望的目的地。就像我们邮寄包裹时,虽然是一个封装好的未掉包的包裹,但必须确定这个包裹不会送错地方,通过身份校验来确保送对了地方 。
- Hypertext Transfer Protocol Secure (HTTPS) is an extension of the Hypertext Transfer Protocol (HTTP).
- It is used for secure communication over a computer network, and is widely used on the Internet.[1][2]
- In HTTPS, the communication protocol is encrypted using Transport Layer Security (TLS) or, formerly, Secure Sockets Layer (SSL).
- The protocol is therefore also referred to as HTTP over TLS,[3] or HTTP over SSL.
- The principal motivations for HTTPS are
- authentication of the accessed website, and
- protection of the privacy and integrity of the exchanged data while in transit.
- It protects against man-in-the-middle attacks, and the bidirectional encryption of communications between a client and server protects the communications against eavesdropping and tampering.[4][5]
- The authentication aspect of HTTPS requires a trusted third party to sign server-side digital certificates.
- This was historically an expensive operation, which meant fully authenticated HTTPS connections were usually found only on secured payment transaction services and other secured corporate information systems on the World Wide Web.
- In 2016, a campaign by the Electronic Frontier Foundation with the support of web browser developers led to the protocol becoming more prevalent.[6] (流行)
- HTTPS is now used more often by web users than the original non-secure HTTP, primarily to protect page authenticity on all types of websites;
- secure accounts;
- and to keep user communications, identity, and web browsing private.