use of org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.SecureRandomDescriptorElement 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;
}
use of org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.SecureRandomDescriptorElement in project core by jcryptool.
the class ExportRootElement method getEntryNode.
public EntryNode getEntryNode() {
// $NON-NLS-1$
String name = getAttributeValue("name");
// $NON-NLS-1$
long timestamp = Long.valueOf(getAttributeValue("timestamp"));
// algorithm
AlgorithmDescriptor descriptor = null;
if (getChild("AlgorithmDescriptor") != null) {
// $NON-NLS-1$
// $NON-NLS-1$
AlgorithmDescriptorElement descriptorElement = new AlgorithmDescriptorElement(getChild("AlgorithmDescriptor"));
descriptor = descriptorElement.getDescriptor();
} else if (getChild("SecureRandomDescriptor") != null) {
// $NON-NLS-1$
// $NON-NLS-1$
SecureRandomDescriptorElement descriptorElement = new SecureRandomDescriptorElement(getChild("SecureRandomDescriptor"));
descriptor = descriptorElement.getDescriptor();
} else if (getChild("BlockCipherDescriptor") != null) {
// $NON-NLS-1$
// $NON-NLS-1$
BlockCipherDescriptorElement descriptorElement = new BlockCipherDescriptorElement(getChild("BlockCipherDescriptor"));
descriptor = descriptorElement.getDescriptor();
}
return new EntryNode(name, timestamp, descriptor);
}
Aggregations