org.openpermis.cert
Class KeystoreUtility

java.lang.Object
  extended by org.openpermis.cert.KeystoreUtility

public final class KeystoreUtility
extends Object

Some useful keystore operations.

Since:
0.9.0

Method Summary
static KeyStore createKeystoreFromFile(String inputKeyStore, String inputPassword)
          Creates a KeyStore from a file.
static KeyStore createKeystoreFromInputStream(InputStream inputStream, String inputPassword)
          Creates a KeyStore from an input stream.
static X509Certificate getCertificate(KeyStore keystore, String alias)
          Returns a X509Certificate in this key store.
static PrivateKey getPrivateKey(KeyStore keystore, String alias, String inputPassword)
          Gets a private key from a keystore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPrivateKey

public static PrivateKey getPrivateKey(KeyStore keystore,
                                       String alias,
                                       String inputPassword)
                                throws KeystoreUtilityException
Gets a private key from a keystore.

Parameters:
keystore - the keystore.
alias - the alias.
inputPassword - the password.
Returns:
the private key.
Throws:
KeystoreUtilityException - if private key could not be retrieved.
Since:
0.9.0

createKeystoreFromFile

public static KeyStore createKeystoreFromFile(String inputKeyStore,
                                              String inputPassword)
                                       throws KeystoreUtilityException
Creates a KeyStore from a file.

Parameters:
inputKeyStore - the file path.
inputPassword - the password.
Returns:
the created KeyStore.
Throws:
KeystoreUtilityException - if the KeyStore could not be created.
Since:
0.9.0

createKeystoreFromInputStream

public static KeyStore createKeystoreFromInputStream(InputStream inputStream,
                                                     String inputPassword)
                                              throws KeystoreUtilityException
Creates a KeyStore from an input stream.

Parameters:
inputStream - the input stream.
inputPassword - the password.
Returns:
the created KeyStore.
Throws:
KeystoreUtilityException - if the KeyStore could not be created.
Since:
0.9.0

getCertificate

public static X509Certificate getCertificate(KeyStore keystore,
                                             String alias)
                                      throws KeystoreUtilityException
Returns a X509Certificate in this key store.

Parameters:
keystore - the keystore.
alias - the alias of the certificate.
Returns:
a X509Certificate.
Throws:
KeystoreUtilityException - if the X509Certificate could not be returned.
Since:
0.9.0


OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:16:59
Copyright (c) 2002-2007 Ergon Informatik AG