mgr.deleteKeyStore();
}
String alias = (String) seq.getAttribute(ImportExistingCertificateForm.ATTR_ALIAS, null);
String passphrase = (String) seq.getAttribute(ImportExistingCertificateForm.ATTR_PASSPHRASE, "");
KeyStoreType keyStoreType = KeyStoreManager.getKeyStoreType((String) seq.getAttribute(
ImportExistingCertificateForm.ATTR_KEY_STORE_TYPE, ""));
File uploadedFile = (File) seq.getAttribute(ImportExistingCertificateForm.ATTR_UPLOADED_FILE, null);
mgr.setStorePassword(passphrase);
if (keyStoreType.equals(KeyStoreManager.TYPE_PKCS12)) {
mgr.setKeyStoreType(KeyStoreManager.TYPE_JKS);
alias = mgr.importPKCS12Key(uploadedFile, passphrase, alias, SERVER_CERTIFICATE);
} else {
FileOutputStream out = new FileOutputStream(mgr.getKeyStoreFile());
try {