The problem is certificates...Is necesary use loadRootCertificates()?
Yes, if you turn on server validation then you must load one or more root certificates using the
loadRootCertificates()
method, otherwise the client will have nothing to validate the server against. This file may simply contain the certificate of the server in base-64 format, or, if the certificate was issued by a CA then it may contain the certificate of the CA.
A certificate in base-64 format looks something like this:
-----BEGIN CERTIFICATE-----
MIIE5zCCA8+gAwIBAgIBADANBgkqhkiG9w0BAQQFADCBrTELMAkGA1UEBhMCVUsx
EDAOBgNVBAgTB0VuZ2xhbmQxDzANBgNVBAcTBkxvbmRvbjEwMC4GA1UEChMnRW50
ZXJwcmlzZSBEaXN0cmlidXRlZCBUZWNobm9sb2dpZXMgTHRkMQwwCgYDVQQLEwNG
VFAxEjAQBgNVBAMTCWxvY2FsaG9zdDEnMCUGCSqGSIb3DQEJARYYc3VwcG9ydEBl
bnRlcnByaXNlZHQuY29tMB4XDTA0MDUwNDEwMDYyM1oXDTA3MDUwNDEwMDYyM1ow
ga0xCzAJBgNVBAYTAlVLMRAwDgYDVQQIEwdFbmdsYW5kMQ8wDQYDVQQHEwZMb25k
b24xMDAuBgNVBAoTJ0VudGVycHJpc2UgRGlzdHJpYnV0ZWQgVGVjaG5vbG9naWVz
IEx0ZDEMMAoGA1UECxMDRlRQMRIwEAYDVQQDEwlsb2NhbGhvc3QxJzAlBgkqhkiG
9w0BCQEWGHN1cHBvcnRAZW50ZXJwcmlzZWR0LmNvbTCCASIwDQYJKoZIhvcNAQEB
BQADggEPADCCAQoCggEBANNI+JqiCU+4a1wc449I7c6qhvksZydXk9zzuQguGrGq
oP00Zrt8cnoOkKJnAmF/KhpLYlSEc/fC8O+1i3kllJPex7UPHeNnisO5+Njz8b7/
dmMvkQKNGWfPTtWeBwguI/H5+S8rRNv7xaFDgJJYJLsAElaWqBkh4w9uLhFtc3+b
2j674EaxTjcBeN1btCkr7z5MRBBo3YTj1jcZQmHfNbZC3243qJHt0L823JQ2Rt/s
UMl63JOm5tds7se6HYeEa3GvUqH7NCyejiemO5DJFvk2RcHXUGhWlhimFawbXBGb
eBIzggnDQkAVMDwczK5dUaEMyCiV9AiiOG5Li/R589UCAwEAAaOCAQ4wggEKMB0G
-----END CERTIFICATE-----
Please let us know if you have trouble with this.
- Hans (EDT Support)