Search in sources :

Example 1 with BadPaddingException

use of de.flexiprovider.api.exceptions.BadPaddingException in project core by jcryptool.

the class CipherEngine method perform.

public void perform(KeyObject usedKey) {
    if (initialized) {
        // $NON-NLS-1$
        LogUtil.logInfo("perfoming cipher");
        InputStream inputStream = initInput(operation.getInput());
        OutputStream outputStream = initOutput(operation.getOutput());
        try {
            performCipher(inputStream, outputStream);
            inputStream.close();
            outputStream.close();
            if (operation.getOutput().equals("<Editor>")) {
                // $NON-NLS-1$
                EditorsManager.getInstance().openNewHexEditor(AbstractEditorService.createOutputFile(new FileInputStream(new File(getOutputURI()))));
            }
        } catch (IOException e) {
            LogUtil.logError(FlexiProviderEnginesPlugin.PLUGIN_ID, "IOException while performing a cipher", e, // $NON-NLS-1$
            false);
        } catch (IllegalBlockSizeException e) {
            LogUtil.logError(FlexiProviderEnginesPlugin.PLUGIN_ID, "IllegalBlockSizeException while performing a cipher", e, // $NON-NLS-1$
            true);
        } catch (BadPaddingException e) {
            // LogUtil.logError(FlexiProviderEnginesPlugin.PLUGIN_ID,
            // "BadPaddingException while performing a cipher", e, true); //$NON-NLS-1$
            JCTMessageDialog.showInfoDialog(new Status(IStatus.INFO, FlexiProviderEnginesPlugin.PLUGIN_ID, Messages.ExBadPadding, e));
        } catch (PartInitException e) {
            // $NON-NLS-1$
            LogUtil.logError(FlexiProviderEnginesPlugin.PLUGIN_ID, "Failed to open the Hexeditor", e, true);
        }
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) OutputStream(java.io.OutputStream) IllegalBlockSizeException(de.flexiprovider.api.exceptions.IllegalBlockSizeException) IOException(java.io.IOException) BadPaddingException(de.flexiprovider.api.exceptions.BadPaddingException) PartInitException(org.eclipse.ui.PartInitException) File(java.io.File) FileInputStream(java.io.FileInputStream)

Aggregations

BadPaddingException (de.flexiprovider.api.exceptions.BadPaddingException)1 IllegalBlockSizeException (de.flexiprovider.api.exceptions.IllegalBlockSizeException)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 PartInitException (org.eclipse.ui.PartInitException)1