Where The Streets Have No Name

apache httpclient에서 ssl 처리 본문

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.* 기준입니다.

참고 : stackoverflow.com/questions/39762760/javax-net-ssl-sslexception-certificate-doesnt-match-any-of-the-subject-alterna