int lastIndex = fullname.lastIndexOf("/");
String name = fullname.substring(lastIndex + 1);
String type = store.getProperty(SecurityConstants.PROP_TYPE);
String provider = store.getProperty(SecurityConstants.PROP_PROVIDER);
KeyStoreData data = new KeyStoreData();
data.setKeyStoreName(name);
data.setKeyStoreType(type);
data.setProvider(provider);
String alias = store.getProperty(SecurityConstants.PROP_PRIVATE_KEY_ALIAS);
if (alias != null) {
data.setPrivateStore(true);
} else {
data.setPrivateStore(false);
}
// Dump the generated public key to the file system for sub tenants
if(!isSuperTenant){
Association[] associations = registry.getAssociations(
ks[i],SecurityConstants.ASSOCIATION_TENANT_KS_PUB_KEY);
if(associations != null && associations.length > 0){
Resource pubKeyResource = registry.get(associations[0].getDestinationPath());
String fileName = generatePubCertFileName(ks[i],
pubKeyResource.getProperty(
SecurityConstants.PROP_TENANT_PUB_KEY_FILE_NAME_APPENDER));
String pubKeyFilePath = KeyStoreMgtUtil.dumpCert(
MessageContext.getCurrentMessageContext().getConfigurationContext(),
(byte[])pubKeyResource.getContent(), fileName);
data.setPubKeyFilePath(pubKeyFilePath);
}
}
lst.add(data);
}
names = new KeyStoreData[lst.size() + 1];
Iterator<KeyStoreData> ite = lst.iterator();
int count = 0;
while (ite.hasNext()) {
names[count] = ite.next();
count++;
}
if (isSuperTenant) {
KeyStoreData data = new KeyStoreData();
ServerConfiguration config = ServerConfiguration.getInstance();
String fileName = config
.getFirstProperty(RegistryResources.SecurityManagement.SERVER_PRIMARY_KEYSTORE_FILE);
String type = config
.getFirstProperty(RegistryResources.SecurityManagement.SERVER_PRIMARY_KEYSTORE_TYPE);
String name = KeyStoreUtil.getKeyStoreFileName(fileName);
data.setKeyStoreName(name);
data.setKeyStoreType(type);
data.setProvider(" ");
data.setPrivateStore(true);
names[count] = data;
}
}