0

I'm running a Powershell script that is updating a properties file in a java application and using Keytool to convert keys from PFX to JKS format.

I'm trying to convert a PFX to a JKS. I can't specify -"destalias" without specifying "-srcalias". The certificate being a PFX, I don't think it has an alias, but only a fingerprint.

However Keytool seems to see that the PFX has an Alias and it's using that value to auto-populate the Alias value of the JKS file.

I need the value of the Alias as a string to update my properties file.

Question:

Is there a way using Keytool or Powershell to either get the alias value from a PFX or a JKS as a String value.

Thank you!

1 Answers1

0

You can use this command

keytool -v -list -storetype pkcs12 -keystore x.pfx

To see the Alias , generally it will be some number like 1 or 2 , you can then use this in your command for "-srcalias"

Soumen Mukherjee
  • 2,615
  • 2
  • 18
  • 32
  • Thank you for your answer! But I need everything to be run by the script. Your solution involves me copying manually the alias value. – zied khmili Sep 25 '18 at 14:13
  • You can run the command within the script and parse out the value , see this stackoverflow question for more info https://stackoverflow.com/questions/13334422/pfx-to-jks-keytool-conversion-alias-does-not-exist – Soumen Mukherjee Sep 25 '18 at 14:16