summaryrefslogtreecommitdiff
path: root/bkucommon/src
diff options
context:
space:
mode:
authorTobias Kellner <tobias.kellner@iaik.tugraz.at>2015-10-16 01:06:00 +0200
committerTobias Kellner <tobias.kellner@iaik.tugraz.at>2015-10-16 01:06:00 +0200
commit4cf16120aa4c3b9c543079fa2d92577ec44e7f62 (patch)
tree36081c9c7a26abe8d13770d41096023d0d03701b /bkucommon/src
parent7d58c14a12fec18c046228ad7e4cc076e5e84c99 (diff)
downloadmocca-4cf16120aa4c3b9c543079fa2d92577ec44e7f62.tar.gz
mocca-4cf16120aa4c3b9c543079fa2d92577ec44e7f62.tar.bz2
mocca-4cf16120aa4c3b9c543079fa2d92577ec44e7f62.zip
Switch to ECCelerate
Diffstat (limited to 'bkucommon/src')
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/Signature.java11
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/AlgorithmMethodFactoryImpl.java10
-rw-r--r--bkucommon/src/test/java/at/gv/egiz/bku/binding/AbstractBindingProcessorTest.java4
3 files changed, 10 insertions, 15 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/Signature.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/Signature.java
index 8743192e..fc42dcb4 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/Signature.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/Signature.java
@@ -39,7 +39,6 @@ import iaik.cms.ContentInfo;
import iaik.cms.IssuerAndSerialNumber;
import iaik.cms.SignedData;
import iaik.cms.SignerInfo;
-import iaik.security.ecc.interfaces.ECDSAParams;
import iaik.smime.ess.ESSCertID;
import iaik.smime.ess.ESSCertIDv2;
import iaik.x509.X509ExtensionException;
@@ -271,16 +270,14 @@ public class Signature {
}
} else if (("EC".equals(algorithm)) || ("ECDSA".equals(algorithm))) {
-
int fieldSize = 0;
- if (publicKey instanceof iaik.security.ecc.ecdsa.ECPublicKey) {
- ECDSAParams params = ((iaik.security.ecc.ecdsa.ECPublicKey) publicKey).getParameter();
- fieldSize = params.getG().getCurve().getField().getSize().bitLength();
- } else if (publicKey instanceof ECPublicKey) {
+ if (publicKey instanceof ECPublicKey) {
ECParameterSpec params = ((ECPublicKey) publicKey).getParams();
fieldSize = params.getCurve().getField().getFieldSize();
+ } else {
+ throw new NoSuchAlgorithmException("Public key type not supported.");
}
-
+
if (useStrongHash && fieldSize >= 512) {
signatureAlgorithm = AlgorithmID.ecdsa_With_SHA512;
digestAlgorithm = AlgorithmID.sha512;
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/AlgorithmMethodFactoryImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/AlgorithmMethodFactoryImpl.java
index 317e9e1f..896552d8 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/AlgorithmMethodFactoryImpl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/AlgorithmMethodFactoryImpl.java
@@ -24,7 +24,6 @@
package at.gv.egiz.bku.slcommands.impl.xsect;
-import iaik.security.ecc.interfaces.ECDSAParams;
import iaik.xml.crypto.XmldsigMore;
import java.security.InvalidAlgorithmParameterException;
@@ -103,14 +102,13 @@ public class AlgorithmMethodFactoryImpl implements AlgorithmMethodFactory {
} else if (("EC".equals(algorithm)) || ("ECDSA".equals(algorithm))) {
int fieldSize = 0;
- if (publicKey instanceof iaik.security.ecc.ecdsa.ECPublicKey) {
- ECDSAParams params = ((iaik.security.ecc.ecdsa.ECPublicKey) publicKey).getParameter();
- fieldSize = params.getG().getCurve().getField().getSize().bitLength();
- } else if (publicKey instanceof ECPublicKey) {
+ if (publicKey instanceof ECPublicKey) {
ECParameterSpec params = ((ECPublicKey) publicKey).getParams();
fieldSize = params.getCurve().getField().getFieldSize();
+ } else {
+ throw new NoSuchAlgorithmException("Public key type not supported.");
}
-
+
if (useStrongHash && fieldSize >= 512) {
signatureAlgorithmURI = XmldsigMore.SIGNATURE_ECDSA_SHA512;
digestAlgorithmURI = DigestMethod.SHA512;
diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/AbstractBindingProcessorTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/AbstractBindingProcessorTest.java
index 898c9d27..6f86caf7 100644
--- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/AbstractBindingProcessorTest.java
+++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/AbstractBindingProcessorTest.java
@@ -27,7 +27,7 @@ package at.gv.egiz.bku.binding;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import iaik.security.ecc.provider.ECCProvider;
+import iaik.security.ec.provider.ECCelerate;
import iaik.security.provider.IAIK;
import iaik.xml.crypto.XSecProvider;
@@ -47,7 +47,7 @@ public abstract class AbstractBindingProcessorTest {
@BeforeClass
public static void setUpClass() {
Security.insertProviderAt(new IAIK(), 1);
- Security.insertProviderAt(new ECCProvider(false), 2);
+ Security.insertProviderAt(new ECCelerate(false), 2);
XSecProvider.addAsProvider(false);
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(