# Rest Client - Encrypted Communication

**URL:** <https://discuss.elastic.co/t/rest-client-encrypted-communication/70888>\
**Category:** Elasticsearch\
**Created:** [January 8, 2017, 4:58pm UTC](https://discuss.elastic.co/t/rest-client-encrypted-communication/70888 "2017-01-08T16:58:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aditya\_tripathi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aditya_tripathi/32/1491_2.png) [@aditya\_tripathi](https://discuss.elastic.co/u/aditya_tripathi)\
**Post date:** [January 8, 2017, 4:58pm UTC](https://discuss.elastic.co/t/rest-client-encrypted-communication/70888/1 "2017-01-08T16:58:56Z")

</div>

This page: [https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/\_encrypted\_communication.html](https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/_encrypted_communication.html)  
hints at establishing encrypted communication by Rest Client with ES Cluster.

I was trying something around the given code in that page - using a SSLContext with KeyStoreManager and TrustManager. However I did not see any encrypted communication happening.

ES Cluster is running on Shield and basic HTTP authentication from HTTP client is working fine.

If I am hitting http port of ES Cluster, is it possible to get encrypted communication to ES Cluster with a HTTP/REST Client? Preferably using X509 certificates.

I could only find two ports - http and transport which are published by ES Cluster. The requirement is to use HTTP Client and establish secure communication with ES Cluster running on Shield. I understand we can wrap ES inside tomcat/nginx etc, Or use transport client with Shield enabled. But that is not the direction I am looking forward to currently.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 8, 2017, 5:08pm UTC](https://discuss.elastic.co/t/rest-client-encrypted-communication/70888/2 "2017-01-08T17:08:16Z")

</div>

You will need to enable SSL on the cluster, which will enable SSL on port 9200. Have you gone through the [documentation](https://www.elastic.co/guide/en/x-pack/current/encrypting-communications.html) describing how to do this?

---

<div class="post-metadata">

**Author:** ![aditya\_tripathi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aditya_tripathi/32/1491_2.png) [@aditya\_tripathi](https://discuss.elastic.co/u/aditya_tripathi)\
**Post date:** [January 11, 2017, 4:07am UTC](https://discuss.elastic.co/t/rest-client-encrypted-communication/70888/3 "2017-01-11T04:07:56Z")

</div>

Hi Christian,  
Thanks a lot for your answer. I had the ES cluster running on shield and had followed steps from Shield documentation. The problem lied somewhere else (I had not imported certificates of all nodes).

I could communicate over https using REST client 5.1 with Shield enbled ES Cluster (2.3.3).

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 8, 2017, 4:08am UTC](https://discuss.elastic.co/t/rest-client-encrypted-communication/70888/4 "2017-02-08T04:08:26Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
