summaryrefslogtreecommitdiff
path: root/bkucommon/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'bkucommon/src/main/java/at')
-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;