Search in sources :

Example 1 with AlgorithmWizard

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

the class AlgorithmsManager method performCipherCalled.

private static void performCipherCalled(IMetaAlgorithm algorithm) {
    if (algorithm.getParameterSpecClassName() != null) {
        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 cipher");
            NewOperationManager.getInstance().fireNewOperation(algorithmWizard.getDescriptor());
        }
    } else {
        // $NON-NLS-1$
        LogUtil.logInfo("adding cipher w/o parameter spec");
        NewOperationManager.getInstance().fireNewOperation(new AlgorithmDescriptor(algorithm.getName(), RegistryType.ASYMMETRIC_BLOCK_CIPHER, null));
    }
}
Also used : AlgorithmWizard(org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.AlgorithmWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) BlockCipherWizardDialog(org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.blockcipher.BlockCipherWizardDialog) AlgorithmDescriptor(org.jcryptool.crypto.flexiprovider.descriptors.algorithms.AlgorithmDescriptor)

Example 2 with AlgorithmWizard

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

the class AlgorithmsManager method performAsymmetricHybridCipherCalled.

private static void performAsymmetricHybridCipherCalled(IMetaAlgorithm algorithm) {
    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 asymmetric hybrid cipher");
            NewOperationManager.getInstance().fireNewOperation(algorithmWizard.getDescriptor());
        }
    } else {
        // $NON-NLS-1$
        LogUtil.logInfo("adding asymmetric hybrid cipher w/o parameter spec");
        NewOperationManager.getInstance().fireNewOperation(new AlgorithmDescriptor(algorithm.getName(), RegistryType.ASYMMETRIC_HYBRID_CIPHER, null));
    }
}
Also used : AlgorithmWizard(org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.AlgorithmWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) BlockCipherWizardDialog(org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.blockcipher.BlockCipherWizardDialog) AlgorithmDescriptor(org.jcryptool.crypto.flexiprovider.descriptors.algorithms.AlgorithmDescriptor)

Example 3 with AlgorithmWizard

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

the class AlgorithmsManager method performAsymmetricBlockCipherCalled.

private static void performAsymmetricBlockCipherCalled(IMetaAlgorithm algorithm) {
    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 asymmetric block cipher");
            NewOperationManager.getInstance().fireNewOperation(algorithmWizard.getDescriptor());
        }
    } else {
        // $NON-NLS-1$
        LogUtil.logInfo("adding asymmetric block cipher w/o parameter spec");
        NewOperationManager.getInstance().fireNewOperation(new AlgorithmDescriptor(algorithm.getName(), RegistryType.ASYMMETRIC_BLOCK_CIPHER, null));
    }
}
Also used : AlgorithmWizard(org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.AlgorithmWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) BlockCipherWizardDialog(org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.blockcipher.BlockCipherWizardDialog) AlgorithmDescriptor(org.jcryptool.crypto.flexiprovider.descriptors.algorithms.AlgorithmDescriptor)

Example 4 with AlgorithmWizard

use of org.jcryptool.crypto.flexiprovider.algorithms.ui.wizards.AlgorithmWizard 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

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