Search in sources :

Example 1 with BlockCipherDescriptorElement

use of org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.BlockCipherDescriptorElement 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;
}
Also used : AlgorithmDescriptorElement(org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.AlgorithmDescriptorElement) OperationElement(org.jcryptool.crypto.flexiprovider.operations.xml.ops.OperationElement) KeyStoreAlias(org.jcryptool.crypto.keystore.backend.KeyStoreAlias) SecureRandomDescriptorElement(org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.SecureRandomDescriptorElement) AlgorithmDescriptorElement(org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.AlgorithmDescriptorElement) InputSignatureElement(org.jcryptool.crypto.flexiprovider.operations.xml.io.InputSignatureElement) InputOutputElement(org.jcryptool.crypto.flexiprovider.operations.xml.io.InputOutputElement) BlockCipherDescriptorElement(org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.BlockCipherDescriptorElement) OperationElement(org.jcryptool.crypto.flexiprovider.operations.xml.ops.OperationElement) KeyElement(org.jcryptool.crypto.flexiprovider.operations.xml.keys.KeyElement) OutputElement(org.jcryptool.crypto.flexiprovider.operations.xml.io.OutputElement) Element(org.jdom.Element) EntryNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.EntryNode) ArrayList(java.util.ArrayList) InputOutputElement(org.jcryptool.crypto.flexiprovider.operations.xml.io.InputOutputElement) AlgorithmDescriptor(org.jcryptool.crypto.flexiprovider.descriptors.algorithms.AlgorithmDescriptor) SecureRandomDescriptorElement(org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.SecureRandomDescriptorElement) KeyElement(org.jcryptool.crypto.flexiprovider.operations.xml.keys.KeyElement) InputOutputElement(org.jcryptool.crypto.flexiprovider.operations.xml.io.InputOutputElement) OutputElement(org.jcryptool.crypto.flexiprovider.operations.xml.io.OutputElement) InputSignatureElement(org.jcryptool.crypto.flexiprovider.operations.xml.io.InputSignatureElement) BlockCipherDescriptorElement(org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.BlockCipherDescriptorElement) OperationType(org.jcryptool.crypto.flexiprovider.types.OperationType)

Example 2 with BlockCipherDescriptorElement

use of org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.BlockCipherDescriptorElement 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);
}
Also used : AlgorithmDescriptorElement(org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.AlgorithmDescriptorElement) SecureRandomDescriptorElement(org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.SecureRandomDescriptorElement) EntryNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.EntryNode) BlockCipherDescriptorElement(org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.BlockCipherDescriptorElement) AlgorithmDescriptor(org.jcryptool.crypto.flexiprovider.descriptors.algorithms.AlgorithmDescriptor)

Aggregations

AlgorithmDescriptor (org.jcryptool.crypto.flexiprovider.descriptors.algorithms.AlgorithmDescriptor)2 EntryNode (org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.EntryNode)2 AlgorithmDescriptorElement (org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.AlgorithmDescriptorElement)2 BlockCipherDescriptorElement (org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.BlockCipherDescriptorElement)2 SecureRandomDescriptorElement (org.jcryptool.crypto.flexiprovider.operations.xml.algorithms.SecureRandomDescriptorElement)2 ArrayList (java.util.ArrayList)1 InputOutputElement (org.jcryptool.crypto.flexiprovider.operations.xml.io.InputOutputElement)1 InputSignatureElement (org.jcryptool.crypto.flexiprovider.operations.xml.io.InputSignatureElement)1 OutputElement (org.jcryptool.crypto.flexiprovider.operations.xml.io.OutputElement)1 KeyElement (org.jcryptool.crypto.flexiprovider.operations.xml.keys.KeyElement)1 OperationElement (org.jcryptool.crypto.flexiprovider.operations.xml.ops.OperationElement)1 OperationType (org.jcryptool.crypto.flexiprovider.types.OperationType)1 KeyStoreAlias (org.jcryptool.crypto.keystore.backend.KeyStoreAlias)1 Element (org.jdom.Element)1