use of de.flexiprovider.common.mode.ModeParameterSpec in project core by jcryptool.
the class BlockCipherWizard method getDefaultModeParamSpecs.
private ModeParameterSpec getDefaultModeParamSpecs() {
ModeParameterGenerator generator = new ModeParameterGenerator();
generator.init(algorithm.getDefaultBlockLength() / 8, FlexiProviderAlgorithmsPlugin.getSecureRandom());
return (ModeParameterSpec) generator.generateParameters();
}
use of de.flexiprovider.common.mode.ModeParameterSpec in project core by jcryptool.
the class ModeParameterSpecElement method getModeParameterSpec.
private ModeParameterSpec getModeParameterSpec(String encoded) {
if (encoded != null) {
// $NON-NLS-1$
LogUtil.logInfo("getModeParameterSpec");
try {
byte[] encodedParams = Base64Coder.decode(encoded);
// $NON-NLS-1$
AlgorithmParameters params = Registry.getAlgParams("Mode");
params.init(encodedParams);
return (ModeParameterSpec) params.getParameterSpec(ModeParameterSpec.class);
} catch (IOException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "IOException while decoding ModeParameters", e, false);
} catch (NoSuchAlgorithmException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "NoSuchAlgorithmException while decoding ModeParameters", e, true);
} catch (InvalidParameterSpecException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "InvalidParameterSpecException while decoding ModeParameters", e, true);
}
}
return null;
}
Aggregations