public class X509Credential extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE |
Constructor and Description |
---|
X509Credential(InputStream input) |
X509Credential(InputStream certInputStream,
InputStream keyInputStream) |
X509Credential(PrivateKey initKey,
X509Certificate[] initCertChain) |
X509Credential(String proxyFile) |
X509Credential(String certFile,
String keyFile) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object) |
X509Certificate[] |
getCertificateChain() |
int |
getCertNum()
Returns the number of certificates in the credential without the self-signed certificates.
|
static X509Credential |
getDefaultCredential()
Returns the default credential.
|
String |
getIdentity()
Returns the identity of this credential.
|
X509Certificate |
getIdentityCertificate()
Returns the identity certificate of this credential.
|
String |
getIssuer()
Returns the issuer DN of the first certificate in the chain.
|
Date |
getNotBefore() |
int |
getPathConstraint()
Returns the path length constraint.
|
PrivateKey |
getPrivateKey() |
PrivateKey |
getPrivateKey(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(String password)
Returns strength of the private/public key in bits.
|
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(InputStream input) |
protected void |
loadCertificate(InputStream input) |
protected void |
loadKey(InputStream input) |
void |
save(OutputStream out) |
void |
saveCertificateChain(OutputStream out) |
void |
saveKey(OutputStream out) |
static void |
setDefaultCredential(X509Credential cred)
Sets default credential.
|
String |
toString() |
void |
verify()
Verifies the validity of the credentials.
|
void |
writeToFile(File file) |
void |
writeToFile(File certFile,
File keyFile) |
public static final int BUFFER_SIZE
public X509Credential(PrivateKey initKey, X509Certificate[] initCertChain)
public X509Credential(InputStream certInputStream, InputStream keyInputStream) throws CredentialException
CredentialException
public X509Credential(String certFile, String keyFile) throws CredentialException, IOException
CredentialException
IOException
public X509Credential(String proxyFile) throws CredentialException
CredentialException
public X509Credential(InputStream input) throws CredentialException
CredentialException
public X509Certificate[] getCertificateChain()
public PrivateKey getPrivateKey() throws CredentialException
CredentialException
public PrivateKey getPrivateKey(String password) throws CredentialException
CredentialException
public boolean isEncryptedKey()
public void saveKey(OutputStream out) throws IOException
IOException
public void saveCertificateChain(OutputStream out) throws IOException, CertificateEncodingException
public void save(OutputStream out) throws IOException, CertificateEncodingException
public void writeToFile(File file) throws IOException, CertificateEncodingException
public void writeToFile(File certFile, File keyFile) throws IOException, CertificateEncodingException
public Date getNotBefore()
public int getCertNum()
public int getStrength() throws CredentialException
CredentialException
public int getStrength(String password) throws CredentialException
CredentialException
public String getSubject()
public String getIssuer()
public GSIConstants.CertificateType getProxyType()
BouncyCastleUtil.getCertificateType(X509Certificate)
public long getTimeLeft()
public String getIdentity()
getIdentityCertificate()
public 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.protected void load(InputStream input) throws CredentialException
CredentialException
protected void loadCertificate(InputStream input) throws CredentialException
CredentialException
protected void loadKey(InputStream input) throws CredentialException
CredentialException
Copyright © 2016. All rights reserved.