Forum Stats

  • 3,757,146 Users
  • 2,251,201 Discussions
  • 7,869,743 Comments

Discussions

How to fetch Certificate (.jks file) stored in Secure Credentials Vault (SCV) using Java.

How to fetch Certificate (.jks file) stored in Secure Credentials Vault (SCV) using Java.

I had searched internet and found that we can get certificate like this for Keyvault:

KeyVaultClient keyVaultClient = new KeyVaultClient(credentials);

keyVaultClient.getCertificate(this.keyVaultUri, certificateName, '');


However, I don't know how to do this for Secure Credentials Vault (SCV).

1) How to pass credentials to Vault Client?

2) Do I have to use Secure Credentials Vault (SCV) credentials in the code?


KeyStore keyStore = KeyStore.getInstance("JKS");


//I have to get this .jks file from SCV


keyStore.load(new FileInputStream(".jks file"), 

keyPassphrase.toCharArray());


SSLContext sslContext = SSLContexts.custom()

  .loadKeyMaterial(keyStore, keyPassphrase.toCharArray())

  .build();


HttpClient httpClient = 

HttpClients.custom().setSSLContext(sslContext).build();