Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- react
- Android
- NPM
- xPlatform
- mybatis
- Express
- SQL
- MSSQL
- es6
- Kotlin
- vaadin
- Eclipse
- Spring
- Java
- mapreduce
- JavaScript
- plugin
- table
- GIT
- SPC
- window
- hadoop
- 보조정렬
- 공정능력
- IntelliJ
- Python
- tomcat
- SSL
- R
- Sqoop
Archives
- Today
- Total
DBILITY
java.security.cert.CertificationException : No subject alternative DNS name matching "xxx" found 본문
java
java.security.cert.CertificationException : No subject alternative DNS name matching "xxx" found
DBILITY 2022. 8. 11. 11:27반응형
hostname verifier에러에 그냥 구글 검색으로 대응했다.
기록해 두자.
try {
URL url = new URL(requestURL);
TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType){
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
} };
HostnameVerifier hostnameVerifier = new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
};
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new SecureRandom());
HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier);
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
httpConn = (HttpsURLConnection) url.openConnection();
} catch( Exception e) {
System.out.println(e.toString());
}
반응형
'java' 카테고리의 다른 글
java substring usage (0) | 2022.08.25 |
---|---|
java 7 multiple exception catch (0) | 2016.10.04 |
Comments