edu.internet2.middleware.security
Class CredentialHelper

java.lang.Object
  extended by edu.internet2.middleware.security.CredentialHelper

public class CredentialHelper
extends Object

Helper class for reading in cryptographic credentials.


Field Summary
private static Logger LOG
          Class logger.
 
Constructor Summary
CredentialHelper()
           
 
Method Summary
static X509TrustManager buildNoTrustTrustManager()
           
protected static org.opensaml.xml.security.x509.BasicX509Credential getCredentialFromKeystore(KeyStore keystore, String keyAlias, String keyPassword)
          Gets a credential from the given store.
protected static org.opensaml.xml.security.x509.BasicX509Credential getFileBasedCredentials(String keyFile, String keyPassword, String certificateFile)
          Reads in the X509 credentials from the filesystem.
protected static org.opensaml.xml.security.x509.BasicX509Credential getKeystoreCredential(String keystorePath, String keystorePassword, String keystoreProvider, String keystoreType, String keyAlias, String keyPassword)
          Reads in the X509 credentials from a keystore.
protected static org.opensaml.xml.security.x509.BasicX509Credential getPKCS11Credential(String keystoreProvider, String pkcs11Config, String keyAlias, String keyPassword)
          Reads in the X509 credentials from a PKCS11 source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final Logger LOG
Class logger.

Constructor Detail

CredentialHelper

public CredentialHelper()
Method Detail

buildNoTrustTrustManager

public static X509TrustManager buildNoTrustTrustManager()

getFileBasedCredentials

protected static org.opensaml.xml.security.x509.BasicX509Credential getFileBasedCredentials(String keyFile,
                                                                                            String keyPassword,
                                                                                            String certificateFile)
                                                                                     throws KeyException,
                                                                                            CertificateException
Reads in the X509 credentials from the filesystem.

Parameters:
keyFile - path to the private key file
keyPassword - password for the private key, may be null
certificateFile - path to the certificate file associated with the private key
Returns:
the credentials
Throws:
KeyException
CertificateException

getKeystoreCredential

protected static org.opensaml.xml.security.x509.BasicX509Credential getKeystoreCredential(String keystorePath,
                                                                                          String keystorePassword,
                                                                                          String keystoreProvider,
                                                                                          String keystoreType,
                                                                                          String keyAlias,
                                                                                          String keyPassword)
                                                                                   throws IOException,
                                                                                          GeneralSecurityException
Reads in the X509 credentials from a keystore.

Parameters:
keystorePath - path the keystore file
keystorePassword - keystore password
keystoreProvider - keystore providr identifier
keystoreType - keystore type
keyAlias - private key alias
keyPassword - private key password, may not be null
Returns:
the credentials
Throws:
IOException
GeneralSecurityException

getPKCS11Credential

protected static org.opensaml.xml.security.x509.BasicX509Credential getPKCS11Credential(String keystoreProvider,
                                                                                        String pkcs11Config,
                                                                                        String keyAlias,
                                                                                        String keyPassword)
                                                                                 throws IOException,
                                                                                        GeneralSecurityException
Reads in the X509 credentials from a PKCS11 source.

Parameters:
keystoreProvider - keystore provider class
pkcs11Config - PKCS11 configuration file used by the keystore provider
keyAlias - private key keystore alias
keyPassword - private key password, may not be null
Returns:
the credentials
Throws:
IOException
GeneralSecurityException

getCredentialFromKeystore

protected static org.opensaml.xml.security.x509.BasicX509Credential getCredentialFromKeystore(KeyStore keystore,
                                                                                              String keyAlias,
                                                                                              String keyPassword)
                                                                                       throws GeneralSecurityException
Gets a credential from the given store.

Parameters:
keystore - keystore from which to extract the credentials
keyAlias - keystore key alias
keyPassword - private key password
Returns:
the extracted credential
Throws:
GeneralSecurityException


Copyright © 1999-2013. All Rights Reserved.