Developement/Java
apache httpclient에서 ssl 처리
highheat
2020. 10. 8. 01:20
javax.net.ssl.SSLException: Certificate doesn't match any of the subject alternative names
apache httpclient로 ssl을 연동한 연결을 하는 경우 위와 같은 에러가 발생합니다.
SSLConnectionSocketFactory scsf = new SSLConnectionSocketFactory(
SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build(),
NoopHostnameVerifier.INSTANCE)
httpclient = HttpClients.custom().setSSLSocketFactory(scsf).build()
버전은 4.* 기준입니다.