use of de.flexiprovider.api.parameters.AlgorithmParameters in project core by jcryptool.
the class AlgorithmParameterSpecElement method getAlgorithmParameterSpec.
private AlgorithmParameterSpec getAlgorithmParameterSpec(String algorithmName, String encoded) {
if (encoded != null) {
// $NON-NLS-1$
LogUtil.logInfo("getAlgorithmParameterSpec");
try {
byte[] encodedParams = Base64Coder.decode(encoded);
AlgorithmParameters params = Registry.getAlgParams(algorithmName);
params.init(encodedParams);
return params.getParameterSpec(Registry.getAlgParamSpecClass(algorithmName));
} catch (IOException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "IOException while decoding AlgorithmParameterParameters", e, true);
} catch (NoSuchAlgorithmException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "NoSuchAlgorithmException while decoding AlgorithmParameterParameters", e, true);
} catch (InvalidParameterSpecException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "InvalidParameterSpecException while decoding AlgorithmParameterParameters", e, true);
}
}
return null;
}
use of de.flexiprovider.api.parameters.AlgorithmParameters in project core by jcryptool.
the class AlgorithmParameterSpecElement method setAlgorithmParameters.
private void setAlgorithmParameters(String algorithmName, AlgorithmParameterSpec spec) {
if (spec != null) {
try {
AlgorithmParameters params = Registry.getAlgParams(algorithmName);
params.init(spec);
setText(String.valueOf(Base64Coder.encode(params.getEncoded())));
} catch (IOException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "IOException while encoding AlgorithmParameterParameters", e, true);
} catch (NoSuchAlgorithmException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "NoSuchAlgorithmException while encoding AlgorithmParameterParameters", e, true);
} catch (InvalidParameterSpecException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "InvalidParameterSpecException while encoding AlgorithmParameterParameters", e, true);
}
}
}
use of de.flexiprovider.api.parameters.AlgorithmParameters in project core by jcryptool.
the class ModeParameterSpecElement method setModeParameters.
private void setModeParameters(AlgorithmParameterSpec modeSpec) {
if (modeSpec != null) {
try {
// $NON-NLS-1$
AlgorithmParameters params = Registry.getAlgParams("Mode");
params.init(modeSpec);
setText(String.valueOf(Base64Coder.encode(params.getEncoded())));
} catch (IOException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "IOException while encoding ModeParameters", e, true);
} catch (NoSuchAlgorithmException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "NoSuchAlgorithmException while encoding ModeParameters", e, true);
} catch (InvalidParameterSpecException e) {
LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "InvalidParameterSpecException while encoding ModeParameters", e, true);
}
}
}
use of de.flexiprovider.api.parameters.AlgorithmParameters 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