Methods Summary |
---|
public void | addCertificate(java.lang.String alias, java.security.cert.Certificate cert)
_keyStore.setCertificateEntry(alias, cert);
writeStore();
|
public boolean | certificateExists(java.security.cert.Certificate cert)
return (_keyStore.getCertificateAlias(cert) == null ? false : true);
|
public static java.io.File | getAsadminTruststore()
String location = System.getProperty(SystemPropertyConstants.CLIENT_TRUSTSTORE_PROPERTY);
if (location == null) {
return new File(System.getProperty("user.home") + File.separator + ASADMIN_TRUSTSTORE);
} else {
return new File(location);
}
|
public static java.lang.String | getAsadminTruststorePassword()
return System.getProperty(SystemPropertyConstants.CLIENT_TRUSTSTORE_PASSWORD_PROPERTY,
"changeit");
|
private void | init(java.io.File keyfile, java.lang.String password)
_keyFile = keyfile;
_keyStore = KeyStore.getInstance("JKS");
_password = password.toCharArray();
BufferedInputStream bInput = null;
if (_keyFile.exists()) {
bInput = new BufferedInputStream(new FileInputStream(_keyFile));
}
try {
//load must be called with null to initialize an empty keystore
_keyStore.load(bInput, _password);
if (bInput != null) {
bInput.close();
bInput = null;
}
} finally {
if (bInput != null) {
try {
bInput.close();
} catch(Exception ex) {
//ignore we are cleaning up
}
}
}
|
public void | writeStore()
BufferedOutputStream boutput = null;
try {
boutput = new BufferedOutputStream(
new FileOutputStream(_keyFile));
_keyStore.store(boutput, _password);
boutput.close();
boutput = null;
} finally {
if (boutput != null) {
try {
boutput.close();
} catch(Exception ex) {
//ignore we are cleaning up
}
}
}
|