PicketLink Federation Core 2.1.6.Final-redhat-2

org.picketlink.identity.federation.core.util
Class KeyStoreUtil

java.lang.Object
  extended by org.picketlink.identity.federation.core.util.KeyStoreUtil

public class KeyStoreUtil
extends Object

Utility to handle Java Keystore

Since:
Jan 12, 2009
Author:
Anil.Saldhana@redhat.com

Constructor Summary
KeyStoreUtil()
           
 
Method Summary
static void addCertificate(File keystoreFile, char[] storePass, String alias, Certificate cert)
          Add a certificate to the KeyStore
static KeyPair generateKeyPair(String algo)
          Generate a Key Pair
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

generateKeyPair

public static KeyPair generateKeyPair(String algo)
                               throws GeneralSecurityException
Generate a Key Pair

Parameters:
algo - (RSA, DSA etc)
Returns:
Throws:
GeneralSecurityException

getPublicKey

public static PublicKey getPublicKey(KeyStore ks,
                                     String alias,
                                     char[] password)
                              throws KeyStoreException,
                                     NoSuchAlgorithmException,
                                     GeneralSecurityException
Get the Public Key from the keystore

Parameters:
ks -
alias -
password -
Returns:
Throws:
GeneralSecurityException
KeyStoreException
NoSuchAlgorithmException

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

PicketLink Federation Core 2.1.6.Final-redhat-2

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.