org.jboss.identity.federation.bindings.util.cert
Class KeyStoreUtil

java.lang.Object
  extended by org.jboss.identity.federation.bindings.util.cert.KeyStoreUtil

public class KeyStoreUtil
extends java.lang.Object

Utility to handle Java Keystore

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

Constructor Summary
KeyStoreUtil()
           
 
Method Summary
static java.security.KeyPair generateKeyPair(java.lang.String algo)
          Generate a Key Pair
static java.security.KeyStore getKeyStore(java.io.InputStream ksStream, char[] storePass)
          Get the Key Store Note: This method wants the InputStream to be not null.
static java.security.KeyStore getKeyStore(java.lang.String fileURL, char[] storePass)
          Get the Keystore given the url to the keystore file as a string
static java.security.KeyStore getKeyStore(java.net.URL url, char[] storePass)
          Get the Keystore given the URL to the keystore
static java.security.PublicKey getPublicKey(java.security.KeyStore ks, java.lang.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 java.security.KeyStore getKeyStore(java.lang.String fileURL,
                                                 char[] storePass)
                                          throws java.security.GeneralSecurityException,
                                                 java.io.IOException
Get the Keystore given the url to the keystore file as a string

Parameters:
fileURL -
storePass -
Returns:
Throws:
java.security.GeneralSecurityException
java.io.IOException

getKeyStore

public static java.security.KeyStore getKeyStore(java.net.URL url,
                                                 char[] storePass)
                                          throws java.security.GeneralSecurityException,
                                                 java.io.IOException
Get the Keystore given the URL to the keystore

Parameters:
url -
storePass -
Returns:
Throws:
java.security.GeneralSecurityException
java.io.IOException

getKeyStore

public static java.security.KeyStore getKeyStore(java.io.InputStream ksStream,
                                                 char[] storePass)
                                          throws java.security.GeneralSecurityException,
                                                 java.io.IOException
Get the Key Store Note: This method wants the InputStream to be not null.

Parameters:
ksStream -
storePass -
Returns:
Throws:
java.security.GeneralSecurityException
java.io.IOException
java.lang.IllegalArgumentException - if ksStream is null

generateKeyPair

public static java.security.KeyPair generateKeyPair(java.lang.String algo)
                                             throws java.lang.Exception
Generate a Key Pair

Parameters:
algo - (RSA, DSA etc)
Returns:
Throws:
java.lang.Exception

getPublicKey

public static java.security.PublicKey getPublicKey(java.security.KeyStore ks,
                                                   java.lang.String alias,
                                                   char[] password)
                                            throws java.lang.Exception
Get the Public Key from the keystore

Parameters:
ks -
alias -
password -
Returns:
Throws:
java.lang.Exception


Copyright © 2009 JBoss Inc.. All Rights Reserved.