use of org.jcryptool.crypto.keystore.descriptors.interfaces.IImportWizard in project core by jcryptool.
the class ImportKeyHandler method execute.
public Object execute(ExecutionEvent event) {
shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
Wizard wizard = new ImportWizard();
dialog = new WizardDialog(shell, wizard);
dialog.setMinimumPageSize(300, 350);
int result = dialog.open();
if (result == Window.OK) {
if (wizard instanceof IImportWizard) {
IImportDescriptor desc = ((IImportWizard) wizard).getImportDescriptor();
IPath path = new Path(desc.getFileName());
if (desc.getKeyStoreEntryType().equals(KeyType.SECRETKEY)) {
SecretKey key = ImportManager.getInstance().importSecretKey(path);
performImportAction(new ImportDescriptor(desc.getContactName(), key.getAlgorithm(), KeyType.SECRETKEY, desc.getFileName(), desc.getPassword(), // $NON-NLS-1$
"FlexiCore", -1), key);
} else if (desc.getKeyStoreEntryType().equals(KeyType.KEYPAIR)) {
PFX pfx = ImportManager.getInstance().importPFX(path);
performImportAction(desc, pfx);
} else if (desc.getKeyStoreEntryType().equals(KeyType.PUBLICKEY)) {
Certificate cert = ImportManager.getInstance().importCertificate(path);
performImportAction(desc, cert);
}
}
}
return (null);
}
Aggregations