Search in sources :

Example 1 with BlockCipherWizardDialog

use of org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.blockcipher.BlockCipherWizardDialog in project core by jcryptool.

the class AlgorithmsManager method performBlockCipherCalled.

private static void performBlockCipherCalled(IMetaAlgorithm algorithm) {
    blockCipherWizard = new BlockCipherWizard(algorithm);
    dialog = new BlockCipherWizardDialog(shell, blockCipherWizard);
    dialog.setMinimumPageSize(300, 175);
    int result = dialog.open();
    if (result == Window.OK) {
        NewOperationManager.getInstance().fireNewOperation(blockCipherWizard.getDescriptor());
    }
}
Also used : BlockCipherWizardDialog(org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.blockcipher.BlockCipherWizardDialog) BlockCipherWizard(org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.blockcipher.BlockCipherWizard)

Example 2 with BlockCipherWizardDialog

use of org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.blockcipher.BlockCipherWizardDialog in project core by jcryptool.

the class AlgorithmsManager method performMacCalled.

private static void performMacCalled(IMetaAlgorithm algorithm) {
    if (algorithm.getBlockCipherName() != null) {
        IMetaAlgorithm bc = null;
        // $NON-NLS-1$
        LogUtil.logInfo("BC name: " + algorithm.getBlockCipherName());
        if (algorithm.getBlockCipherOID() != null) {
            // $NON-NLS-1$
            LogUtil.logInfo("BC oid: " + algorithm.getBlockCipherOID());
            bc = AlgorithmsXMLManager.getInstance().getBlockCipher(algorithm.getBlockCipherOID());
        } else {
            bc = AlgorithmsXMLManager.getInstance().getBlockCipher(algorithm.getBlockCipherName());
        }
        // $NON-NLS-1$
        LogUtil.logInfo("BC mode: " + algorithm.getBlockCipherMode());
        if (bc != null) {
            blockCipherWizard = new BlockCipherWizard(bc, algorithm.getBlockCipherMode());
            dialog = new BlockCipherWizardDialog(shell, blockCipherWizard);
            dialog.setMinimumPageSize(300, 175);
            int result = dialog.open();
            if (result == Window.OK) {
                AlgorithmDescriptor blockCipherDescriptor = blockCipherWizard.getDescriptor();
                AlgorithmDescriptor macDescriptor = new AlgorithmDescriptor(algorithm.getName(), RegistryType.MAC, blockCipherDescriptor.getAlgorithmParameterSpec());
                NewOperationManager.getInstance().fireNewOperation(macDescriptor);
                return;
            }
        }
    }
    if (algorithm.getParameterSpecClassName() != null && !algorithm.isParameterSpecDisabled()) {
        algorithmWizard = new AlgorithmWizard(algorithm);
        dialog = new WizardDialog(shell, algorithmWizard);
        dialog.setMinimumPageSize(300, 100);
        int result = dialog.open();
        if (result == Window.OK) {
            // $NON-NLS-1$
            LogUtil.logInfo("adding mac");
            NewOperationManager.getInstance().fireNewOperation(algorithmWizard.getDescriptor());
        } else {
            // $NON-NLS-1$
            LogUtil.logInfo("adding mac w/o parameter spec");
            // $NON-NLS-1$
            LogUtil.logInfo("has param generator: " + (algorithm.getParameterGeneratorClassName() != null));
            if (algorithm.getParameterGeneratorClassName() != null) {
                AlgorithmParameterSpec generatedSpec = Reflector.getInstance().generateDefaultParameterSpec(algorithm);
                NewOperationManager.getInstance().fireNewOperation(new AlgorithmDescriptor(algorithm.getName(), RegistryType.MAC, generatedSpec));
            } else {
                NewOperationManager.getInstance().fireNewOperation(new AlgorithmDescriptor(algorithm.getName(), RegistryType.MAC, null));
            }
        }
    }
}
Also used : BlockCipherWizardDialog(org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.blockcipher.BlockCipherWizardDialog) IMetaAlgorithm(org.jcryptool.crypto.flexiprovider.descriptors.meta.interfaces.IMetaAlgorithm) AlgorithmWizard(org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.AlgorithmWizard) BlockCipherWizard(org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.blockcipher.BlockCipherWizard) AlgorithmDescriptor(org.jcryptool.crypto.flexiprovider.descriptors.algorithms.AlgorithmDescriptor) WizardDialog(org.eclipse.jface.wizard.WizardDialog) BlockCipherWizardDialog(org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.blockcipher.BlockCipherWizardDialog) AlgorithmParameterSpec(de.flexiprovider.api.parameters.AlgorithmParameterSpec)

Aggregations

BlockCipherWizard (org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.blockcipher.BlockCipherWizard)2 BlockCipherWizardDialog (org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.blockcipher.BlockCipherWizardDialog)2 AlgorithmParameterSpec (de.flexiprovider.api.parameters.AlgorithmParameterSpec)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 AlgorithmWizard (org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.AlgorithmWizard)1 AlgorithmDescriptor (org.jcryptool.crypto.flexiprovider.descriptors.algorithms.AlgorithmDescriptor)1 IMetaAlgorithm (org.jcryptool.crypto.flexiprovider.descriptors.meta.interfaces.IMetaAlgorithm)1