增加resttemplate的https功能
This commit is contained in:
parent
1e46b1079b
commit
0801addf03
@ -15,6 +15,17 @@ import java.security.cert.X509Certificate;
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/3/28 17:34
|
||||
* @Version: 1.0
|
||||
* TLS的三个作用:
|
||||
* (1)身份认证
|
||||
* 通过证书认证来确认对方的身份,防止中间人攻击
|
||||
* (2)数据私密性
|
||||
* 使用对称性密钥加密传输的数据,由于密钥只有客户端/服务端有,其他人无法窥探。
|
||||
* (3)数据完整性
|
||||
* 使用摘要算法对报文进行计算,收到消息后校验该值防止数据被篡改或丢失。
|
||||
*
|
||||
* 使用RestTemplate进行HTTPS请求访问:
|
||||
* private static RestTemplate restTemplate = new RestTemplate(new HttpsClientRequestFactory());
|
||||
*
|
||||
*/
|
||||
public class HttpsClientRequestFactory extends SimpleClientHttpRequestFactory {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user