org.keycloak.saml.processing.core.util

## Class KeyStoreUtil

- java.lang.Object
- - org.keycloak.saml.processing.core.util.KeyStoreUtil

-     public class KeyStoreUtil
      extends Object

  Utility to handle Java Keystore
  Since:
    Jan 12, 2009
  Author:
    Anil.Saldhana@redhat.com

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeyStoreUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addCertificate(File keystoreFile, char[] storePass, String alias, Certificate cert)` Add a certificate to the KeyStore
    `static KeyStore` | `getKeyStore(File keyStoreFile, char[] storePass)` Get the KeyStore
    `static KeyStore` | `getKeyStore(InputStream ksStream, char[] storePass)` Get the Key Store Note: This method wants the InputStream to be not null.
    `static KeyStore` | `getKeyStore(String fileURL, char[] storePass)` Get the Keystore given the url to the keystore file as a string
    `static KeyStore` | `getKeyStore(URL url, char[] storePass)` Get the Keystore given the URL to the keystore
    `static PublicKey` | `getPublicKey(KeyStore ks, String alias, char[] password)` Get the Public Key from the keystore

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### KeyStoreUtil

          public KeyStoreUtil()

  - ### Method Detail

    - #### getKeyStore

          public static KeyStore getKeyStore(File keyStoreFile,
                                             char[] storePass)
                                      throws GeneralSecurityException,
                                             IOException

      Get the KeyStore
      Parameters:
        `keyStoreFile` -
        `storePass` -
      Returns:
      Throws:
        `GeneralSecurityException`
        `IOException`

    - #### getKeyStore

          public static KeyStore getKeyStore(String fileURL,
                                             char[] storePass)
                                      throws GeneralSecurityException,
                                             IOException

      Get the Keystore given the url to the keystore file as a string
      Parameters:
        `fileURL` -
        `storePass` -
      Returns:
      Throws:
        `GeneralSecurityException`
        `IOException`

    - #### getKeyStore

          public static KeyStore getKeyStore(URL url,
                                             char[] storePass)
                                      throws GeneralSecurityException,
                                             IOException

      Get the Keystore given the URL to the keystore
      Parameters:
        `url` -
        `storePass` -
      Returns:
      Throws:
        `GeneralSecurityException`
        `IOException`

    - #### getKeyStore

          public static KeyStore getKeyStore(InputStream ksStream,
                                             char[] storePass)
                                      throws GeneralSecurityException,
                                             IOException

      Get the Key Store Note: This method wants the InputStream to be not null.
      Parameters:
        `ksStream` -
        `storePass` -
      Returns:
      Throws:
        `GeneralSecurityException`
        `IOException`
        `IllegalArgumentException` - if ksStream is null

    - #### getPublicKey

          public static PublicKey getPublicKey(KeyStore ks,
                                               String alias,
                                               char[] password)
                                        throws GeneralSecurityException

      Get the Public Key from the keystore
      Parameters:
        `ks` -
        `alias` -
        `password` -
      Returns:
      Throws:
        `GeneralSecurityException`

    - #### addCertificate

          public static void addCertificate(File keystoreFile,
                                            char[] storePass,
                                            String alias,
                                            Certificate cert)
                                     throws GeneralSecurityException,
                                            IOException

      Add a certificate to the KeyStore
      Parameters:
        `keystoreFile` -
        `storePass` -
        `alias` -
        `cert` -
      Throws:
        `GeneralSecurityException`
        `IOException`

Copyright © 2016 JBoss by Red Hat. All rights reserved.