Re: I can't find out a keystore password and private key password for java.

Solved! Go to solution
holylance82
Regular Visitor

I can't find out a keystore password and private key password for java.

ApiClient apiClient = new ApiClient();
// Configure HTTP basic authorization: basicAuth
apiClient.setUsername("YOUR USERNAME");
apiClient.setPassword("YOUR PASSWORD");
apiClient.setKeystorePath("YOUR KEYSTORE PATH");
apiClient.setKeystorePassword("YOUR KEYSTORE PASSWORD");
apiClient.setPrivateKeyPassword("YOUR PRIVATEKEY PASSWORD");

When developers use the api client, the developers have to enter these id and password.

I know username, password and keystore path.

However, I could not find out a keystore password and private key password because, I did not set the password before.

 

How can I get the passwords?

Please teach me about it.

Thank you in advance.

2 REPLIES 2
jvenkata
Community Moderator

Re: I can't find out a keystore password and private key password for java.

Hi,

 

A keystore is a repository where private keys and certificates can be stored. Please use below command to generate key store. 

 

At the time of generating the key store you will provide a password and the same can be used in the ApiClient.java

 

openssl pkcs12 -export -in cert.pem -inkey privateKey.pem -out myproject_keyAndCertBundle.p12

 

If you need JKS, then you can convert the above .p12 to .JKS file using the below keytool command

 

keytool -importkeystore -srckeystore myproject_keyAndCertBundle.p12 -srcstoretype PKCS12 -destkeystore myproject_keyAndCertBundle.jks

 

Please see below comments inline in the code. Let me know if you have any further questions.

 

apiClient.setKeystorePath("YOUR KEYSTORE PATH"); - Path to JKS file
apiClient.setKeystorePassword("YOUR KEYSTORE PASSWORD"); - JKS Password
//apiClient.setPrivateKeyPassword("YOUR PRIVATEKEY PASSWORD"); - Comment this line

Thanks,
Jai

 

paul_earnest
Regular Contributor

Re: I can't find out a keystore password and private key password for java.

Thank you Jai !

 

Your answer helped me to get the transaction query api client be executed successfully.

 

Regards,

Paul