org.glite.voms.contact

Class UserCredentials


public class UserCredentials
extends java.lang.Object

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

Method Summary

X509Certificate
getUserCertificate()
This method returs the user certificate loaded in this UserCredentials.
X509Certificate[]
getUserChain()
This method returs the user certificate chain loaded in this UserCredentials.
PrivateKey
getUserKey()
This method returs the user credential openssl private key.
static UserCredentials
instance()
Static instance constructor for a UserCredentials.
static UserCredentials
instance(PrivateKey key, X509Certificate[] certs)
static UserCredentials
instance(String keyPassword)
Static instance constructor for a UserCredentials.
static UserCredentials
instance(String userCertFile, String userKeyFile)
Static instance constructor for a UserCredentials.
static UserCredentials
instance(String userCertFile, String userKeyFile, String keyPassword)
Static instance constructor for a UserCredentials.
static UserCredentials
instance(UserCredentials credentials)
Static instance constructor for a UserCredentials.
void
save(OutputStream os)

Method Details

getUserCertificate

public X509Certificate getUserCertificate()
This method returs the user certificate loaded in this UserCredentials.
Returns:
the X509 user certificate.

getUserChain

public X509Certificate[] getUserChain()
This method returs the user certificate chain loaded in this UserCredentials.
Returns:
the X509 user certificate.

getUserKey

public 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):
  • If the X509_USER_CERT and X509_USER_KEY system properties are set, their values are used to load the user credentials
  • If the PKCS12_USER_CERT system property is set, its value is used to load the user credentials.
  • The content of the .globus directory in the user's home is searched for a PEM certificate (in the usercert.pem and userkey.pem files).
  • The content of the .globus directory in the user's home is searched for a PKC12 certificate (in the usercert.p12 file).
Returns:
the loaded user credentials.

instance

public static UserCredentials instance(PrivateKey key,
                                       X509Certificate[] certs)

instance

public static UserCredentials instance(String keyPassword)
Parameters:
keyPassword - the password that is to be used to decrypt the user private key.
Returns:
the loaded user credentials.

instance

public static UserCredentials instance(String userCertFile,
                                       String userKeyFile)
Parameters:
userCertFile - the path to the PEM X509 user certificate.
userKeyFile - the path to the PEM X509 private key.
Returns:
the loaded user credentials.

instance

public static UserCredentials instance(String userCertFile,
                                       String userKeyFile,
                                       String keyPassword)
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.

instance

public static UserCredentials instance(UserCredentials credentials)
Parameters:
credentials - the GlobusCredentials object containing the user's own proxy
Returns:
the loaded user credentials.

save

public void save(OutputStream os)
            throws IOException