You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by 12...@gmail.com, 12...@gmail.com on 2019/03/25 08:56:32 UTC

Create SSL Kafka AdminClient object using keystore.jks from database


I need to create kafkaAmdinClient SSL object using java.security.keystore object. i.e I have to read the keystore and truststore files from database as a clob and get the keystore in java.security.keystore object and use this to create Admin client object.

I am able to create AdminClient object using properties object :

props.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, trustStorePwd);
            props.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, "/ngs/app/bolt_components/kafka_ssl/RN_BC_YELLOWBIRD/client.truststore.jks");
            props.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, keyStorePwd);
                            kafkaAdminClient = AdminClient.create(props);

But as per requiremtn i should not specify keystore file location. Instead specify keystore object.

KeyStoreDto kDto=KeystoreManager.getKafkaKeyStoreDto(kafkaDto.getKEYSTORE_ID());
            java.security.KeyStore keyStore = kDto.getKeyStore();
            java.security.KeyStore trustStore = kDto.getTrustStore();
            String keyStorePwd=kDto.getKeyStorePassword();
            String trustStorePwd=kDto.getTrustStorePassword();

From this i have to use keyStore and trustStore.

Can anyone help me with this.

Is there any other way in which keystore.jks file can be used to create AdminClient object in Kafka through java code if keystore.jks is stored in DB? Any workaround?