diff options
| author | J08nY | 2018-08-12 14:08:57 +0200 |
|---|---|---|
| committer | J08nY | 2018-08-12 14:08:57 +0200 |
| commit | 574a46017950e4e04b9e52cb52c74ad9948060cb (patch) | |
| tree | e861c90f483a8a5dc29523c14496ccf7d4189eda /src | |
| parent | fb19b67c5f707af80cba280efa0ae0fa20d7fc8f (diff) | |
| download | ECTester-574a46017950e4e04b9e52cb52c74ad9948060cb.tar.gz ECTester-574a46017950e4e04b9e52cb52c74ad9948060cb.tar.zst ECTester-574a46017950e4e04b9e52cb52c74ad9948060cb.zip | |
Diffstat (limited to 'src')
16 files changed, 52 insertions, 56 deletions
diff --git a/src/cz/crcs/ectester/applet/ECKeyGenerator.java b/src/cz/crcs/ectester/applet/ECKeyGenerator.java index 9150248..7c52e8f 100644 --- a/src/cz/crcs/ectester/applet/ECKeyGenerator.java +++ b/src/cz/crcs/ectester/applet/ECKeyGenerator.java @@ -39,7 +39,6 @@ public class ECKeyGenerator { } /** - * * @param keypair * @param key * @return @@ -70,7 +69,6 @@ public class ECKeyGenerator { } /** - * * @param keypair * @param curve * @param buffer @@ -82,7 +80,6 @@ public class ECKeyGenerator { } /** - * * @param keypair * @param curve * @param params @@ -95,7 +92,6 @@ public class ECKeyGenerator { } /** - * * @param keypair * @param key * @param curve diff --git a/src/cz/crcs/ectester/applet/ECKeyTester.java b/src/cz/crcs/ectester/applet/ECKeyTester.java index 7c091e3..6b5aa6b 100644 --- a/src/cz/crcs/ectester/applet/ECKeyTester.java +++ b/src/cz/crcs/ectester/applet/ECKeyTester.java @@ -46,13 +46,13 @@ public class ECKeyTester { * Uses {@code pubkeyBuffer} at {@code pubkeyOffset} for computations. * Output should equal with ECDHC output. * - * @param privatePair KeyPair from which the private key is used - * @param publicPair KeyPair from which the public key is used - * @param pubkeyBuffer buffer to be used for the public key - * @param pubkeyOffset offset into pubkeyBuffer that can be used for the public key - * @param outputBuffer buffer to be used for the secret output - * @param outputOffset offset into the outputBuffer - * @param transformation (EC_Consts.TRANSFORMATION_* | ...) + * @param privatePair KeyPair from which the private key is used + * @param publicPair KeyPair from which the public key is used + * @param pubkeyBuffer buffer to be used for the public key + * @param pubkeyOffset offset into pubkeyBuffer that can be used for the public key + * @param outputBuffer buffer to be used for the secret output + * @param outputOffset offset into the outputBuffer + * @param transformation (EC_Consts.TRANSFORMATION_* | ...) * @return derived secret length **/ public short testKA(KeyPair privatePair, KeyPair publicPair, byte[] pubkeyBuffer, short pubkeyOffset, byte[] outputBuffer, short outputOffset, short transformation) { @@ -131,7 +131,6 @@ public class ECKeyTester { } /** - * * @param signKey * @param inputBuffer * @param inputOffset @@ -154,7 +153,6 @@ public class ECKeyTester { } /** - * * @param verifyKey * @param inputBuffer * @param inputOffset diff --git a/src/cz/crcs/ectester/applet/ECTesterApplet.java b/src/cz/crcs/ectester/applet/ECTesterApplet.java index d0ca8f5..17c8faf 100644 --- a/src/cz/crcs/ectester/applet/ECTesterApplet.java +++ b/src/cz/crcs/ectester/applet/ECTesterApplet.java @@ -477,7 +477,6 @@ public class ECTesterApplet extends Applet implements ExtendedLength { } /** - * * @param apdu P1 = byte keyPair (KEYPAIR_*) * P2 = byte export (EXPORT_TRUE || EXPORT_FALSE) * DATA = byte sigType @@ -502,7 +501,6 @@ public class ECTesterApplet extends Applet implements ExtendedLength { } /** - * * @param apdu P1 = byte keyPair (KEYPAIR_*) * P2 = byte sigType * DATA = short dataLength (00 = random data generated, !00 = data length) @@ -609,12 +607,12 @@ public class ECTesterApplet extends Applet implements ExtendedLength { } /** - * @param keyPair KeyPair to transform - * @param key key to transform (EC_Consts.KEY_* | ...) - * @param params parameters to transform (EC_Consts.PARAMETER_* | ...) + * @param keyPair KeyPair to transform + * @param key key to transform (EC_Consts.KEY_* | ...) + * @param params parameters to transform (EC_Consts.PARAMETER_* | ...) * @param transformation transformation type (EC_Consts.TRANSFORMATION_*) - * @param outBuffer buffer to output sw to - * @param outOffset output offset in buffer + * @param outBuffer buffer to output sw to + * @param outOffset output offset in buffer * @return length of data written to the buffer */ private short transform(KeyPair keyPair, byte key, short params, short transformation, byte[] outBuffer, short outOffset) { @@ -665,13 +663,13 @@ public class ECTesterApplet extends Applet implements ExtendedLength { } /** - * @param pubkey keyPair to use for public key, (KEYPAIR_LOCAL || KEYPAIR_REMOTE) - * @param privkey keyPair to use for private key, (KEYPAIR_LOCAL || KEYPAIR_REMOTE) - * @param export whether to export ECDH secret + * @param pubkey keyPair to use for public key, (KEYPAIR_LOCAL || KEYPAIR_REMOTE) + * @param privkey keyPair to use for private key, (KEYPAIR_LOCAL || KEYPAIR_REMOTE) + * @param export whether to export ECDH secret * @param transformation whether to transform the pubkey before ECDH - * @param type KeyAgreement type to test - * @param outBuffer buffer to write sw to, and export ECDH secret {@code if(export == EXPORT_TRUE)} - * @param outOffset output offset in buffer + * @param type KeyAgreement type to test + * @param outBuffer buffer to write sw to, and export ECDH secret {@code if(export == EXPORT_TRUE)} + * @param outOffset output offset in buffer * @return length of data written to the buffer */ private short ecdh(byte pubkey, byte privkey, byte export, short transformation, byte type, byte[] outBuffer, short outOffset) { @@ -813,9 +811,9 @@ public class ECTesterApplet extends Applet implements ExtendedLength { short length = 0; short dataLength = Util.getShort(inBuffer, inOffset); - short dataOffset = (short)(inOffset + 2); - short sigLength = Util.getShort(inBuffer, (short)(dataOffset + dataLength)); - short sigOffset = (short)(dataOffset + dataLength + 2); + short dataOffset = (short) (inOffset + 2); + short sigLength = Util.getShort(inBuffer, (short) (dataOffset + dataLength)); + short sigOffset = (short) (dataOffset + dataLength + 2); if (keyTester.getSigType() == sigType) { keyTester.testECDSA_verify((ECPublicKey) verify.getPublic(), inBuffer, dataOffset, dataLength, inBuffer, sigOffset, sigLength); diff --git a/src/cz/crcs/ectester/common/ec/EC_Category.java b/src/cz/crcs/ectester/common/ec/EC_Category.java index 8c58159..8af308c 100644 --- a/src/cz/crcs/ectester/common/ec/EC_Category.java +++ b/src/cz/crcs/ectester/common/ec/EC_Category.java @@ -10,6 +10,7 @@ import java.util.TreeMap; /** * A category of EC_Data objects, has a name, description and represents a directory in * the cz.crcs.ectester.data package. + * * @author Jan Jancar johny@neuromancer.sk */ public class EC_Category { diff --git a/src/cz/crcs/ectester/common/output/BaseTextTestWriter.java b/src/cz/crcs/ectester/common/output/BaseTextTestWriter.java index ee55069..f60f8bb 100644 --- a/src/cz/crcs/ectester/common/output/BaseTextTestWriter.java +++ b/src/cz/crcs/ectester/common/output/BaseTextTestWriter.java @@ -54,17 +54,17 @@ public abstract class BaseTextTestWriter implements TestWriter { Result result = t.getResult(); - String line = ""; - if (prefix.equals("")) { - char charLine[] = new char[BASE_WIDTH + 24]; - new String(new char[BASE_WIDTH + 24]).replace("\0", "━").getChars(0, charLine.length - 1, charLine, 0); - charLine[0] = '■'; - charLine[4] = '┳'; - charLine[BASE_WIDTH + 1] = '┳'; - charLine[BASE_WIDTH + 13] = '┳'; - charLine[BASE_WIDTH + 23] = '┓'; - line = new String(charLine) + System.lineSeparator(); - } + String line = ""; + if (prefix.equals("")) { + char charLine[] = new char[BASE_WIDTH + 24]; + new String(new char[BASE_WIDTH + 24]).replace("\0", "━").getChars(0, charLine.length - 1, charLine, 0); + charLine[0] = '■'; + charLine[4] = '┳'; + charLine[BASE_WIDTH + 1] = '┳'; + charLine[BASE_WIDTH + 13] = '┳'; + charLine[BASE_WIDTH + 23] = '┓'; + line = new String(charLine) + System.lineSeparator(); + } StringBuilder out = new StringBuilder(); out.append(t.ok() ? Colors.ok(" OK ") : Colors.error("NOK ")); diff --git a/src/cz/crcs/ectester/common/output/OutputLogger.java b/src/cz/crcs/ectester/common/output/OutputLogger.java index 09b8f73..effd1fd 100644 --- a/src/cz/crcs/ectester/common/output/OutputLogger.java +++ b/src/cz/crcs/ectester/common/output/OutputLogger.java @@ -1,6 +1,9 @@ package cz.crcs.ectester.common.output; -import java.io.*; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; import java.util.LinkedList; import java.util.List; diff --git a/src/cz/crcs/ectester/common/output/TestWriter.java b/src/cz/crcs/ectester/common/output/TestWriter.java index eb95804..67aeccb 100644 --- a/src/cz/crcs/ectester/common/output/TestWriter.java +++ b/src/cz/crcs/ectester/common/output/TestWriter.java @@ -19,14 +19,13 @@ public interface TestWriter { void begin(TestSuite suite); /** - * * @param t * @param index */ void outputTest(Test t, int index); /** - * @param t + * @param t * @param cause * @param index */ diff --git a/src/cz/crcs/ectester/common/test/TestCallback.java b/src/cz/crcs/ectester/common/test/TestCallback.java index ce6000b..c5a49f3 100644 --- a/src/cz/crcs/ectester/common/test/TestCallback.java +++ b/src/cz/crcs/ectester/common/test/TestCallback.java @@ -3,9 +3,8 @@ package cz.crcs.ectester.common.test; import java.util.function.Function; /** - * - * @author Jan Jancar johny@neuromancer.sk * @param <T> + * @author Jan Jancar johny@neuromancer.sk */ public abstract class TestCallback<T extends Testable> implements Function<T, Result> { diff --git a/src/cz/crcs/ectester/common/util/ByteUtil.java b/src/cz/crcs/ectester/common/util/ByteUtil.java index daacabb..4b4a2d6 100644 --- a/src/cz/crcs/ectester/common/util/ByteUtil.java +++ b/src/cz/crcs/ectester/common/util/ByteUtil.java @@ -10,6 +10,7 @@ public class ByteUtil { /** * Gen a short from a byte array at <code>offset</code>, big-endian. + * * @return the short value */ public static short getShort(byte[] array, int offset) { @@ -26,6 +27,7 @@ public class ByteUtil { /** * Compare two byte arrays upto <code>length</code> and get first difference. + * * @return the position of the first difference in the two byte arrays, or <code>length</code> if they are equal. */ public static int diffBytes(byte[] one, int oneOffset, byte[] other, int otherOffset, int length) { @@ -41,6 +43,7 @@ public class ByteUtil { /** * Compare two byte arrays, upto <code>length</code>. + * * @return whether the arrays are equal upto <code>length</code> */ public static boolean compareBytes(byte[] one, int oneOffset, byte[] other, int otherOffset, int length) { @@ -77,6 +80,7 @@ public class ByteUtil { /** * Parse a hex string into a byte array, big-endian. + * * @param hex The String to parse. * @return the byte array from the hex string. */ @@ -86,7 +90,8 @@ public class ByteUtil { /** * Parse a hex string into a byte-array, specify endianity. - * @param hex The String to parse. + * + * @param hex The String to parse. * @param bigEndian Whether to parse as big-endian. * @return the byte array from the hex string. */ diff --git a/src/cz/crcs/ectester/standalone/consts/KeyAgreementIdent.java b/src/cz/crcs/ectester/standalone/consts/KeyAgreementIdent.java index eb7adc6..66d8235 100644 --- a/src/cz/crcs/ectester/standalone/consts/KeyAgreementIdent.java +++ b/src/cz/crcs/ectester/standalone/consts/KeyAgreementIdent.java @@ -22,7 +22,7 @@ public class KeyAgreementIdent extends Ident { // ECDH and ECDHC with SHA as KDF, OIDs from RFC 3278 ALL.add(new KeyAgreementIdent("ECDHwithSHA1KDF", true, "1.3.133.16.840.63.0.2")); ALL.add(new KeyAgreementIdent("ECCDHwithSHA1KDF", true, "1.3.133.16.840.63.0.3")); - ALL.add(new KeyAgreementIdent("ECDHwithSHA224KDF",true, "1.3.132.1.11.0")); + ALL.add(new KeyAgreementIdent("ECDHwithSHA224KDF", true, "1.3.132.1.11.0")); ALL.add(new KeyAgreementIdent("ECCDHwithSHA224KDF", true, "1.3.132.1.14.0")); ALL.add(new KeyAgreementIdent("ECDHwithSHA256KDF", true, "1.3.132.1.11.1")); ALL.add(new KeyAgreementIdent("ECCDHwithSHA256KDF", true, "1.3.132.1.14.1")); diff --git a/src/cz/crcs/ectester/standalone/consts/SignatureIdent.java b/src/cz/crcs/ectester/standalone/consts/SignatureIdent.java index 5204c7a..dea8abe 100644 --- a/src/cz/crcs/ectester/standalone/consts/SignatureIdent.java +++ b/src/cz/crcs/ectester/standalone/consts/SignatureIdent.java @@ -64,7 +64,7 @@ public class SignatureIdent extends Ident { ALL.add(new SignatureIdent("SHA3-384withECDDSA", "SHA3-384withDETECDSA")); ALL.add(new SignatureIdent("SHA3-512withECDDSA", "SHA3-512withDETECDSA")); // ECKCDSA? Botan provides. - ALL.add(new SignatureIdent("ECKCDSA","SHA1withECKCDSA", "1.2.410.200004.1.100.4.3")); + ALL.add(new SignatureIdent("ECKCDSA", "SHA1withECKCDSA", "1.2.410.200004.1.100.4.3")); ALL.add(new SignatureIdent("NONEwithECKCDSA")); ALL.add(new SignatureIdent("RIPEMD160withECKCDSA")); ALL.add(new SignatureIdent("SHA224withECKCDSA", "1.2.410.200004.1.100.4.4")); diff --git a/src/cz/crcs/ectester/standalone/libs/NativeECLibrary.java b/src/cz/crcs/ectester/standalone/libs/NativeECLibrary.java index 03a088b..6b98cc1 100644 --- a/src/cz/crcs/ectester/standalone/libs/NativeECLibrary.java +++ b/src/cz/crcs/ectester/standalone/libs/NativeECLibrary.java @@ -91,9 +91,9 @@ public abstract class NativeECLibrary extends ProviderECLibrary { System.setProperty("java.library.path", newPath); Field fieldSysPath; try { - fieldSysPath = ClassLoader.class.getDeclaredField( "sys_paths" ); - fieldSysPath.setAccessible( true ); - fieldSysPath.set( null, null ); + fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths"); + fieldSysPath.setAccessible(true); + fieldSysPath.set(null, null); } catch (NoSuchFieldException | IllegalAccessException ignored) { } } diff --git a/src/cz/crcs/ectester/standalone/libs/TomcryptLib.java b/src/cz/crcs/ectester/standalone/libs/TomcryptLib.java index 57b273a..78db00e 100644 --- a/src/cz/crcs/ectester/standalone/libs/TomcryptLib.java +++ b/src/cz/crcs/ectester/standalone/libs/TomcryptLib.java @@ -9,7 +9,7 @@ import java.util.Set; public class TomcryptLib extends NativeECLibrary { public TomcryptLib() { - super("tomcrypt_provider", "tommath", "tomcrypt"); + super("tomcrypt_provider", "tommath", "tomcrypt"); } @Override diff --git a/src/cz/crcs/ectester/standalone/libs/jni/NativeECPublicKey.java b/src/cz/crcs/ectester/standalone/libs/jni/NativeECPublicKey.java index ccf21c0..33dd3ef 100644 --- a/src/cz/crcs/ectester/standalone/libs/jni/NativeECPublicKey.java +++ b/src/cz/crcs/ectester/standalone/libs/jni/NativeECPublicKey.java @@ -4,7 +4,6 @@ import cz.crcs.ectester.common.util.ByteUtil; import cz.crcs.ectester.common.util.ECUtil; import org.bouncycastle.util.Arrays; -import javax.swing.event.AncestorEvent; import java.security.interfaces.ECPublicKey; import java.security.spec.ECParameterSpec; import java.security.spec.ECPoint; diff --git a/src/cz/crcs/ectester/standalone/libs/jni/NativeKeyAgreementSpi.java b/src/cz/crcs/ectester/standalone/libs/jni/NativeKeyAgreementSpi.java index 4858ccd..fdbdccf 100644 --- a/src/cz/crcs/ectester/standalone/libs/jni/NativeKeyAgreementSpi.java +++ b/src/cz/crcs/ectester/standalone/libs/jni/NativeKeyAgreementSpi.java @@ -5,13 +5,12 @@ import cz.crcs.ectester.common.util.ECUtil; import javax.crypto.KeyAgreementSpi; import javax.crypto.SecretKey; import javax.crypto.ShortBufferException; -import javax.crypto.spec.SecretKeySpec; import java.security.*; import java.security.interfaces.ECPrivateKey; import java.security.interfaces.ECPublicKey; import java.security.spec.AlgorithmParameterSpec; -import java.security.spec.ECParameterSpec; import java.security.spec.ECGenParameterSpec; +import java.security.spec.ECParameterSpec; /** * @author Jan Jancar johny@neuromancer.sk diff --git a/src/cz/crcs/ectester/standalone/output/YAMLTestWriter.java b/src/cz/crcs/ectester/standalone/output/YAMLTestWriter.java index 433624a..ee8a199 100644 --- a/src/cz/crcs/ectester/standalone/output/YAMLTestWriter.java +++ b/src/cz/crcs/ectester/standalone/output/YAMLTestWriter.java @@ -15,7 +15,6 @@ import java.io.PrintStream; import java.security.Key; import java.security.PrivateKey; import java.security.PublicKey; -import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; |
