use of org.jcryptool.crypto.flexiprovider.descriptors.algorithms.AlgorithmDescriptor in project core by jcryptool.
the class AlgorithmsManager method performMessageDigestCalled.
private static void performMessageDigestCalled(IMetaAlgorithm algorithm) {
// $NON-NLS-1$
LogUtil.logInfo("has param generator: " + (algorithm.getParameterGeneratorClassName() != null));
if (algorithm.getParameterGeneratorClassName() != null && !algorithm.isParameterSpecDisabled()) {
AlgorithmParameterSpec generatedSpec = Reflector.getInstance().generateDefaultParameterSpec(algorithm);
NewOperationManager.getInstance().fireNewOperation(new AlgorithmDescriptor(algorithm.getName(), RegistryType.MESSAGE_DIGEST, generatedSpec));
} else {
NewOperationManager.getInstance().fireNewOperation(new AlgorithmDescriptor(algorithm.getName(), RegistryType.MESSAGE_DIGEST, null));
}
}
use of org.jcryptool.crypto.flexiprovider.descriptors.algorithms.AlgorithmDescriptor 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));
}
}
use of org.jcryptool.crypto.flexiprovider.descriptors.algorithms.AlgorithmDescriptor in project core by jcryptool.
the class AlgorithmsManager method performSignatureCalled.
private static void performSignatureCalled(IMetaAlgorithm algorithm) {
if (algorithm.getParameterSpecClassName() != null) /*
* && !algorithm. isParameterSpecDisabled ()
*/
{
// $NON-NLS-1$
LogUtil.logInfo("has paramspec: " + algorithm.getParameterSpecClassName());
// open wizard
signatureWizard = new SignatureWizard(algorithm);
dialog = new WizardDialog(shell, signatureWizard);
dialog.setMinimumPageSize(300, 175);
int result = dialog.open();
if (result == Window.OK) {
NewOperationManager.getInstance().fireNewOperation(signatureWizard.getDescriptor());
}
} else {
// $NON-NLS-1$
LogUtil.logInfo("has no paramspec");
NewOperationManager.getInstance().fireNewOperation(new AlgorithmDescriptor(algorithm.getName(), RegistryType.SIGNATURE, null));
}
}
use of org.jcryptool.crypto.flexiprovider.descriptors.algorithms.AlgorithmDescriptor 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));
}
}
}
}
use of org.jcryptool.crypto.flexiprovider.descriptors.algorithms.AlgorithmDescriptor in project core by jcryptool.
the class OperationsViewEntryRootElement method getEntryNodes.
@SuppressWarnings("unchecked")
public List<EntryNode> getEntryNodes() {
List<EntryNode> nodes = new ArrayList<EntryNode>();
// $NON-NLS-1$
Iterator<Element> it = getChildren("Entry").iterator();
while (it.hasNext()) {
Element element = it.next();
// $NON-NLS-1$
String name = element.getAttributeValue("name");
// $NON-NLS-1$
long timestamp = Long.valueOf(element.getAttributeValue("timestamp"));
// algorithm
AlgorithmDescriptor descriptor = null;
if (element.getChild("AlgorithmDescriptor") != null) {
// $NON-NLS-1$
// $NON-NLS-1$
AlgorithmDescriptorElement descriptorElement = new AlgorithmDescriptorElement(element.getChild("AlgorithmDescriptor"));
descriptor = descriptorElement.getDescriptor();
} else if (element.getChild("SecureRandomDescriptor") != null) {
// $NON-NLS-1$
// $NON-NLS-1$
SecureRandomDescriptorElement descriptorElement = new SecureRandomDescriptorElement(element.getChild("SecureRandomDescriptor"));
descriptor = descriptorElement.getDescriptor();
} else if (element.getChild("BlockCipherDescriptor") != null) {
// $NON-NLS-1$
// $NON-NLS-1$
BlockCipherDescriptorElement descriptorElement = new BlockCipherDescriptorElement(element.getChild("BlockCipherDescriptor"));
descriptor = descriptorElement.getDescriptor();
}
EntryNode entryNode = new EntryNode(name, timestamp, descriptor);
nodes.add(entryNode);
// supplemental information below
// key
KeyStoreAlias alias = null;
if (element.getChild("Key") != null) {
// $NON-NLS-1$
// $NON-NLS-1$
KeyElement keyElement = new KeyElement(element.getChild("Key"));
alias = keyElement.getAlias();
entryNode.setKeyStoreAlias(alias);
}
// operation
OperationType type = null;
if (element.getChild("Operation") != null) {
// $NON-NLS-1$
// $NON-NLS-1$
OperationElement opsElement = new OperationElement(element.getChild("Operation"));
type = opsElement.getOperationType();
if (!type.equals(OperationType.UNKNOWN)) {
entryNode.setOperation(type);
}
}
// i/o
String input = null;
String output = null;
String signature = null;
if (element.getChild("Output") != null) {
// $NON-NLS-1$
// $NON-NLS-1$
OutputElement outElement = new OutputElement(element.getChild("Output"));
output = outElement.getOutput();
entryNode.setOutput(output);
} else if (element.getChild("InputOutput") != null) {
// $NON-NLS-1$
// $NON-NLS-1$
InputOutputElement inOutElement = new InputOutputElement(element.getChild("InputOutput"));
input = inOutElement.getInput();
output = inOutElement.getOutput();
entryNode.setInput(input);
entryNode.setOutput(output);
} else if (element.getChild("InputSignature") != null) {
// $NON-NLS-1$
// $NON-NLS-1$
InputSignatureElement inSigElement = new InputSignatureElement(element.getChild("InputSignature"));
input = inSigElement.getInput();
signature = inSigElement.getSignature();
entryNode.setInput(input);
entryNode.setSignature(signature);
}
}
return nodes;
}
Aggregations