Extract alias from keystore

The alias is used when referring a specific certificate from a keystore.

The alias may be retrieved in different ways, depending on tools that are available.

Powershell

The following Powershell script can be used in order to retrieve the alias:

$folder = "C:\temp"           ## Folder where the certificate is located
$filename = "certificate.pfx" ## Filename of the certificate
$pwd = "password"             ## Password for the pfx-file

$pfx = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$pfx.Import($folder+"\"+$filename, $pwd, "Exportable,PersistKeySet")
Write-host "Keystore alias = "$pfx.FriendlyName

Keytool

The following command can be used:

keytool -list -keystore -v /path/to/keystore

Windows example:

"C:\Program Files\FortifiedID\mgmt-center\jre\bin\keytool.exe" -list -v -keystore "C:\Program Files\FortifiedID\mgmt-center\data\customer\forms\resources\certificate.pfx" | findstr Alias

Last updated