summaryrefslogtreecommitdiff
path: root/bkucommon/src/main/java/at/gv
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/main/java/at/gv
parent7d58c14a12fec18c046228ad7e4cc076e5e84c99 (diff)
downloadmocca-4cf16120aa4c3b9c543079fa2d92577ec44e7f62.tar.gz
mocca-4cf16120aa4c3b9c543079fa2d92577ec44e7f62.tar.bz2
mocca-4cf16120aa4c3b9c543079fa2d92577ec44e7f62.zip
Switch to ECCelerate
Diffstat (limited to 'bkucommon/src/main/java/at/gv')
-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
2 files changed, 8 insertions, 13 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;