跳到主要内容

5. Examples

5. Examples

Figures 6, 7, and 8 illustrate example exchanges. Note that TLS ciphersuites using a Diffie-Hellman exchange offering forward secrecy can be used with a raw public key, although this document does not show the information exchange at that level with the subsequent message flows.

5.1. TLS Server Uses a Raw Public Key

本节展示一个示例, 其中 TLS 客户端表明其能够接收并验证来自服务器的原始公钥. 在此示例中, 客户端限制较多, 因为它无法处理服务器发送的其他证书类型. 它在 TLS 层也没有可发送给服务器的凭据, 因而省略 client_certificate_type 扩展. 因此, 如 (1) 所示, 客户端只用原始公钥类型填充 server_certificate_type 扩展.

When the TLS server receives the client hello, it processes the extension. Since it has a raw public key, it indicates in (2) that it had chosen to place the SubjectPublicKeyInfo structure into the Certificate payload (3).

The client uses this raw public key in the TLS handshake together with an out-of-band validation technique, such as DANE, to verify it.

  client_hello,
server_certificate_type=(RawPublicKey) // (1)
->
<- server_hello,
server_certificate_type=RawPublicKey, // (2)
certificate, // (3)
server_key_exchange,
server_hello_done

client_key_exchange,
change_cipher_spec,
finished ->

<- change_cipher_spec,
finished

Application Data <-------> Application Data

Figure 6: Example with Raw Public Key Provided by the TLS Server

5.2. TLS Client and Server Use Raw Public Keys

本节展示 TLS 客户端和 TLS 服务器都使用原始公钥的示例. 这是为智能对象网络设想的用例之一. 在此情况下, TLS 客户端是一个嵌入式设备, 已配置用于 TLS 的原始公钥, 并且也能够处理服务器发送的原始公钥. 因此, 它在 (1) 中表明这些能力. 与前一个示例一样, 服务器满足客户端请求, 通过 server_certificate_type 载荷 (2) 中的 RawPublicKey 值表明这一点, 并在 Certificate 载荷中向客户端提供原始公钥 (见 (3)). TLS 服务器要求客户端认证, 因而包含 certificate_request (4). (5) 中的 client_certificate_type 载荷表明 TLS 服务器接受原始公钥. 已预配置原始公钥的 TLS 客户端在 Certificate 载荷 (6) 中将其返回给服务器.

client_hello,
client_certificate_type=(RawPublicKey) // (1)
server_certificate_type=(RawPublicKey) // (1)
->
<- server_hello,
server_certificate_type=RawPublicKey // (2)
certificate, // (3)
client_certificate_type=RawPublicKey // (5)
certificate_request, // (4)
server_key_exchange,
server_hello_done

certificate, // (6)
client_key_exchange,
change_cipher_spec,
finished ->

<- change_cipher_spec,
finished

Application Data <-------> Application Data

Figure 7: Example with Raw Public Key provided by the TLS Server and the Client

5.3. Combined Usage of Raw Public Keys and X.509 Certificates

本节展示结合原始公钥和 X.509 证书的示例. 客户端使用原始公钥进行客户端认证, 服务器提供 X.509 证书. 此交换从客户端表明其能够处理服务器提供的 X.509 证书, OpenPGP 证书或原始公钥开始. 它偏好原始公钥, 因为 RawPublicKey 值在 server_certificate_type 向量中位于其他值之前. 此外, 客户端表明它拥有用于客户端侧认证的原始公钥 (见 (1)). 服务器选择在 (3) 中提供其 X.509 证书, 并在 (2) 中指示该选择. 对于客户端认证, 服务器在 (4) 中指示已选择原始公钥格式, 并在 (5) 中请求客户端提供证书. TLS 客户端在接收并处理 TLS server hello 消息后, 在 (6) 中提供原始公钥.

client_hello,
server_certificate_type=(RawPublicKey, X.509, OpenPGP)
client_certificate_type=(RawPublicKey) // (1)
->
<- server_hello,
server_certificate_type=X.509 // (2)
certificate, // (3)
client_certificate_type=RawPublicKey // (4)
certificate_request, // (5)
server_key_exchange,
server_hello_done
certificate, // (6)
client_key_exchange,
change_cipher_spec,
finished ->

<- change_cipher_spec,
finished

Application Data <-------> Application Data

Figure 8: Hybrid Certificate Example