Skip to content

Commit

Permalink
Merge pull request jcryptool#186 from tforneberg/SIGN_VERI_GUI_FIX
Browse files Browse the repository at this point in the history
Signature verification (and signature demonstration) plugin improvements
  • Loading branch information
simlei authored Sep 14, 2018
2 parents 6f33248 + 252b4c2 commit fa42087
Show file tree
Hide file tree
Showing 97 changed files with 2,919 additions and 2,047 deletions.
2 changes: 1 addition & 1 deletion org.jcryptool.visual.arc4/nl/en/contexts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<contexts>
<context id="arc4view" title="Visualization of ARC4">
<description>This visualization demonstrates the functionality of ARC4</description>
<topic href="nl/en/help/content/index.html" label="ARC4-Algorithm"/>
<topic href="nl/en/help/content/index.html" label="ARC4 Algorithm"/>
</context>
</contexts>
2 changes: 1 addition & 1 deletion org.jcryptool.visual.arc4/nl/en/toc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<?NLS TYPE="org.eclipse.help.toc"?>

<toc label="ARC4-Algorithm" link_to="../org.jcryptool.core.help/$nl$/toc.xml#visualizationPlugins">
<topic href="$nl$/help/content/index.html" label="ARC4-Algorithm">
<topic href="$nl$/help/content/index.html" label="ARC4 Algorithm">
</topic>
</toc>
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void widgetSelected(SelectionEvent e) {
KeyStoreAlias pubAlias = (KeyStoreAlias) cmb_keys.getData(cmb_keys.getText());
KeyStoreAlias privAlias = KeyStoreManager.getInstance().getPrivateForPublic(pubAlias);
org.jcryptool.visual.sig.algorithm.Input.publicKey = pubAlias;
org.jcryptool.visual.sig.algorithm.Input.privateKey = privAlias;
org.jcryptool.visual.sig.algorithm.Input.privateKeyJCTCA = privAlias;
org.jcryptool.visual.sig.algorithm.Input.data = (!lbl_file.getText().isEmpty() ? lbl_file //$NON-NLS-1$
.getText() : txt_sign.getText()).getBytes();
org.jcryptool.visual.sig.algorithm.Input.path = lbl_file.getText();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void signaturePerformed(SignatureEvent e) {
Signature signature = new Signature(e.getSignature(), e.getPath(), e.getText(), new Date(
System.currentTimeMillis()), e.getPrivAlias(), e.getPubAlias(), e.getHashAlgorithm());
CertificateCSRR.getInstance().addSignature(signature);
Input.privateKey = null;
Input.privateKeyJCTCA = null;
Input.publicKey = null;
}
}
41 changes: 21 additions & 20 deletions org.jcryptool.visual.sig/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.jcryptool.visual.sig; singleton:=true
Bundle-Version: 1.0.0
Require-Bundle: org.jcryptool.crypto.keystore;bundle-version="1.0.0",
org.eclipse.core.runtime,
org.eclipse.ui,
org.jcryptool.core.logging;bundle-version="1.0.0",
org.bouncycastle;bundle-version="1.48.0",
org.eclipse.help,
org.jcryptool.core.operations
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Activator: org.jcryptool.visual.sig.SigPlugin
Bundle-ActivationPolicy: lazy
Import-Package: de.flexiprovider.core.dsa,
de.flexiprovider.core.rsa
Export-Package: org.jcryptool.visual.sig.algorithm,
org.jcryptool.visual.sig.listener
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.jcryptool.visual.sig; singleton:=true
Bundle-Version: 1.0.0
Require-Bundle: org.jcryptool.crypto.keystore;bundle-version="1.0.0",
org.eclipse.core.runtime,
org.eclipse.ui,
org.jcryptool.core.logging;bundle-version="1.0.0",
org.bouncycastle;bundle-version="1.48.0",
org.eclipse.help,
org.jcryptool.core.operations
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Activator: org.jcryptool.visual.sig.SigPlugin
Bundle-ActivationPolicy: lazy
Import-Package: de.flexiprovider.core.dsa,
de.flexiprovider.core.rsa,
de.flexiprovider.ec.keys
Export-Package: org.jcryptool.visual.sig.algorithm,
org.jcryptool.visual.sig.listener
Bundle-Vendor: %Bundle-Vendor
Automatic-Module-Name: org.jcryptool.visual.sig
Automatic-Module-Name: org.jcryptool.visual.sig
2 changes: 1 addition & 1 deletion org.jcryptool.visual.sig/OSGI-INF/l10n/bundle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Properties file for org.jcryptool.visual.sig
Bundle-Vendor = jcryptool.org, by Cornelia Gierlinger and Florentina Grebe (FH Hagenberg)
Bundle-Name = Signature-Visualization Plug-in
Bundle-Name = Signature Demonstration Plug-in
view.name = Signature Demonstration
Visual.name = Signature Demonstration
Binary file modified org.jcryptool.visual.sig/nl/de/help/content/HashWizard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.jcryptool.visual.sig/nl/de/help/content/InputFile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.jcryptool.visual.sig/nl/de/help/content/InputText.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.jcryptool.visual.sig/nl/de/help/content/InputWizard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.jcryptool.visual.sig/nl/de/help/content/MainFinished.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.jcryptool.visual.sig/nl/de/help/content/MainStart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.jcryptool.visual.sig/nl/de/help/content/SignatureWizard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions org.jcryptool.visual.sig/nl/de/help/content/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ <h2>Schritt 3 – Signaturfunktion auswählen</h2>
<h3>Beschreibung der unterstützten Signaturfunktionen</h3>
<h4>DSA</h4>
<p>Der “Digital Signature Algorithm“ (DSA) (veröffentlicht im Jahr 1991 von NIST) ist ein „United States Federal Government“-Standard für digitale Signaturen. Entropie, Geheimhaltung und Einzigartigkeit des zufälligen Parameters k sind entscheidend für die Sicherheit von DSA. Jede Verletzung einer dieser drei Anforderungen kann dazu führen, dass der gesamte private Schlüssel dem Angreifer offenbart wird. Wird der zufällige Signatur-Wert ein zweites Mal verwendet, ein vorhersehbarer Wert berechnet oder sind nur einige Bits des Wertes in jeder der Signaturwerte undicht, kann DSA gebrochen werden.</p>
<p> Lernen Sie mehr über DSA: <a href="https://de.wikipedia.org/wiki/Digital_Signature_Algorithm" target="_blank">DSA auf Wikipedia</a></p>
<p>Lernen Sie mehr über DSA: <a href="https://de.wikipedia.org/wiki/Digital_Signature_Algorithm" target="_blank">DSA auf Wikipedia</a></p>
<h4>RSA</h4>
<p>RSA (veröffentlicht im Jahr 1977) ist ein Algorithmus für asymmetrische kryptographische Verfahren, die auf der mutmaßlichen Schwierigkeit der Faktorisierung von großen Zahlen, dem Faktorisierungsproblem, basiert. Jeder kann den öffentlichen Schlüssel zum Entschlüsseln einer Nachricht verwenden, aber mit den aktuelle veröffentlichten Methoden, kann nur jemand der die Primfaktoren kennt und vorausgesetzt der Schlüssel ist lang genug, die Nachricht tatsächlich dekodieren. Sichere Padding-Verfahren, wie beispielsweise RSA-PSS, sind für die Sicherheit der Signaturerstellung genauso notwendig wie für die der Verschlüsselung einer Nachricht. Der PKCS #1 Cryptography Standard definiert die Empfehlungen für die Implementierung asymmetrischer Kryptografie, die auf dem RSA-Algorithmus basieren.</p>
<p> Lernen Sie mehr über RSA: <a href="PLUGINS_ROOT/org.jcryptool.visual.rsa/$nl$/help/content/index.html">Besuchen Sie JCT-RSA</a></p>
<p>Lernen Sie mehr über RSA: <a href="PLUGINS_ROOT/org.jcryptool.visual.rsa/$nl$/help/content/index.html">Besuchen Sie JCT-RSA</a></p>
<h4>ECDSA</h4>
<p>Der “Elliptic Curve Digital Signature Algorithm” (ECDSA) (vorgeschlagen von Scott Vanstone im Jahr 1992) ist die elliptische Kurve analog dem “Digital Signature Algorithm“ (DSA). Im Gegensatz zum normalen diskreten Logarithmusproblem und dem Faktorisierungsproblem, sind für Elliptischen Kurven keine Probleme bekannt. Die Länge des privaten Schlüssels, der als sicher betrachtet wird, ist mit ECDSA wesentlich kürzer. Bei einem Sicherheitsniveau von 80 Bits, was bedeutet, ein Angreifer würde 2^80 Signaturerzeugungsprozesse benötigen um den privaten Schlüssel zu finden, ist die Größe eines öffentlichen DAS-Schlüssels mindestens 1024 Bit, während die Größe eines öffentlichen ECDA-Schlüssels 160 Bit wäre. </p>
<h4>RSA and MGF1</h4>
Expand Down
Binary file modified org.jcryptool.visual.sig/nl/en/help/content/HashWizard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.jcryptool.visual.sig/nl/en/help/content/InputFile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.jcryptool.visual.sig/nl/en/help/content/InputText.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.jcryptool.visual.sig/nl/en/help/content/InputWizard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.jcryptool.visual.sig/nl/en/help/content/MainFinished.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.jcryptool.visual.sig/nl/en/help/content/MainStart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.jcryptool.visual.sig/nl/en/help/content/ShowSigWizard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified org.jcryptool.visual.sig/nl/en/help/content/SignatureWizard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class Messages {
public static String SigComposite_tbtmNewItem_1;
public static String SigComposite_tbtmNewItem_2;
public static String SigComposite_tbtmNewItem_3;
public static String SigComposite_nextStep;
public static String SigComposite_lastStep;
public static String SigComposite_txtDescriptionOfStep1;
public static String SigComposite_txtDescriptionOfStep2;
public static String SigComposite_txtDescriptionOfStep3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class Input {
/**
* Contains the private key used to sign the data (given by JCTCA plugin)
*/
public static KeyStoreAlias privateKey;
public static KeyStoreAlias privateKeyJCTCA;

/**
* Contains the public key used to verify the data in the JCTCA plugin
Expand All @@ -80,7 +80,7 @@ public class Input {
/**
* Contains the private key used to sign the data (chosen in our plugin)
*/
public static KeyStoreAlias key;
public static KeyStoreAlias privateKey;

/**
* The path used to save the binary file
Expand All @@ -102,7 +102,7 @@ public static void reset() {
signature = null;
signatureHex = null;
signatureOct = null;
privateKey = null;
privateKeyJCTCA = null;
publicKey = null;
savePath = null;
h = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
// -----END DISCLAIMER-----
package org.jcryptool.visual.sig.algorithm;

import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.SecureRandom;
import java.security.Signature;
import java.util.Arrays;
import java.util.Date;
Expand Down Expand Up @@ -52,23 +49,14 @@ public static byte[] signInput(String signaturemethod, byte[] input, KeyStoreAli

Input.chosenHash = signaturemethod.replace("withRSA", ""); //$NON-NLS-1$ //$NON-NLS-2$

if (signaturemethod.contains("ECDSA")) { // Generate a key because there are no ECDSA Keys in the keystore //$NON-NLS-1$
// Generate a key pair
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("EC"); //$NON-NLS-1$
keyGen.initialize(256, SecureRandom.getInstance("SHA1PRNG")); //$NON-NLS-1$
KeyStoreManager ksm = KeyStoreManager.getInstance();

KeyPair pair = keyGen.generateKeyPair();
k = pair.getPrivate();
} else {
KeyStoreManager ksm = KeyStoreManager.getInstance();

// Check if called by JCT-CA
if (Input.privateKey != null) { // Use their key
Input.privateKey.getAliasString();
k = ksm.getPrivateKey(Input.privateKey, KeyStoreManager.KEY_PASSWORD);
} else { // Use own Key from given alias
k = ksm.getPrivateKey(alias, KeyStoreManager.KEY_PASSWORD);
}
// Check if called by JCT-CA
if (Input.privateKeyJCTCA != null) { // Use their key
Input.privateKeyJCTCA.getAliasString();
k = ksm.getPrivateKey(Input.privateKeyJCTCA, KeyStoreManager.KEY_PASSWORD);
} else { // Use own Key from given alias
k = ksm.getPrivateKey(alias, KeyStoreManager.KEY_PASSWORD);
}

// Get a signature object using the specified combo and sign the data with the private key
Expand All @@ -78,7 +66,7 @@ public static byte[] signInput(String signaturemethod, byte[] input, KeyStoreAli

signature = sig.sign();

if (Input.privateKey != null) {
if (Input.privateKeyJCTCA != null) {
String p = null;
String t = null;
if (Input.data != null) {
Expand All @@ -103,6 +91,16 @@ public static byte[] signInput(String signaturemethod, byte[] input, KeyStoreAli
Input.signatureHex = Input.bytesToHex(signature); // Hex String
Input.signatureOct = Input.toOctalString(signature, ""); //$NON-NLS-1$

//debugging
//System.out.println("Hash value generation data:");
//System.out.print(Input.bytesToHex(Arrays.copyOf(Input.data, 10)));
//System.out.println();

//debugging
//System.out.println("Signature value generation data:");
//System.out.print(Input.bytesToHex(Input.signature));
//System.out.println();

//The first 1024 bytes of data get converted to hex representation
int maxHexLength = 1024; //1kB
if (Input.data.length > maxHexLength)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ SigComposite_grpSignatureGeneration=Signature generation
SigComposite_grpSignedDoc=Signed document
SigComposite_description=This visualization demonstrates the creation of a digital signature for a given document (message). A digital signature can be used to verify the identity of the message's signer.

SigComposite_lblHeader=Signature visualization
SigComposite_lblHeader=Signature Demonstration
SigComposite_lblHash=
SigComposite_lblSignature=
SigComposite_lblProgress=Step %s from 4
SigComposite_lblProgress=Step %s of 4
#The TabFolder
SigComposite_tbtmNewItem_0=Step 1
SigComposite_tbtmNewItem_1=Step 2
SigComposite_tbtmNewItem_2=Step 3
SigComposite_tbtmNewItem_3=Step 4
SigComposite_nextStep = \u0020(next step)
SigComposite_lastStep = \u0020(last step)
SigComposite_txtDescriptionOfStep1=\r\nChoose input\r\n\r\nYou can choose what to sign: Either you open an existing document or you enter a text by yourself. To start the signature process, you have to click the button "Choose input" on the left and follow the instructions.
SigComposite_txtDescriptionOfStep2=\r\nChoose hash function\r\n\r\nA hash function is an algorithm that maps a data set of variable length (the message) to a data set of a fixed length (hash value or message digest). Signing the hash value rather than the message improves the efficiency of the process because the hash value is usually much smaller in size than the message.
SigComposite_txtDescriptionOfStep3=\r\nChoose signature function\r\n\r\nYou can choose between different signature functions to sign the document. Some signature procedures are based on asymmetric encryption like RSA, other methods have been developed only for this purpose, for example DSA. To sign a document and verify the signature, you need two different keys. The private key is for generating the signature and has to be kept secret. The public key can be used by someone else to verify your signature.
Expand All @@ -22,7 +24,7 @@ SigComposite_btnHash=Hash function
SigComposite_btnSignature=Signature function
SigComposite_btnChooseInput=Choose input
SigComposite_btnOpenInEditor=Show generated signature
SigComposite_btnReset=Reset
SigComposite_btnReset=Step back
SigComposite_btnReturn=Return to JCT-PKI
SigComposite_menu=Select all

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#Eclipse messages class for SigComposite
SigComposite_grpSignatureGeneration=Signaturerzeugung
SigComposite_grpSignedDoc=Signiertes Dokument
SigComposite_description=Diese Visualisierung demonstriert die Erzeugung einer Signatur für ein gegebenes Dokument (Nachricht). Eine digitale Signatur kann man benutzen, um den Unterzeichner der Nachricht zu verifizieren.
SigComposite_lblHeader=Signaturvisualisierung
SigComposite_description=Diese Visualisierung demonstriert die Erzeugung einer Signatur f\u00fcr ein gegebenes Dokument (Nachricht). Eine digitale Signatur kann man benutzen, um den Unterzeichner der Nachricht zu verifizieren.
SigComposite_lblHeader=Signatur-Demo
SigComposite_lblHash=
SigComposite_lblSignature=
SigComposite_lblProgress=Schritt %s von 4
Expand All @@ -11,6 +11,8 @@ SigComposite_tbtmNewItem_0=Schritt 1
SigComposite_tbtmNewItem_1=Schritt 2
SigComposite_tbtmNewItem_2=Schritt 3
SigComposite_tbtmNewItem_3=Schritt 4
SigComposite_nextStep = \u0020(n\u00e4chster Schritt)
SigComposite_lastStep = \u0020(letzter Schritt)
SigComposite_txtDescriptionOfStep1=\r\nInput ausw\u00e4hlen\r\n\r\nSie k\u00f6nnen ausw\u00e4hlen, was Sie signieren m\u00f6chten: Entweder \u00f6ffnen Sie eine bereits vorhandene Datei oder Sie geben selbst einen Text ein. Um den Signaturerstellungs-Prozess zu starten, klicken Sie den Button "Input ausw\u00e4hlen" und folgen den Anweisungen.
SigComposite_txtDescriptionOfStep2=\r\nHashfunktion ausw\u00e4hlen\r\n\r\nEine Hashfunktion ist ein Algorithmus, der einen Datensatz variabler L\u00e4nge (eine Nachricht) auf einen Datensatz fixer L\u00e4nge (den Hashwert) abbildet. Da die Gr\u00f6\u00dfe des Hashwertes normalerweise viel kleiner ist als die Nachricht, wird direkt der Hashwert signiert. Dadurch wird die Effizienz des Signaturerzeugungsprozesses gesteigert. Bei der Signaturerstellung sowie bei der Verifikation der Signatur muss der gleiche Hashalgorithmus verwendet werden.
SigComposite_txtDescriptionOfStep3=\r\nSignaturfunktion ausw\u00e4hlen\r\n\r\nUm den von Ihnen gew\u00e4hlten Input zu signieren, k\u00f6nnen Sie zwischen verschiedenen Signaturfunktionen ausw\u00e4hlen. Einige Signaturverfahren basieren auf asymmetrischer Verschl\u00fcsselung, wie RSA, andere Verfahren wurden eigens f\u00fcr diesen Zweck entwickelt, wie DSA. Um eine Signatur zu erstellen und anschlie\u00dfend zu pr\u00fcfen, ben\u00f6tigt man zwei verschiedene Schl\u00fcssel. Der private Schl\u00fcssel wird f\u00fcr die Erstellung der Signatur genutzt. Nur der Besitzer des Schl\u00fcssels kennt ihn und muss ihn geheim halten. Der \u00f6ffentliche Schl\u00fcssel kann von jedem verwendet werden, um die Signatur zu verifizieren.
Expand All @@ -21,7 +23,7 @@ SigComposite_btnHash=Hashfunktion
SigComposite_btnSignature=Signaturfunktion
SigComposite_btnChooseInput=Input ausw\u00e4hlen
SigComposite_btnOpenInEditor=Erzeugte Signatur anzeigen
SigComposite_btnReset=Reset
SigComposite_btnReset=Schritt zur\u00fcck
SigComposite_btnReturn=Zur\u00fcck zu JCT-PKI
SigComposite_menu=Alles ausw\u00e4hlen

Expand Down
Loading

0 comments on commit fa42087

Please sign in to comment.