eu.emi.client.security.util
Class KeystoreUtil

java.lang.Object
  extended by eu.emi.client.security.util.KeystoreUtil

public class KeystoreUtil
extends Object


Method Summary
static KeyStore createKeyStore(String name, String passwd, String type)
           
static String getDefaultKeyAlias(ISecurityProperties sec)
           
static String[] getTrustedCertDNs(KeyStore ks)
           
static KeyStore loadKeyStore(String name, String passwd, String type)
          loads keystore from a file TODO this code can be replaced by the future authn lib
static KeyStore loadTruststore(String file, String password, String type)
          loads a truststore TODO this code can be replaced by the future authn lib
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDefaultKeyAlias

public static String getDefaultKeyAlias(ISecurityProperties sec)
                                 throws KeyStoreException,
                                        NoSuchAlgorithmException,
                                        CertificateException,
                                        IOException
Throws:
KeyStoreException
NoSuchAlgorithmException
CertificateException
IOException

createKeyStore

public static KeyStore createKeyStore(String name,
                                      String passwd,
                                      String type)
                               throws KeyStoreException,
                                      NoSuchAlgorithmException,
                                      CertificateException,
                                      IOException
Throws:
KeyStoreException
NoSuchAlgorithmException
CertificateException
IOException

getTrustedCertDNs

public static String[] getTrustedCertDNs(KeyStore ks)
                                  throws KeyStoreException
Throws:
KeyStoreException

loadKeyStore

public static KeyStore loadKeyStore(String name,
                                    String passwd,
                                    String type)
                             throws KeyStoreException,
                                    NoSuchAlgorithmException,
                                    CertificateException,
                                    IOException
loads keystore from a file TODO this code can be replaced by the future authn lib

Parameters:
name - - the file name
passwd - - the password
type - - the type (jks, pkcs12). If not given, it will be attempted to infer the type from the filename. If impossible, jks and p12 will be tried
Returns:
keystore
Throws:
KeyStoreException
NoSuchAlgorithmException
CertificateException
IOException

loadTruststore

public static KeyStore loadTruststore(String file,
                                      String password,
                                      String type)
                               throws KeyStoreException,
                                      CertificateException,
                                      IOException,
                                      NoSuchAlgorithmException
loads a truststore TODO this code can be replaced by the future authn lib

Parameters:
file - - the file name
password - - the password (if required)
type - - the optional type (jks, pkcs12, pem, directory)
Returns:
Throws:
KeyStoreException
CertificateException
IOException
NoSuchAlgorithmException


Copyright © 2012 EMI. All Rights Reserved.