Skip to content
Snippets Groups Projects
Commit bd3467d8 authored by Ludovic Apvrille's avatar Ludovic Apvrille
Browse files

Updating all panels of cryto. conf. dialog

parent 400c75fa
No related branches found
No related tags found
No related merge requests found
/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille /* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
* *
* ludovic.apvrille AT enst.fr * ludovic.apvrille AT enst.fr
* *
* This software is a computer program whose purpose is to allow the * This software is a computer program whose purpose is to allow the
* edition of TURTLE analysis, design and deployment diagrams, to * edition of TURTLE analysis, design and deployment diagrams, to
* allow the generation of RT-LOTOS or Java code from this diagram, * allow the generation of RT-LOTOS or Java code from this diagram,
* and at last to allow the analysis of formal validation traces * and at last to allow the analysis of formal validation traces
* obtained from external tools, e.g. RTL from LAAS-CNRS and CADP * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
* from INRIA Rhone-Alpes. * from INRIA Rhone-Alpes.
* *
* This software is governed by the CeCILL license under French law and * This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use, * abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL * modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL * license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info". * "http://www.cecill.info".
* *
* As a counterpart to the access to the source code and rights to copy, * As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only * modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the * with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited * economic rights, and the successive licensors have only limited
* liability. * liability.
* *
* In this respect, the user's attention is drawn to the risks associated * In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the * with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software, * software by the user in light of its specific status of free software,
...@@ -31,14 +31,12 @@ ...@@ -31,14 +31,12 @@
* requirements in conditions enabling the security of their systems and/or * requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the * data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security. * same conditions as regards security.
* *
* The fact that you are presently reading this means that you have had * The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms. * knowledge of the CeCILL license and that you accept its terms.
*/ */
package ui.tmlad; package ui.tmlad;
import myutil.GraphicLib; import myutil.GraphicLib;
...@@ -58,67 +56,68 @@ import java.util.ArrayList; ...@@ -58,67 +56,68 @@ import java.util.ArrayList;
* Class TMLADDecrypt * Class TMLADDecrypt
* Create decryption. To be used in TML activity diagrams * Create decryption. To be used in TML activity diagrams
* Creation: 21/11/2005 * Creation: 21/11/2005
* @version 1.0 21/11/2005 *
* @author Ludovic APVRILLE * @author Ludovic APVRILLE
* @version 1.0 21/11/2005
*/ */
public class TMLADDecrypt extends TGCWithoutInternalComponent implements EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight { public class TMLADDecrypt extends TGCWithoutInternalComponent implements EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight {
private int lineLength = 5; private int lineLength = 5;
// private int textX, textY; // private int textX, textY;
private int ilength = 20; private int ilength = 20;
private int ex=5; private int ex = 5;
private int lineLength1 = 2; private int lineLength1 = 2;
public String securityContext=""; public String securityContext = "";
protected int stateOfError = 0; // Not yet checked protected int stateOfError = 0; // Not yet checked
public TMLADDecrypt(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { public TMLADDecrypt(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) {
super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp);
width = 15; width = 15;
height = 35; height = 35;
// textX = width + 5; // textX = width + 5;
// textY = height/2 + 5; // textY = height/2 + 5;
nbConnectingPoint = 2; nbConnectingPoint = 2;
connectingPoint = new TGConnectingPoint[2]; connectingPoint = new TGConnectingPoint[2];
connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0);
connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, + lineLength+ex, false, true, 0.5, 1.0); connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, +lineLength + ex, false, true, 0.5, 1.0);
moveable = true; moveable = true;
editable = true; editable = true;
removable = true; removable = true;
name = "decrypt"; name = "decrypt";
myImageIcon = IconManager.imgic214; myImageIcon = IconManager.imgic214;
} }
public void internalDrawing(Graphics g) { public void internalDrawing(Graphics g) {
if (stateOfError > 0) { if (stateOfError > 0) {
Color c = g.getColor(); Color c = g.getColor();
switch(stateOfError) { switch (stateOfError) {
case ErrorHighlight.OK: case ErrorHighlight.OK:
g.setColor(ColorManager.EXEC); g.setColor(ColorManager.EXEC);
break; break;
default: default:
g.setColor(ColorManager.UNKNOWN_BOX_ACTION); g.setColor(ColorManager.UNKNOWN_BOX_ACTION);
} }
g.fillRect(x, y, width, height); g.fillRect(x, y, width, height);
int[] xP = new int[]{x,x+width,x+width/2}; int[] xP = new int[]{x, x + width, x + width / 2};
int[] yP = new int[]{y+height, y+height, y+height+ex}; int[] yP = new int[]{y + height, y + height, y + height + ex};
g.fillPolygon(xP,yP,3); g.fillPolygon(xP, yP, 3);
g.setColor(c); g.setColor(c);
} }
g.drawLine(x, y, x+width, y); g.drawLine(x, y, x + width, y);
g.drawLine(x, y, x, y+height); g.drawLine(x, y, x, y + height);
g.drawLine(x+width, y, x+width, y+height); g.drawLine(x + width, y, x + width, y + height);
g.drawLine(x, y+height, x+width/2, y+height+ex); g.drawLine(x, y + height, x + width / 2, y + height + ex);
g.drawLine(x+width/2, y+height+ex, x+width, y+height); g.drawLine(x + width / 2, y + height + ex, x + width, y + height);
g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); g.drawLine(x + (width / 2), y, x + (width / 2), y - lineLength);
g.drawLine(x+(width/2), y+height+ex, x+(width/2), y + lineLength + height+ex); g.drawLine(x + (width / 2), y + height + ex, x + (width / 2), y + lineLength + height + ex);
g.drawLine(x + (width/2)- lineLength1, y+(height-ilength)/2, x + (width/2)- lineLength1, y+(height+ilength)/2); g.drawLine(x + (width / 2) - lineLength1, y + (height - ilength) / 2, x + (width / 2) - lineLength1, y + (height + ilength) / 2);
g.drawArc(x-ex, y+ex,width,height-2*ex,270,180); g.drawArc(x - ex, y + ex, width, height - 2 * ex, 270, 180);
/* /*
g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2, x + (width/2) + lineLength1, y+(height-ilength)/2); g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2, x + (width/2) + lineLength1, y+(height-ilength)/2);
...@@ -128,26 +127,26 @@ public class TMLADDecrypt extends TGCWithoutInternalComponent implements Embedde ...@@ -128,26 +127,26 @@ public class TMLADDecrypt extends TGCWithoutInternalComponent implements Embedde
g.drawLine(x + (width/2)+ lineLength1, y+(height-ilength)/2, x + (width/2)+ lineLength1, y+(height+ilength)/2); g.drawLine(x + (width/2)+ lineLength1, y+(height-ilength)/2, x + (width/2)+ lineLength1, y+(height+ilength)/2);
*/ */
g.drawImage(IconManager.imgic7000.getImage(), x - 22, y + height/2, null); g.drawImage(IconManager.imgic7000.getImage(), x - 22, y + height / 2, null);
g.drawString("sec:"+ securityContext, x+3*width/2, y+ height/2); g.drawString("sec:" + securityContext, x + 3 * width / 2, y + height / 2);
} }
public boolean editOndoubleClick(JFrame frame) { public boolean editOndoubleClick(JFrame frame) {
String [] labels = new String[1]; String[] labels = new String[1];
String [] values = new String[1]; String[] values = new String[1];
labels[0] = "Security Pattern"; labels[0] = "Security Pattern";
values[0] = securityContext; values[0] = securityContext;
ArrayList<String []> help = new ArrayList<String []>(); ArrayList<String[]> help = new ArrayList<String[]>();
help.add(tdp.getMGUI().getCurrentCryptoConfig()); help.add(tdp.getMGUI().getCurrentCryptoConfig());
//JDialogTwoString jdts = new JDialogTwoString(frame, "Setting channel's properties", "Channel name", channelName, "Nb of samples", nbOfSamples); //JDialogTwoString jdts = new JDialogTwoString(frame, "Setting channel's properties", "Channel name", channelName, "Nb of samples", nbOfSamples);
JDialogMultiString jdms = new JDialogMultiString(frame, "Setting Decryption", 1, labels, values,help); JDialogMultiString jdms = new JDialogMultiString(frame, "Setting Decryption", 1, labels, values, help);
// jdms.setSize(600, 300); // jdms.setSize(600, 300);
GraphicLib.centerOnParent(jdms, 600, 300); GraphicLib.centerOnParent(jdms, 600, 300);
jdms.setVisible( true ); // blocked until dialog has been closed jdms.setVisible(true); // blocked until dialog has been closed
if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { if (jdms.hasBeenSet() && (jdms.hasValidString(0))) {
securityContext = jdms.getString(0); securityContext = jdms.getString(0);
return true; return true;
} }
...@@ -159,19 +158,19 @@ public class TMLADDecrypt extends TGCWithoutInternalComponent implements Embedde ...@@ -159,19 +158,19 @@ public class TMLADDecrypt extends TGCWithoutInternalComponent implements Embedde
if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) {
return this; return this;
} }
if ((int)(Line2D.ptSegDistSq(x+(width/2), y-lineLength, x+(width/2), y + lineLength + height, _x, _y)) < distanceSelected) { if ((int) (Line2D.ptSegDistSq(x + (width / 2), y - lineLength, x + (width / 2), y + lineLength + height, _x, _y)) < distanceSelected) {
return this; return this;
} }
if ((int)(Line2D.ptSegDistSq(x+width, y+height/2, x+width +lineLength, y+height/2, _x, _y)) < distanceSelected) { if ((int) (Line2D.ptSegDistSq(x + width, y + height / 2, x + width + lineLength, y + height / 2, _x, _y)) < distanceSelected) {
return this; return this;
} }
return null; return null;
} }
protected String translateExtraParam() { protected String translateExtraParam() {
StringBuffer sb = new StringBuffer("<extraparam>\n"); StringBuffer sb = new StringBuffer("<extraparam>\n");
sb.append("<Data secPattern=\""); sb.append("<Data secPattern=\"");
sb.append(securityContext); sb.append(securityContext);
...@@ -179,27 +178,27 @@ public class TMLADDecrypt extends TGCWithoutInternalComponent implements Embedde ...@@ -179,27 +178,27 @@ public class TMLADDecrypt extends TGCWithoutInternalComponent implements Embedde
sb.append("</extraparam>\n"); sb.append("</extraparam>\n");
return new String(sb); return new String(sb);
} }
@Override @Override
public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException {
//System.out.println("*** load extra synchro *** " + getId()); //System.out.println("*** load extra synchro *** " + getId());
try { try {
NodeList nli; NodeList nli;
Node n1, n2; Node n1, n2;
Element elt; Element elt;
// int k; // int k;
// String s; // String s;
//System.out.println("Loading Synchronization gates"); //System.out.println("Loading Synchronization gates");
//System.out.println(nl.toString()); //System.out.println(nl.toString());
for(int i=0; i<nl.getLength(); i++) { for (int i = 0; i < nl.getLength(); i++) {
n1 = nl.item(i); n1 = nl.item(i);
//System.out.println(n1); //System.out.println(n1);
if (n1.getNodeType() == Node.ELEMENT_NODE) { if (n1.getNodeType() == Node.ELEMENT_NODE) {
nli = n1.getChildNodes(); nli = n1.getChildNodes();
for(int j=0; j<nli.getLength(); j++) { for (int j = 0; j < nli.getLength(); j++) {
n2 = nli.item(j); n2 = nli.item(j);
//System.out.println(n2); //System.out.println(n2);
if (n2.getNodeType() == Node.ELEMENT_NODE) { if (n2.getNodeType() == Node.ELEMENT_NODE) {
...@@ -212,22 +211,22 @@ public class TMLADDecrypt extends TGCWithoutInternalComponent implements Embedde ...@@ -212,22 +211,22 @@ public class TMLADDecrypt extends TGCWithoutInternalComponent implements Embedde
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new MalformedModelingException(); throw new MalformedModelingException();
} }
} }
public int getType() { public int getType() {
return TGComponentManager.TMLAD_DECRYPT; return TGComponentManager.TMLAD_DECRYPT;
} }
public int getDefaultConnector() { public int getDefaultConnector() {
return TGComponentManager.CONNECTOR_TMLAD; return TGComponentManager.CONNECTOR_TMLAD;
}
public void setStateAction(int _stateAction) {
stateOfError = _stateAction;
} }
public void setStateAction(int _stateAction) {
stateOfError = _stateAction;
}
} }
/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille /* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
* *
* ludovic.apvrille AT enst.fr * ludovic.apvrille AT enst.fr
* *
* This software is a computer program whose purpose is to allow the * This software is a computer program whose purpose is to allow the
* edition of TURTLE analysis, design and deployment diagrams, to * edition of TURTLE analysis, design and deployment diagrams, to
* allow the generation of RT-LOTOS or Java code from this diagram, * allow the generation of RT-LOTOS or Java code from this diagram,
* and at last to allow the analysis of formal validation traces * and at last to allow the analysis of formal validation traces
* obtained from external tools, e.g. RTL from LAAS-CNRS and CADP * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
* from INRIA Rhone-Alpes. * from INRIA Rhone-Alpes.
* *
* This software is governed by the CeCILL license under French law and * This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use, * abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL * modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL * license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info". * "http://www.cecill.info".
* *
* As a counterpart to the access to the source code and rights to copy, * As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only * modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the * with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited * economic rights, and the successive licensors have only limited
* liability. * liability.
* *
* In this respect, the user's attention is drawn to the risks associated * In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the * with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software, * software by the user in light of its specific status of free software,
...@@ -31,14 +31,12 @@ ...@@ -31,14 +31,12 @@
* requirements in conditions enabling the security of their systems and/or * requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the * data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security. * same conditions as regards security.
* *
* The fact that you are presently reading this means that you have had * The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms. * knowledge of the CeCILL license and that you accept its terms.
*/ */
package ui.tmlad; package ui.tmlad;
import myutil.GraphicLib; import myutil.GraphicLib;
...@@ -57,161 +55,156 @@ import java.awt.geom.Line2D; ...@@ -57,161 +55,156 @@ import java.awt.geom.Line2D;
* Class TMLADEncrypt * Class TMLADEncrypt
* Create security pattern and encrypt. To be used in TML activity diagrams * Create security pattern and encrypt. To be used in TML activity diagrams
* Creation: 21/11/2005 * Creation: 21/11/2005
* @version 1.0 21/11/2005 *
* @author Ludovic APVRILLE * @author Ludovic APVRILLE
* @version 1.0 21/11/2005
*/ */
public class TMLADEncrypt extends TGCWithoutInternalComponent implements EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight { public class TMLADEncrypt extends TGCWithoutInternalComponent implements EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight {
private int lineLength = 5; private int lineLength = 5;
// private int textX, textY; // private int textX, textY;
private int ex=5; private int ex = 5;
private int textHeight=8; private int textHeight = 8;
private int ilength = 12; private int ilength = 12;
private int lineLength1 = 3; private int lineLength1 = 3;
public String type=""; public String type = "";
public String message_overhead=""; public String message_overhead = "";
public String size=""; public String size = "";
public String securityContext=""; public String securityContext = "";
public String encTime="100"; public String encTime = "100";
public String decTime="100"; public String decTime = "100";
public String key =""; public String key = "";
public String nonce=""; public String nonce = "";
public String formula=""; public String formula = "";
public String algorithm=""; public String algorithm = "";
protected int stateOfError = 0; // Not yet checked protected int stateOfError = 0; // Not yet checked
public TMLADEncrypt(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { public TMLADEncrypt(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) {
super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp);
width = 15; width = 15;
height = 35; height = 35;
// textX = width + 5; // textX = width + 5;
// textY = height/2 + 5; // textY = height/2 + 5;
nbConnectingPoint = 2; nbConnectingPoint = 2;
connectingPoint = new TGConnectingPoint[2]; connectingPoint = new TGConnectingPoint[2];
connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0);
connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, + lineLength+ex, false, true, 0.5, 1.0); connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, +lineLength + ex, false, true, 0.5, 1.0);
moveable = true; moveable = true;
editable = true; editable = true;
removable = true; removable = true;
name = "encrypt"; name = "encrypt";
myImageIcon = IconManager.imgic214; myImageIcon = IconManager.imgic214;
} }
public void internalDrawing(Graphics g) { public void internalDrawing(Graphics g) {
if (stateOfError > 0) { if (stateOfError > 0) {
Color c = g.getColor(); Color c = g.getColor();
switch(stateOfError) { switch (stateOfError) {
case ErrorHighlight.OK: case ErrorHighlight.OK:
g.setColor(ColorManager.EXEC); g.setColor(ColorManager.EXEC);
break; break;
default: default:
g.setColor(ColorManager.UNKNOWN_BOX_ACTION); g.setColor(ColorManager.UNKNOWN_BOX_ACTION);
} }
g.fillRect(x, y, width, height); g.fillRect(x, y, width, height);
int[] xP = new int[]{x,x+width,x+width/2}; int[] xP = new int[]{x, x + width, x + width / 2};
int[] yP = new int[]{y+height, y+height, y+height+ex}; int[] yP = new int[]{y + height, y + height, y + height + ex};
g.fillPolygon(xP,yP,3); g.fillPolygon(xP, yP, 3);
g.setColor(c); g.setColor(c);
} }
g.drawLine(x, y, x+width, y); g.drawLine(x, y, x + width, y);
g.drawLine(x, y, x, y+height); g.drawLine(x, y, x, y + height);
g.drawLine(x+width, y, x+width, y+height); g.drawLine(x + width, y, x + width, y + height);
g.drawLine(x, y+height, x+width/2, y+height+ex); g.drawLine(x, y + height, x + width / 2, y + height + ex);
g.drawLine(x+width/2, y+height+ex, x+width, y+height); g.drawLine(x + width / 2, y + height + ex, x + width, y + height);
g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); g.drawLine(x + (width / 2), y, x + (width / 2), y - lineLength);
g.drawLine(x+(width/2), y+height+ex, x+(width/2), y + lineLength + height+ex); g.drawLine(x + (width / 2), y + height + ex, x + (width / 2), y + lineLength + height + ex);
if (type.equals("Symmetric Encryption")){ if (type.equals("Symmetric Encryption")) {
//S //S
g.drawLine(x + ex, y+(height-ilength)/4, x + width -ex, y+(height-ilength)/4); g.drawLine(x + ex, y + (height - ilength) / 4, x + width - ex, y + (height - ilength) / 4);
g.drawLine(x + ex, y+(height-ilength)/4 + ilength, x + width-ex, y+(height-ilength)/4 + ilength); g.drawLine(x + ex, y + (height - ilength) / 4 + ilength, x + width - ex, y + (height - ilength) / 4 + ilength);
g.drawLine(x + ex, y+(height-ilength)/4 + ilength/2, x + width-ex, y+(height-ilength)/4 + ilength/2); g.drawLine(x + ex, y + (height - ilength) / 4 + ilength / 2, x + width - ex, y + (height - ilength) / 4 + ilength / 2);
g.drawLine(x + ex, y+(height-ilength)/4, x + ex, y+(height-ilength)/4 + ilength/2); g.drawLine(x + ex, y + (height - ilength) / 4, x + ex, y + (height - ilength) / 4 + ilength / 2);
g.drawLine(x + width-ex, y+(height-ilength)/4+ilength/2, x + width -ex, y+(height-ilength)/4 + ilength); g.drawLine(x + width - ex, y + (height - ilength) / 4 + ilength / 2, x + width - ex, y + (height - ilength) / 4 + ilength);
//E //E
g.drawLine(x + ex, y+(height-ilength)/4 + height/2 - ex/2, x + width -ex, y+(height-ilength)/4 + height/2 -ex/2); g.drawLine(x + ex, y + (height - ilength) / 4 + height / 2 - ex / 2, x + width - ex, y + (height - ilength) / 4 + height / 2 - ex / 2);
g.drawLine(x + ex, y+(height-ilength)/4 + ilength + height/2 -ex/2, x + width -ex, y+(height-ilength)/4 + ilength + height/2 -ex/2); g.drawLine(x + ex, y + (height - ilength) / 4 + ilength + height / 2 - ex / 2, x + width - ex, y + (height - ilength) / 4 + ilength + height / 2 - ex / 2);
g.drawLine(x + ex, y+(height-ilength)/4 + ilength/2 + height/2 - ex/2, x + width-ex, y+(height-ilength)/4 + ilength/2 + height/2 -ex/2); g.drawLine(x + ex, y + (height - ilength) / 4 + ilength / 2 + height / 2 - ex / 2, x + width - ex, y + (height - ilength) / 4 + ilength / 2 + height / 2 - ex / 2);
g.drawLine(x + ex, y+(height-ilength)/4 + height/2 - ex/2, x + ex, y+(height-ilength)/4 + ilength + height/2 -ex/2); g.drawLine(x + ex, y + (height - ilength) / 4 + height / 2 - ex / 2, x + ex, y + (height - ilength) / 4 + ilength + height / 2 - ex / 2);
} } else if (type.equals("Asymmetric Encryption")) {
//A
else if (type.equals("Asymmetric Encryption")) { g.drawLine(x + (width / 2), y + (height - ilength) / 4, x + ex, y + (height - ilength) / 4 + ilength);
//A g.drawLine(x + (width / 2), y + (height - ilength) / 4, x + (width) - ex, y + (height - ilength) / 4 + ilength);
g.drawLine(x + (width/2), y+(height-ilength)/4, x + ex, y+(height-ilength)/4+ilength); g.drawLine(x + 3 * ex / 2, y + (height - ilength) / 4 + ilength / 2 + ex / 2, x + width - 3 * ex / 2, y + (height - ilength) / 4 + ilength / 2 + ex / 2);
g.drawLine(x + (width/2), y+(height-ilength)/4, x + (width) - ex, y+(height-ilength)/4 + ilength); //E
g.drawLine(x + 3*ex/2, y+(height-ilength)/4 + ilength/2 + ex/2, x + width - 3*ex/2, y+(height-ilength)/4 + ilength/2+ex/2); g.drawLine(x + ex, y + (height - ilength) / 4 + height / 2 - ex / 2, x + width - ex, y + (height - ilength) / 4 + height / 2 - ex / 2);
//E g.drawLine(x + ex, y + (height - ilength) / 4 + ilength + height / 2 - ex / 2, x + width - ex, y + (height - ilength) / 4 + ilength + height / 2 - ex / 2);
g.drawLine(x + ex, y+(height-ilength)/4 + height/2 - ex/2, x +width-ex, y+(height-ilength)/4 + height/2 -ex/2); g.drawLine(x + ex, y + (height - ilength) / 4 + ilength / 2 + height / 2 - ex / 2, x + width - ex, y + (height - ilength) / 4 + ilength / 2 + height / 2 - ex / 2);
g.drawLine(x + ex, y+(height-ilength)/4 + ilength + height/2 -ex/2, x + width -ex, y+(height-ilength)/4 + ilength + height/2 -ex/2); g.drawLine(x + ex, y + (height - ilength) / 4 + height / 2 - ex / 2, x + ex, y + (height - ilength) / 4 + ilength + height / 2 - ex / 2);
g.drawLine(x + ex, y+(height-ilength)/4 + ilength/2 + height/2 - ex/2, x + width -ex, y+(height-ilength)/4 + ilength/2 + height/2 -ex/2); } else if (type.equals("Nonce")) {
g.drawLine(x + ex, y+(height-ilength)/4 + height/2 - ex/2, x + ex, y+(height-ilength)/4 + ilength + height/2 -ex/2); //N
} g.drawLine(x + (width / 2) - lineLength1, y + (height - ilength) / 2, x + (width / 2) - lineLength1, y + (height - ilength) / 2 + ilength);
else if (type.equals("Nonce")){ g.drawLine(x + (width / 2) + lineLength1, y + (height - ilength) / 2, x + (width / 2) + lineLength1, y + (height - ilength) / 2 + ilength);
//N g.drawLine(x + (width / 2) - lineLength1, y + (height - ilength) / 2, x + (width / 2) + lineLength1, y + (height - ilength) / 2 + ilength);
g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2, x + (width/2) - lineLength1, y+(height-ilength)/2+ilength); } else if (type.equals("MAC")) {
g.drawLine(x + (width/2) + lineLength1, y+(height-ilength)/2, x + (width/2) + lineLength1, y+(height-ilength)/2+ilength); //M
g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2, x + (width/2) + lineLength1, y+(height-ilength)/2+ilength); g.drawLine(x + ex / 2 + 1, y + (height - ilength) / 2, x + ex / 2 + 1, y + (height - ilength) / 2 + ilength);
} g.drawLine(x + width - ex / 2 - 1, y + (height - ilength) / 2, x + width - ex / 2 - 1, y + (height - ilength) / 2 + ilength);
else if (type.equals("MAC")){ g.drawLine(x + ex / 2 + 1, y + (height - ilength) / 2, x + width / 2, y + (height - ilength) / 2 + ilength);
//M g.drawLine(x + width - ex / 2 - 1, y + (height - ilength) / 2, x + width / 2, y + (height - ilength) / 2 + ilength);
g.drawLine(x + ex/2+1, y+(height-ilength)/2, x + ex/2+1, y+(height-ilength)/2+ilength); } else if (type.equals("Hash")) {
g.drawLine(x + width -ex/2-1, y+(height-ilength)/2, x + width - ex/2-1, y+(height-ilength)/2+ilength); g.drawLine(x + (width / 2) - lineLength1, y + (height - ilength) / 2, x + (width / 2) - lineLength1, y + (height - ilength) / 2 + ilength);
g.drawLine(x + ex/2+1, y+(height-ilength)/2, x+width/2, y+(height-ilength)/2+ilength); g.drawLine(x + (width / 2) + lineLength1, y + (height - ilength) / 2, x + (width / 2) + lineLength1, y + (height - ilength) / 2 + ilength);
g.drawLine(x + width - ex/2-1, y+(height-ilength)/2, x + width/2, y+(height-ilength)/2+ilength); g.drawLine(x + (width / 2) - lineLength1, y + (height - ilength) / 2 + ilength / 2, x + (width / 2) + lineLength1, y + (height - ilength) / 2 + ilength / 2);
} } else if (type.equals("Advanced")) {
else if (type.equals("Hash")){ //A
g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2, x + (width/2) - lineLength1, y+(height-ilength)/2+ilength); g.drawLine(x + (width / 2), y + (height - ilength) / 2, x + ex, y + (height - ilength) / 2 + ilength);
g.drawLine(x + (width/2) + lineLength1, y+(height-ilength)/2, x + (width/2) + lineLength1, y+(height-ilength)/2+ilength); g.drawLine(x + (width / 2), y + (height - ilength) / 2, x + (width) - ex, y + (height - ilength) / 2 + ilength);
g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2 + ilength/2, x + (width/2) + lineLength1, y+(height-ilength)/2 + ilength/2); g.drawLine(x + 3 * ex / 2, y + (height - ilength) / 2 + ilength / 2 + ex / 2, x + width - 3 * ex / 2, y + (height - ilength) / 2 + ilength / 2 + ex / 2);
} }
else if (type.equals("Advanced")){ //Draw security pattern
//A g.drawString("sec:" + securityContext, x + 3 * width / 2, y + height / 2);
g.drawLine(x + (width/2), y+(height-ilength)/2, x + ex, y+(height-ilength)/2+ilength); //Draw nonce if it exists
g.drawLine(x + (width/2), y+(height-ilength)/2, x + (width) - ex, y+(height-ilength)/2 + ilength); if (!nonce.isEmpty()) {
g.drawLine(x + 3*ex/2, y+(height-ilength)/2 + ilength/2 + ex/2, x + width - 3*ex/2, y+(height-ilength)/2 + ilength/2+ex/2); g.drawString("nonce:" + nonce, x + 3 * width / 2, y + height / 2 + textHeight);
} }
//Draw security pattern //Draw key if it exists
g.drawString("sec:"+ securityContext, x+3*width/2, y+ height/2); if (!key.isEmpty()) {
//Draw nonce if it exists g.drawString("key:" + key, x + 3 * width / 2, y + height / 2 + 2 * textHeight);
if (!nonce.isEmpty()){ }
g.drawString("nonce:"+ nonce, x+3*width/2, y+ height/2+textHeight); g.drawImage(IconManager.imgic7000.getImage(), x - 22, y + height / 2, null);
}
//Draw key if it exists
if (!key.isEmpty()){
g.drawString("key:"+ key, x+3*width/2, y+ height/2+2*textHeight);
}
g.drawImage(IconManager.imgic7000.getImage(), x - 22, y + height/2, null);
} }
public boolean editOndoubleClick(JFrame frame) { public boolean editOndoubleClick(JFrame frame) {
//JDialogTwoString jdts = new JDialogTwoString(frame, "Setting channel's properties", "Channel name", channelName, "Nb of samples", nbOfSamples);] //JDialogTwoString jdts = new JDialogTwoString(frame, "Setting channel's properties", "Channel name", channelName, "Nb of samples", nbOfSamples);]
String[] values=new String[]{securityContext, type, message_overhead, encTime, size, nonce, formula, decTime, key,algorithm}; String[] values = new String[]{securityContext, type, message_overhead, encTime, size, nonce, formula, decTime, key, algorithm};
String[] nonces=tdp.getMGUI().getAllNonce(); String[] nonces = tdp.getMGUI().getAllNonce();
String[] keys = tdp.getMGUI().getAllKeys().toArray(new String[0]); String[] keys = tdp.getMGUI().getAllKeys().toArray(new String[0]);
JDialogCryptographicConfiguration jdms = new JDialogCryptographicConfiguration(frame, "Setting Cryptographic Configuration properties", values, nonces, keys); JDialogCryptographicConfiguration jdms = new JDialogCryptographicConfiguration(frame, "Setting Cryptographic Configuration properties", values, nonces, keys);
// jdms.setSize(650, 300); // jdms.setSize(650, 300);
GraphicLib.centerOnParent(jdms, 650, 300); GraphicLib.centerOnParent(jdms, 650, 450);
jdms.setVisible( true ); // blocked until dialog has been closed jdms.setVisible(true); // blocked until dialog has been closed
if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { if (jdms.hasBeenSet() && (jdms.hasValidString(0))) {
securityContext = jdms.getString(0); securityContext = jdms.getString(0);
type=jdms.getString(1); type = jdms.getString(1);
message_overhead=jdms.getString(2); message_overhead = jdms.getString(2);
encTime=jdms.getString(3); encTime = jdms.getString(3);
size=jdms.getString(4); size = jdms.getString(4);
nonce=jdms.getString(5); nonce = jdms.getString(5);
formula = jdms.getString(6); formula = jdms.getString(6);
decTime = jdms.getString(7); decTime = jdms.getString(7);
key = jdms.getString(8); key = jdms.getString(8);
algorithm=jdms.getString(9); algorithm = jdms.getString(9);
return true; return true;
} }
return false; return false;
} }
...@@ -220,19 +213,19 @@ public class TMLADEncrypt extends TGCWithoutInternalComponent implements Embedde ...@@ -220,19 +213,19 @@ public class TMLADEncrypt extends TGCWithoutInternalComponent implements Embedde
if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) {
return this; return this;
} }
if ((int)(Line2D.ptSegDistSq(x+(width/2), y-lineLength, x+(width/2), y + lineLength + height, _x, _y)) < distanceSelected) { if ((int) (Line2D.ptSegDistSq(x + (width / 2), y - lineLength, x + (width / 2), y + lineLength + height, _x, _y)) < distanceSelected) {
return this; return this;
} }
if ((int)(Line2D.ptSegDistSq(x+width, y+height/2, x+width +lineLength, y+height/2, _x, _y)) < distanceSelected) { if ((int) (Line2D.ptSegDistSq(x + width, y + height / 2, x + width + lineLength, y + height / 2, _x, _y)) < distanceSelected) {
return this; return this;
} }
return null; return null;
} }
protected String translateExtraParam() { protected String translateExtraParam() {
StringBuffer sb = new StringBuffer("<extraparam>\n"); StringBuffer sb = new StringBuffer("<extraparam>\n");
sb.append("<Data secContext=\""); sb.append("<Data secContext=\"");
sb.append(securityContext); sb.append(securityContext);
...@@ -240,15 +233,15 @@ public class TMLADEncrypt extends TGCWithoutInternalComponent implements Embedde ...@@ -240,15 +233,15 @@ public class TMLADEncrypt extends TGCWithoutInternalComponent implements Embedde
sb.append(type); sb.append(type);
sb.append("\" overhead=\""); sb.append("\" overhead=\"");
sb.append(message_overhead); sb.append(message_overhead);
sb.append("\" size=\""); sb.append("\" size=\"");
sb.append(size); sb.append(size);
sb.append("\" encTime=\""); sb.append("\" encTime=\"");
sb.append(encTime); sb.append(encTime);
sb.append("\" decTime=\""); sb.append("\" decTime=\"");
sb.append(decTime); sb.append(decTime);
sb.append("\" nonce=\""); sb.append("\" nonce=\"");
sb.append(nonce); sb.append(nonce);
sb.append("\" key=\""); sb.append("\" key=\"");
sb.append(key); sb.append(key);
sb.append("\" algorithm=\""); sb.append("\" algorithm=\"");
sb.append(algorithm); sb.append(algorithm);
...@@ -256,63 +249,63 @@ public class TMLADEncrypt extends TGCWithoutInternalComponent implements Embedde ...@@ -256,63 +249,63 @@ public class TMLADEncrypt extends TGCWithoutInternalComponent implements Embedde
sb.append("</extraparam>\n"); sb.append("</extraparam>\n");
return new String(sb); return new String(sb);
} }
@Override @Override
public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException {
//System.out.println("*** load extra synchro *** " + getId()); //System.out.println("*** load extra synchro *** " + getId());
try { try {
NodeList nli; NodeList nli;
Node n1, n2; Node n1, n2;
Element elt; Element elt;
// int k; // int k;
// String s; // String s;
//System.out.println("Loading Synchronization gates"); //System.out.println("Loading Synchronization gates");
//System.out.println(nl.toString()); //System.out.println(nl.toString());
for(int i=0; i<nl.getLength(); i++) { for (int i = 0; i < nl.getLength(); i++) {
n1 = nl.item(i); n1 = nl.item(i);
//System.out.println(n1); //System.out.println(n1);
if (n1.getNodeType() == Node.ELEMENT_NODE) { if (n1.getNodeType() == Node.ELEMENT_NODE) {
nli = n1.getChildNodes(); nli = n1.getChildNodes();
for(int j=0; j<nli.getLength(); j++) { for (int j = 0; j < nli.getLength(); j++) {
n2 = nli.item(j); n2 = nli.item(j);
//System.out.println(n2); //System.out.println(n2);
if (n2.getNodeType() == Node.ELEMENT_NODE) { if (n2.getNodeType() == Node.ELEMENT_NODE) {
elt = (Element) n2; elt = (Element) n2;
if (elt.getTagName().equals("Data")) { if (elt.getTagName().equals("Data")) {
securityContext = elt.getAttribute("secContext"); securityContext = elt.getAttribute("secContext");
type= elt.getAttribute("type"); type = elt.getAttribute("type");
message_overhead= elt.getAttribute("overhead"); message_overhead = elt.getAttribute("overhead");
size= elt.getAttribute("size"); size = elt.getAttribute("size");
encTime = elt.getAttribute("encTime"); encTime = elt.getAttribute("encTime");
decTime = elt.getAttribute("decTime"); decTime = elt.getAttribute("decTime");
nonce = elt.getAttribute("nonce"); nonce = elt.getAttribute("nonce");
key = elt.getAttribute("key"); key = elt.getAttribute("key");
algorithm = elt.getAttribute("algorithm"); algorithm = elt.getAttribute("algorithm");
//System.out.println("eventName=" +eventName + " variable=" + result); //System.out.println("eventName=" +eventName + " variable=" + result);
} }
} }
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new MalformedModelingException(); throw new MalformedModelingException();
} }
} }
public int getType() { public int getType() {
return TGComponentManager.TMLAD_ENCRYPT; return TGComponentManager.TMLAD_ENCRYPT;
} }
public int getDefaultConnector() { public int getDefaultConnector() {
return TGComponentManager.CONNECTOR_TMLAD; return TGComponentManager.CONNECTOR_TMLAD;
}
public void setStateAction(int _stateAction) {
stateOfError = _stateAction;
} }
public void setStateAction(int _stateAction) {
stateOfError = _stateAction;
}
} }
...@@ -216,15 +216,15 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac ...@@ -216,15 +216,15 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac
} }
if (repanel){ if (repanel){
c0.gridwidth = 1; /*c0.gridwidth = 1;
c0.gridheight = 10; c0.gridheight = 10;
c0.weighty = 1.0; c0.weighty = 1.0;
c0.weightx = 1.0; c0.weightx = 1.0;
c0.gridwidth = GridBagConstraints.REMAINDER; //end row c0.gridwidth = GridBagConstraints.REMAINDER; //end row*/
c.add(panel1,c0); c.add(panel1, BorderLayout.CENTER);
// main panel; // main panel;
c0.gridwidth = 1; /*c0.gridwidth = 1;
c0.gridheight = 1; c0.gridheight = 1;
c0.fill = GridBagConstraints.HORIZONTAL; c0.fill = GridBagConstraints.HORIZONTAL;
closeButton = new JButton("Save and Close", IconManager.imgic25); closeButton = new JButton("Save and Close", IconManager.imgic25);
...@@ -234,7 +234,11 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac ...@@ -234,7 +234,11 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac
c0.gridwidth = GridBagConstraints.REMAINDER; //end row c0.gridwidth = GridBagConstraints.REMAINDER; //end row
cancelButton = new JButton("Cancel", IconManager.imgic27); cancelButton = new JButton("Cancel", IconManager.imgic27);
cancelButton.addActionListener(this); cancelButton.addActionListener(this);
c.add(cancelButton, c0); c.add(cancelButton, c0);*/
initButtons(c, this);
JPanel panelButton = initBasicButtons(this);
c.add(panelButton, BorderLayout.SOUTH);
this.invalidate(); this.invalidate();
this.validate(); this.validate();
this.repaint(); this.repaint();
...@@ -298,17 +302,21 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac ...@@ -298,17 +302,21 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac
c1.weightx = 1.0; c1.weightx = 1.0;
c1.fill = GridBagConstraints.HORIZONTAL; c1.fill = GridBagConstraints.HORIZONTAL;
c1.anchor = GridBagConstraints.CENTER; c1.anchor = GridBagConstraints.CENTER;
String[] vals = new String[]{"Symmetric Encryption", "Asymmetric Encryption","MAC", "Hash", "Nonce", "Advanced"}; String[] vals = new String[]{"Symmetric Encryption", "Asymmetric Encryption","MAC", "Hash", "Nonce", "Advanced"};
addEmptyLine(c1);
// String1 // String1
c1.gridwidth = 1; c1.gridwidth = 1;
add(new JLabel("Cryptographic Configuration Name"),c1); add(new JLabel("Cryptographic Configuration Name"),c1);
addEmptyLine(c1);
texts[0]=new JTextField(values[0],15); texts[0]=new JTextField(values[0],15);
c1.gridwidth = GridBagConstraints.REMAINDER; //end row c1.gridwidth = GridBagConstraints.REMAINDER; //end row
add(texts[0],c1); add(texts[0],c1);
c1.gridwidth=1;
addEmptyLine(c1);
c1.gridwidth=1;
add(new JLabel("Security Pattern"), c1); add(new JLabel("Security Pattern"), c1);
helps.put(1, new JComboBox<>(vals)); helps.put(1, new JComboBox<>(vals));
helps.get(1).setSelectedItem(values[1]); helps.get(1).setSelectedItem(values[1]);
...@@ -372,6 +380,8 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac ...@@ -372,6 +380,8 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac
texts[8]=new JTextField(values[8], 15); texts[8]=new JTextField(values[8], 15);
add(texts[8], c1); add(texts[8], c1);
addEmptyLine(c1);
c1.gridwidth = 1; c1.gridwidth = 1;
add(new JLabel("Algorithm"),c1); add(new JLabel("Algorithm"),c1);
helps.put(9, new JComboBox<>(algNames)); helps.put(9, new JComboBox<>(algNames));
...@@ -392,6 +402,15 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac ...@@ -392,6 +402,15 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac
} }
public class funcPanel extends JPanel { public class funcPanel extends JPanel {
private void addEmptyLine(GridBagConstraints gc) {
gc.weighty = 1.0;
gc.weightx = 1.0;
gc.gridwidth = GridBagConstraints.REMAINDER; //end row
gc.fill = GridBagConstraints.BOTH;
gc.gridheight = 1;
add(new JLabel(" "), gc);
}
funcPanel(JDialogCryptographicConfiguration j){ funcPanel(JDialogCryptographicConfiguration j){
GridBagConstraints c1 = new GridBagConstraints(); GridBagConstraints c1 = new GridBagConstraints();
GridBagLayout gridbag1 = new GridBagLayout(); GridBagLayout gridbag1 = new GridBagLayout();
...@@ -419,6 +438,9 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac ...@@ -419,6 +438,9 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac
c1.anchor = GridBagConstraints.CENTER; c1.anchor = GridBagConstraints.CENTER;
String[] vals = new String[]{"Symmetric Encryption", "Asymmetric Encryption","MAC", "Hash", "Nonce", "Advanced"}; String[] vals = new String[]{"Symmetric Encryption", "Asymmetric Encryption","MAC", "Hash", "Nonce", "Advanced"};
// String1 // String1
addEmptyLine(c1);
c1.gridwidth = 1; c1.gridwidth = 1;
add(new JLabel("Cryptographic Configuration Name"),c1); add(new JLabel("Cryptographic Configuration Name"),c1);
texts[0]=new JTextField(values[0],15); texts[0]=new JTextField(values[0],15);
...@@ -438,6 +460,8 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac ...@@ -438,6 +460,8 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac
texts[1]=new JTextField(values[1], 15); texts[1]=new JTextField(values[1], 15);
add(texts[1], c1); add(texts[1], c1);
addEmptyLine(c1);
c1.gridwidth = 1; c1.gridwidth = 1;
add(new JLabel("Computational Complexity"),c1); add(new JLabel("Computational Complexity"),c1);
texts[3]=new JTextField(values[3],15); texts[3]=new JTextField(values[3],15);
...@@ -450,6 +474,8 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac ...@@ -450,6 +474,8 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac
c1.gridwidth = GridBagConstraints.REMAINDER; //end row c1.gridwidth = GridBagConstraints.REMAINDER; //end row
add(texts[4],c1); add(texts[4],c1);
addEmptyLine(c1);
c1.gridwidth = 1; c1.gridwidth = 1;
add(new JLabel("Algorithm"),c1); add(new JLabel("Algorithm"),c1);
helps.put(9, new JComboBox<>(algNames)); helps.put(9, new JComboBox<>(algNames));
...@@ -467,6 +493,15 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac ...@@ -467,6 +493,15 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac
public class advPanel extends JPanel { public class advPanel extends JPanel {
private void addEmptyLine(GridBagConstraints gc) {
gc.weighty = 1.0;
gc.weightx = 1.0;
gc.gridwidth = GridBagConstraints.REMAINDER; //end row
gc.fill = GridBagConstraints.BOTH;
gc.gridheight = 1;
add(new JLabel(" "), gc);
}
advPanel(JDialogCryptographicConfiguration j){ advPanel(JDialogCryptographicConfiguration j){
GridBagConstraints c1 = new GridBagConstraints(); GridBagConstraints c1 = new GridBagConstraints();
GridBagLayout gridbag1 = new GridBagLayout(); GridBagLayout gridbag1 = new GridBagLayout();
...@@ -494,6 +529,8 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac ...@@ -494,6 +529,8 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac
c1.anchor = GridBagConstraints.CENTER; c1.anchor = GridBagConstraints.CENTER;
String[] vals = new String[]{"Symmetric Encryption", "Asymmetric Encryption","MAC", "Hash", "Nonce", "Advanced"}; String[] vals = new String[]{"Symmetric Encryption", "Asymmetric Encryption","MAC", "Hash", "Nonce", "Advanced"};
addEmptyLine(c1);
// String1 // String1
c1.gridwidth = 1; c1.gridwidth = 1;
add(new JLabel("Cryptographic Configuration Name"),c1); add(new JLabel("Cryptographic Configuration Name"),c1);
...@@ -513,6 +550,8 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac ...@@ -513,6 +550,8 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac
texts[1]=new JTextField(values[1], 15); texts[1]=new JTextField(values[1], 15);
add(texts[1], c1); add(texts[1], c1);
addEmptyLine(c1);
c1.gridwidth = 1; c1.gridwidth = 1;
add(new JLabel("Overhead"),c1); add(new JLabel("Overhead"),c1);
texts[2]=new JTextField(values[2],15); texts[2]=new JTextField(values[2],15);
...@@ -526,7 +565,7 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac ...@@ -526,7 +565,7 @@ public class JDialogCryptographicConfiguration extends JDialogBase implements Ac
c1.gridwidth = GridBagConstraints.REMAINDER; //end row c1.gridwidth = GridBagConstraints.REMAINDER; //end row
add(texts[3],c1); add(texts[3],c1);
addEmptyLine(c1);
c1.gridwidth=1; c1.gridwidth=1;
add(new JLabel("Custom Security Formula"), c1); add(new JLabel("Custom Security Formula"), c1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment