public class X509Credential
extends java.lang.Object
implements java.io.Serializable
This class equivalent was called GlobusCredential in CoG -maybe a better name?
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE |
Constructor and Description |
---|
X509Credential(java.io.InputStream input) |
X509Credential(java.io.InputStream certInputStream,
java.io.InputStream keyInputStream) |
X509Credential(java.security.PrivateKey initKey,
java.security.cert.X509Certificate[] initCertChain) |
X509Credential(java.lang.String proxyFile) |
X509Credential(java.lang.String certFile,
java.lang.String keyFile) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object object) |
java.security.cert.X509Certificate[] |
getCertificateChain() |
int |
getCertNum()
Returns the number of certificates in the credential without the self-signed certificates.
|
static X509Credential |
getDefaultCredential()
Returns the default credential.
|
java.lang.String |
getIdentity()
Returns the identity of this credential.
|
java.security.cert.X509Certificate |
getIdentityCertificate()
Returns the identity certificate of this credential.
|
java.lang.String |
getIssuer()
Returns the issuer DN of the first certificate in the chain.
|
java.util.Date |
getNotBefore() |
int |
getPathConstraint()
Returns the path length constraint.
|
java.security.PrivateKey |
getPrivateKey() |
java.security.PrivateKey |
getPrivateKey(java.lang.String password) |
GSIConstants.CertificateType |
getProxyType()
Returns the certificate type of the first certificate in the chain.
|
int |
getStrength()
Returns strength of the private/public key in bits.
|
int |
getStrength(java.lang.String password)
Returns strength of the private/public key in bits.
|
java.lang.String |
getSubject()
Returns the subject DN of the first certificate in the chain.
|
long |
getTimeLeft()
Returns time left of this credential.
|
int |
hashCode() |
boolean |
isEncryptedKey() |
protected void |
load(java.io.InputStream input) |
protected void |
loadCertificate(java.io.InputStream input) |
protected void |
loadKey(java.io.InputStream input) |
void |
save(java.io.OutputStream out) |
void |
saveCertificateChain(java.io.OutputStream out) |
void |
saveKey(java.io.OutputStream out) |
static void |
setDefaultCredential(X509Credential cred)
Sets default credential.
|
java.lang.String |
toString() |
void |
verify()
Verifies the validity of the credentials.
|
void |
writeToFile(java.io.File file) |
void |
writeToFile(java.io.File certFile,
java.io.File keyFile) |
public static final int BUFFER_SIZE
public X509Credential(java.security.PrivateKey initKey, java.security.cert.X509Certificate[] initCertChain)
public X509Credential(java.io.InputStream certInputStream, java.io.InputStream keyInputStream) throws CredentialException
CredentialException
public X509Credential(java.lang.String certFile, java.lang.String keyFile) throws CredentialException, java.io.IOException
CredentialException
java.io.IOException
public X509Credential(java.lang.String proxyFile) throws CredentialException
CredentialException
public X509Credential(java.io.InputStream input) throws CredentialException
CredentialException
public java.security.cert.X509Certificate[] getCertificateChain()
public java.security.PrivateKey getPrivateKey() throws CredentialException
CredentialException
public java.security.PrivateKey getPrivateKey(java.lang.String password) throws CredentialException
CredentialException
public boolean isEncryptedKey()
public void saveKey(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void saveCertificateChain(java.io.OutputStream out) throws java.io.IOException, java.security.cert.CertificateEncodingException
java.io.IOException
java.security.cert.CertificateEncodingException
public void save(java.io.OutputStream out) throws java.io.IOException, java.security.cert.CertificateEncodingException
java.io.IOException
java.security.cert.CertificateEncodingException
public void writeToFile(java.io.File file) throws java.io.IOException, java.security.cert.CertificateEncodingException
java.io.IOException
java.security.cert.CertificateEncodingException
public void writeToFile(java.io.File certFile, java.io.File keyFile) throws java.io.IOException, java.security.cert.CertificateEncodingException
java.io.IOException
java.security.cert.CertificateEncodingException
public java.util.Date getNotBefore()
public int getCertNum()
public int getStrength() throws CredentialException
CredentialException
public int getStrength(java.lang.String password) throws CredentialException
CredentialException
public java.lang.String getSubject()
public java.lang.String getIssuer()
public GSIConstants.CertificateType getProxyType()
BouncyCastleUtil.getCertificateType(X509Certificate)
public long getTimeLeft()
public java.lang.String getIdentity()
getIdentityCertificate()
public java.security.cert.X509Certificate getIdentityCertificate()
X509Certificate
the identity cert. Null, if unable to get the identity certificate
(an error occurred)public int getPathConstraint()
public void verify() throws CredentialException
CredentialException
- if one of the certificates in the chain expired or if path validiation fails.public static X509Credential getDefaultCredential() throws CredentialException
CredentialException
- if the credential expired or some other error with the credential.public static void setDefaultCredential(X509Credential cred)
cred
- the credential to set a default.public java.lang.String toString()
toString
in class java.lang.Object
protected void load(java.io.InputStream input) throws CredentialException
CredentialException
protected void loadCertificate(java.io.InputStream input) throws CredentialException
CredentialException
protected void loadKey(java.io.InputStream input) throws CredentialException
CredentialException
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object