How to fix 'SSLHandshakeException: Received fatal alert: decode_error'?

后端 未结 2 1169
礼貌的吻别
礼貌的吻别 2021-01-21 19:15

We have a java application that reads our customers public calendars - for example from google (https://calendar.google.com/calendar/ical/...) or icloud (webcal://p58-caldav.icl

2条回答
  •  面向向阳花
    2021-01-21 19:46

    I faced Received fatal alert: decode_error while connecting with apple cloud urls. I was able to fix it by explicitly setting the protocol as TLS 1.2.

    For eg: in kotlin update your spring RestTemplate as below ,

    fun restTemplateWithTLS12(): RestTemplate { val requestFactory = HttpComponentsClientHttpRequestFactory() val sslContext = SSLContexts.custom().setProtocol("TLSv1.2").build() val clientBuilder = HttpClients.custom().setSSLSocketFactory(SSLConnectionSocketFactory(sslContext)) requestFactory.httpClient = clientBuilder.build() return RestTemplate(requestFactory) }

提交回复
热议问题