This commit is contained in:
Looly
2023-03-11 19:42:04 +08:00
parent fb7e88515a
commit d80747f9d5
13 changed files with 358 additions and 227 deletions

View File

@@ -13,6 +13,7 @@ import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
/**
* {@link SSLContext}构建器,可以自定义:<br>
* <ul>

View File

@@ -0,0 +1,22 @@
package cn.hutool.core.net.ssl;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
/**
* https 域名校验,信任所有域名
*
* @author Looly
*/
public class TrustAnyHostnameVerifier implements HostnameVerifier {
/**
* 单例对象
*/
public static TrustAnyHostnameVerifier INSTANCE = new TrustAnyHostnameVerifier();
@Override
public boolean verify(final String hostname, final SSLSession session) {
return true;// 直接返回true
}
}