Class KeyStoreUtil

java.lang.Object
org.forgerock.openig.util.KeyStoreUtil

public final class KeyStoreUtil extends Object
Utility class to retrieve private keys from KeyStore.
  • Method Details

    • getKey

      public static Key getKey(KeyStore keyStore, String alias, String password)
      Retrieves a PrivateKey or a SecretKey from a KeyStore.
      Parameters:
      keyStore - The storage facility for cryptographic keys and certificates to search for the given key.
      alias - The alias associated with the key.
      password - The password for recovering the key.
      Returns:
      a Key or an IllegalArgumentException if it fails.
      Throws:
      IllegalArgumentException - If the key was not retrieved or if an exception occurred.
    • storeTypeFromKeyStore

      public static String storeTypeFromKeyStore(String filename)
      Get default keystore type based on the keystore filename.
      Parameters:
      filename - name of the keystore file with extension
      Returns:
      default store type for the given filename or "PKCS12" if no default available.