Search in sources :

Example 11 with IMetaKeyGenerator

use of org.jcryptool.crypto.flexiprovider.descriptors.meta.interfaces.IMetaKeyGenerator in project core by jcryptool.

the class BlockCipherWizard method getDummyKey.

protected SecretKey getDummyKey() {
    try {
        // $NON-NLS-1$
        LogUtil.logInfo("generating dummy key");
        IMetaKeyGenerator secGen = AlgorithmsXMLManager.getInstance().getSecretKeyGenerator(algorithm.getName());
        SecretKeyGenerator gen = (SecretKeyGenerator) Class.forName(secGen.getClassName()).newInstance();
        gen.init(algorithm.getDefaultBlockLength());
        dummyKey = gen.generateKey();
        // $NON-NLS-1$
        LogUtil.logInfo("Key generated: " + dummyKey.getAlgorithm());
        return dummyKey;
    } catch (ClassNotFoundException e) {
        LogUtil.logError(FlexiProviderAlgorithmsPlugin.PLUGIN_ID, "ClassNotFoundException while creating the dummy key", e, false);
    } catch (InstantiationException e) {
        LogUtil.logError(FlexiProviderAlgorithmsPlugin.PLUGIN_ID, "InstantiationException while creating the dummy key", e, false);
    } catch (IllegalAccessException e) {
        LogUtil.logError(FlexiProviderAlgorithmsPlugin.PLUGIN_ID, "IllegalAccessException while creating the dummy key", e, false);
    }
    return null;
}
Also used : SecretKeyGenerator(de.flexiprovider.api.keys.SecretKeyGenerator) IMetaKeyGenerator(org.jcryptool.crypto.flexiprovider.descriptors.meta.interfaces.IMetaKeyGenerator)

Aggregations

IMetaKeyGenerator (org.jcryptool.crypto.flexiprovider.descriptors.meta.interfaces.IMetaKeyGenerator)11 NoSuchAlgorithmException (de.flexiprovider.api.exceptions.NoSuchAlgorithmException)5 WizardDialog (org.eclipse.jface.wizard.WizardDialog)5 IMetaLength (org.jcryptool.crypto.flexiprovider.descriptors.meta.interfaces.IMetaLength)5 InvalidAlgorithmParameterException (de.flexiprovider.api.exceptions.InvalidAlgorithmParameterException)4 AlgorithmParameterSpec (de.flexiprovider.api.parameters.AlgorithmParameterSpec)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 Wizard (org.eclipse.jface.wizard.Wizard)4 INewEntryDescriptor (org.jcryptool.crypto.keystore.descriptors.interfaces.INewEntryDescriptor)4 INewKeyWizard (org.jcryptool.crypto.keystore.descriptors.interfaces.INewKeyWizard)4 SecretKeyGenerator (de.flexiprovider.api.keys.SecretKeyGenerator)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 Job (org.eclipse.core.runtime.jobs.Job)3 NewKeyPairWizard (org.jcryptool.crypto.flexiprovider.keystore.wizards.NewKeyPairWizard)3 NewSymmetricKeyWizard (org.jcryptool.crypto.flexiprovider.keystore.wizards.NewSymmetricKeyWizard)3 KeyPair (de.flexiprovider.api.keys.KeyPair)2 KeyPairGenerator (de.flexiprovider.api.keys.KeyPairGenerator)2 PrivateKey (de.flexiprovider.api.keys.PrivateKey)2 PublicKey (de.flexiprovider.api.keys.PublicKey)2 SecretKey (de.flexiprovider.api.keys.SecretKey)2