How support multiple TrustStores in java SSL client application

In our java application we need to communicate with a list of servers on SSL using https protocol. The list of servers to communicate will change at runtime. Initially we do not have any of the server's certificate. At runtime, we will obtain a new server's certificate and add the public key certificate into a truststore; and any new https connection with the server should use the updated trust store.

We are thinking that we should use two trust stores, one cacerts(default one shipped with jre) and other containing certificates of the servers that we add/remove dynamically in a list. This will make sure that we do not modify the default TrustStore(cacerts) of java.

Please suggest how this can be achieved. Кроме того, есть ли способ использовать конкретное хранилище доверенных сертификатов только для определенного потока в java, чтобы другие (существующие и новые) потоки по-прежнему использовали хранилище Trueststore java по умолчанию (cacerts), а один конкретный поток будет использовать конкретное хранилище доверенных сертификатов для сервер.

Спасибо, Deepak

7
задан ninesided 9 September 2010 в 08:17
поделиться