Package org.globus.gsi
Class GlobusCredential
- java.lang.Object
-
- org.globus.gsi.GlobusCredential
-
- All Implemented Interfaces:
java.io.Serializable
public class GlobusCredential extends java.lang.Object implements java.io.Serializable
Deprecated.Provides a Java object representation of Globus credential which can include the proxy file or host certificates.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private X509Credential
cred
Deprecated.private static java.io.File
credentialFile
Deprecated.private static long
credentialLastModified
Deprecated.private static boolean
credentialSet
Deprecated.private static GlobusCredential
defaultCred
Deprecated.private org.apache.commons.logging.Log
logger
Deprecated.
-
Constructor Summary
Constructors Constructor Description GlobusCredential(java.io.InputStream input)
Deprecated.Creates a GlobusCredential from an input stream.GlobusCredential(java.lang.String proxyFile)
Deprecated.Creates a GlobusCredential from a proxy file.GlobusCredential(java.lang.String certFile, java.lang.String unencryptedKeyFile)
Deprecated.Creates a GlobusCredential from certificate file and a unencrypted key file.GlobusCredential(java.security.PrivateKey key, java.security.cert.X509Certificate[] certs)
Deprecated.Creates a GlobusCredential from a private key and a certificate chain.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.security.cert.X509Certificate[]
getCertificateChain()
Deprecated.Returns the certificate chain of this credential.int
getCertNum()
Deprecated.Returns the number of certificates in the credential without the self-signed certificates.static GlobusCredential
getDefaultCredential()
Deprecated.Returns the default credential.java.lang.String
getIdentity()
Deprecated.Returns the identity of this credential.java.security.cert.X509Certificate
getIdentityCertificate()
Deprecated.Returns the identity certificate of this credential.java.lang.String
getIssuer()
Deprecated.Returns the issuer DN of the first certificate in the chain.int
getPathConstraint()
Deprecated.Returns the path length constraint.java.security.PrivateKey
getPrivateKey()
Deprecated.Returns the private key of this credential.int
getProxyType()
Deprecated.Returns the certificate type of the first certificate in the chain.int
getStrength()
Deprecated.Returns strength of the private/public key in bits.java.lang.String
getSubject()
Deprecated.Returns the subject DN of the first certificate in the chain.long
getTimeLeft()
Deprecated.Returns time left of this credential.private static void
reloadDefaultCredential()
Deprecated.void
save(java.io.OutputStream out)
Deprecated.Saves the credential into a specified output stream.static void
setDefaultCredential(GlobusCredential cred)
Deprecated.Sets default credential.java.lang.String
toString()
Deprecated.void
verify()
Deprecated.Verifies the validity of the credentials.
-
-
-
Field Detail
-
logger
private org.apache.commons.logging.Log logger
Deprecated.
-
cred
private X509Credential cred
Deprecated.
-
defaultCred
private static GlobusCredential defaultCred
Deprecated.
-
credentialLastModified
private static transient long credentialLastModified
Deprecated.
-
credentialSet
private static transient boolean credentialSet
Deprecated.
-
credentialFile
private static transient java.io.File credentialFile
Deprecated.
-
-
Constructor Detail
-
GlobusCredential
public GlobusCredential(java.security.PrivateKey key, java.security.cert.X509Certificate[] certs)
Deprecated.Creates a GlobusCredential from a private key and a certificate chain.- Parameters:
key
- the private keycerts
- the certificate chain
-
GlobusCredential
public GlobusCredential(java.lang.String proxyFile) throws GlobusCredentialException
Deprecated.Creates a GlobusCredential from a proxy file.- Parameters:
proxyFile
- the file to load the credential from.- Throws:
GlobusCredentialException
- if the credential failed to load.
-
GlobusCredential
public GlobusCredential(java.lang.String certFile, java.lang.String unencryptedKeyFile) throws GlobusCredentialException
Deprecated.Creates a GlobusCredential from certificate file and a unencrypted key file.- Parameters:
certFile
- the file containing the certificateunencryptedKeyFile
- the file containing the private key. The key must be unencrypted.- Throws:
GlobusCredentialException
- if something goes wrong.
-
GlobusCredential
public GlobusCredential(java.io.InputStream input) throws GlobusCredentialException
Deprecated.Creates a GlobusCredential from an input stream.- Parameters:
input
- the stream to load the credential from.- Throws:
GlobusCredentialException
- if the credential failed to load.
-
-
Method Detail
-
save
public void save(java.io.OutputStream out) throws java.io.IOException
Deprecated.Saves the credential into a specified output stream. The self-signed certificates in the certificate chain will not be saved. The output stream should always be closed after calling this function.- Parameters:
out
- the output stream to write the credential to.- Throws:
java.io.IOException
- if any error occurred during saving.
-
verify
public void verify() throws GlobusCredentialException
Deprecated.Verifies the validity of the credentials. All certificate path validation is performed using trusted certificates in default locations.- Throws:
GlobusCredentialException
- if one of the certificates in the chain expired or if path validiation fails.
-
getIdentityCertificate
public java.security.cert.X509Certificate getIdentityCertificate()
Deprecated.Returns the identity certificate of this credential. The identity certificate is the first certificate in the chain that is not an impersonation proxy certificate.- Returns:
X509Certificate
the identity cert. Null, if unable to get the identity certificate (an error occurred)
-
getPathConstraint
public int getPathConstraint()
Deprecated.Returns the path length constraint. The shortest length in the chain of certificates is returned as the credential's path length.- Returns:
- The path length constraint of the credential. -1 is any error occurs.
-
getIdentity
public java.lang.String getIdentity()
Deprecated.Returns the identity of this credential.- Returns:
- The identity cert in Globus format (e.g. /C=US/..). Null, if unable to get the identity (an error occurred)
- See Also:
getIdentityCertificate()
-
getPrivateKey
public java.security.PrivateKey getPrivateKey()
Deprecated.Returns the private key of this credential.- Returns:
PrivateKey
the private key
-
getCertificateChain
public java.security.cert.X509Certificate[] getCertificateChain()
Deprecated.Returns the certificate chain of this credential.- Returns:
X509Certificate []
the certificate chain
-
getCertNum
public int getCertNum()
Deprecated.Returns the number of certificates in the credential without the self-signed certificates.- Returns:
- number of certificates without counting self-signed certificates
-
getStrength
public int getStrength()
Deprecated.Returns strength of the private/public key in bits.- Returns:
- strength of the key in bits. Returns -1 if unable to determine it.
-
getSubject
public java.lang.String getSubject()
Deprecated.Returns the subject DN of the first certificate in the chain.- Returns:
- subject DN.
-
getIssuer
public java.lang.String getIssuer()
Deprecated.Returns the issuer DN of the first certificate in the chain.- Returns:
- issuer DN.
-
getProxyType
public int getProxyType()
Deprecated.Returns the certificate type of the first certificate in the chain. Returns -1 if unable to determine the certificate type (an error occurred)- Returns:
- the type of first certificate in the chain. -1 if unable to determine the certificate type.
- See Also:
BouncyCastleUtil.getCertificateType(X509Certificate)
-
getTimeLeft
public long getTimeLeft()
Deprecated.Returns time left of this credential. The time left of the credential is based on the certificate with the shortest validity time.- Returns:
- time left in seconds. Returns 0 if the certificate has expired.
-
getDefaultCredential
public static GlobusCredential getDefaultCredential() throws GlobusCredentialException
Deprecated.Returns the default credential. The default credential is usually the user proxy certificate.
The credential will be loaded on the initial call. It must not be expired. All subsequent calls to this function return cached credential object. Once the credential is cached, and the underlying file changes, the credential will be reloaded.- Returns:
- the default credential.
- Throws:
GlobusCredentialException
- if the credential expired or some other error with the credential.
-
reloadDefaultCredential
private static void reloadDefaultCredential() throws GlobusCredentialException
Deprecated.- Throws:
GlobusCredentialException
-
setDefaultCredential
public static void setDefaultCredential(GlobusCredential cred)
Deprecated.Sets default credential.- Parameters:
cred
- the credential to set a default.
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toString
in classjava.lang.Object
-
-