org.glite.voms.contact
Class UserCredentials

java.lang.Object
  extended by org.glite.voms.contact.UserCredentials

public class UserCredentials
extends java.lang.Object

This class implements parsing and handling of X509 user credentials in PEM or PKCS12 format.

Author:
Andrea Ceccanti, Vincenzo Ciaschini

Method Summary
 java.security.cert.X509Certificate getUserCertificate()
          This method returs the user certificate loaded in this UserCredentials.
 java.security.cert.X509Certificate[] getUserChain()
          This method returs the user certificate chain loaded in this UserCredentials.
 java.security.PrivateKey getUserKey()
          This method returs the user credential openssl private key.
static UserCredentials instance()
          Static instance constructor for a UserCredentials.
static UserCredentials instance(java.security.PrivateKey key, java.security.cert.X509Certificate[] certs)
           
static UserCredentials instance(java.lang.String keyPassword)
          Static instance constructor for a UserCredentials.
static UserCredentials instance(java.lang.String userCertFile, java.lang.String userKeyFile)
          Static instance constructor for a UserCredentials.
static UserCredentials instance(java.lang.String userCertFile, java.lang.String userKeyFile, java.lang.String keyPassword)
          Static instance constructor for a UserCredentials.
static UserCredentials instance(UserCredentials credentials)
          Static instance constructor for a UserCredentials.
 void save(java.io.OutputStream os)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

save

public void save(java.io.OutputStream os)
          throws java.io.IOException
Throws:
java.io.IOException

getUserCertificate

public java.security.cert.X509Certificate getUserCertificate()
This method returs the user certificate loaded in this UserCredentials.

Returns:
the X509 user certificate.

getUserChain

public java.security.cert.X509Certificate[] getUserChain()
This method returs the user certificate chain loaded in this UserCredentials.

Returns:
the X509 user certificate.

getUserKey

public java.security.PrivateKey getUserKey()
This method returs the user credential openssl private key.

Returns:
the user credentials private key.

instance

public static UserCredentials instance()
Static instance constructor for a UserCredentials. This method should be used with credentials whose private key is not encrypted. The current implementation looks for user credentials in the following places (in sequence):

Returns:
the loaded user credentials.
Throws:
VOMSException - if there is an error loading the user credentials.

instance

public static UserCredentials instance(java.lang.String keyPassword)
Static instance constructor for a UserCredentials. For more info on the user credentials load procedure, see instance().

Parameters:
keyPassword - the password that is to be used to decrypt the user private key.
Returns:
the loaded user credentials.
Throws:
VOMSException - if there is an error loading the user credentials.

instance

public static UserCredentials instance(java.lang.String userCertFile,
                                       java.lang.String userKeyFile,
                                       java.lang.String keyPassword)
Static instance constructor for a UserCredentials. This methods allows a user to bypass the default credentials search procedure (highlighted here), by specifying the path to a PEM X509 user cert and private key.

Parameters:
userCertFile - the path to the PEM X509 user certificate.
userKeyFile - the path to the PEM X509 private key.
keyPassword - the password that is to be used to decrypt the user private key.
Returns:
the loaded user credentials.
Throws:
VOMSException - if there is an error loading the user credentials.

instance

public static UserCredentials instance(java.lang.String userCertFile,
                                       java.lang.String userKeyFile)
Static instance constructor for a UserCredentials. This methods allows a user to bypass the default credentials search procedure (highlighted here), by specifying the path to a PEM X509 user cert and private key.

Parameters:
userCertFile - the path to the PEM X509 user certificate.
userKeyFile - the path to the PEM X509 private key.
Returns:
the loaded user credentials.
Throws:
VOMSException - if there is an error loading the user credentials.

instance

public static UserCredentials instance(UserCredentials credentials)
Static instance constructor for a UserCredentials. This methods allows a user to bypass the default credentials search procedure (highlighted here), by specifying the path to a PEM X509 user cert and private key.

Parameters:
credentials - the GlobusCredentials object containing the user's own proxy
Returns:
the loaded user credentials.
Throws:
VOMSException - if there is an error loading the user credentials.

instance

public static UserCredentials instance(java.security.PrivateKey key,
                                       java.security.cert.X509Certificate[] certs)