summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorCGantert345 <57003061+CGantert345@users.noreply.github.com>2022-04-11 16:30:32 +0200
committerCGantert345 <57003061+CGantert345@users.noreply.github.com>2022-04-11 16:30:32 +0200
commit6ef85723cca938e298b318dc6d564318b83ab4ba (patch)
treefe1ddcef09ee7c98509ffdcf7d4dac949dd12588 /src/test
parentfixing DOSIPAS algorithm names and supported EC curves (diff)
downloadUIC-barcode-6ef85723cca938e298b318dc6d564318b83ab4ba.tar
UIC-barcode-6ef85723cca938e298b318dc6d564318b83ab4ba.tar.gz
UIC-barcode-6ef85723cca938e298b318dc6d564318b83ab4ba.tar.bz2
UIC-barcode-6ef85723cca938e298b318dc6d564318b83ab4ba.tar.lz
UIC-barcode-6ef85723cca938e298b318dc6d564318b83ab4ba.tar.xz
UIC-barcode-6ef85723cca938e298b318dc6d564318b83ab4ba.tar.zst
UIC-barcode-6ef85723cca938e298b318dc6d564318b83ab4ba.zip
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java8
-rw-r--r--src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion3Test.java8
2 files changed, 7 insertions, 9 deletions
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java b/src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java
index bd0f9a4..6533938 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameDoubleSignatureTest.java
@@ -5,6 +5,7 @@ import java.security.InvalidKeyException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
+import java.security.Provider;
import java.security.SecureRandom;
import java.security.Security;
import java.security.SignatureException;
@@ -37,6 +38,8 @@ public class DynamicFrameDoubleSignatureTest {
public IUicRailTicket testFCBticket = null;
+ public Provider provider = null;
+
@Before public void initialize() {
@@ -44,10 +47,11 @@ public class DynamicFrameDoubleSignatureTest {
signatureAlgorithmOID = Constants.ECDSA_SHA256;
keyPairAlgorithmOID = Constants.KG_EC_256;
- elipticCurve = "secp256r1";
+ elipticCurve = "secp256k1";
testFCBticket = SimpleUICTestTicket.getUicTestTicket();
+ provider = new BouncyCastleProvider();
Security.addProvider(new BouncyCastleProvider());
try {
@@ -155,7 +159,7 @@ public class DynamicFrameDoubleSignatureTest {
KeyPairGenerator ecKPGen = KeyPairGenerator.getInstance("EC", "BC");
ecKPGen.initialize(namedParamSpec, new SecureRandom());
KeyPair keyPair = ecKPGen.generateKeyPair();
- KeyPair kp = new KeyPair(SecurityUtils.convertPublicKey(keyPair.getPublic()),SecurityUtils.convertPrivateKey(keyPair.getPrivate()));
+ KeyPair kp = new KeyPair(SecurityUtils.convert(keyPair.getPublic(), provider),SecurityUtils.convert(keyPair.getPrivate(), provider));
return kp;
}
diff --git a/src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion3Test.java b/src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion3Test.java
index f8a03ba..7f03658 100644
--- a/src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion3Test.java
+++ b/src/test/java/org/uic/barcode/test/DynamicFrameFcbVersion3Test.java
@@ -159,13 +159,7 @@ public class DynamicFrameFcbVersion3Test {
}
- public KeyPair generateECDSAKeys(String keyAlgorithmName, String paramName) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException{
- ECParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec(paramName);
- KeyPairGenerator g = KeyPairGenerator.getInstance(keyAlgorithmName, "BC");
- g.initialize(ecSpec, new SecureRandom());
- return g.generateKeyPair();
- }
-
+
public KeyPair generateECKeys(String keyAlgorithmOid, String curve) throws Exception{
String keyAlgorithmName = "ECDSA";