aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/applet/ECKeyTester.java
diff options
context:
space:
mode:
authorJ08nY2017-03-17 17:03:03 +0100
committerJ08nY2017-03-17 17:03:03 +0100
commitac63cf8f8f7fd1c85b1a7802144c6a79c516a413 (patch)
treeda76f293f490a9f827c2d87ae6c8e48e281e3e45 /src/cz/crcs/ectester/applet/ECKeyTester.java
parent80b008850c961911ca9763947ebb6066f5288fff (diff)
downloadECTester-ac63cf8f8f7fd1c85b1a7802144c6a79c516a413.tar.gz
ECTester-ac63cf8f8f7fd1c85b1a7802144c6a79c516a413.tar.zst
ECTester-ac63cf8f8f7fd1c85b1a7802144c6a79c516a413.zip
Diffstat (limited to 'src/cz/crcs/ectester/applet/ECKeyTester.java')
-rw-r--r--src/cz/crcs/ectester/applet/ECKeyTester.java21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/cz/crcs/ectester/applet/ECKeyTester.java b/src/cz/crcs/ectester/applet/ECKeyTester.java
index 61848b8..a00b47d 100644
--- a/src/cz/crcs/ectester/applet/ECKeyTester.java
+++ b/src/cz/crcs/ectester/applet/ECKeyTester.java
@@ -1,6 +1,7 @@
package cz.crcs.ectester.applet;
+import javacard.framework.CardRuntimeException;
import javacard.framework.ISO7816;
import javacard.security.*;
@@ -22,10 +23,8 @@ public class ECKeyTester {
sw = ISO7816.SW_NO_ERROR;
try {
ecdhKeyAgreement = KeyAgreement.getInstance(KeyAgreement.ALG_EC_SVDP_DH, false);
- } catch (CryptoException ce) {
+ } catch (CardRuntimeException ce) {
sw = ce.getReason();
- } catch (Exception e) {
- sw = ISO7816.SW_UNKNOWN;
}
return sw;
}
@@ -34,10 +33,8 @@ public class ECKeyTester {
sw = ISO7816.SW_NO_ERROR;
try {
ecdhcKeyAgreement = KeyAgreement.getInstance(KeyAgreement.ALG_EC_SVDP_DHC, false);
- } catch (CryptoException ce) {
+ } catch (CardRuntimeException ce) {
sw = ce.getReason();
- } catch (Exception e) {
- sw = ISO7816.SW_UNKNOWN;
}
return sw;
}
@@ -46,10 +43,8 @@ public class ECKeyTester {
sw = ISO7816.SW_NO_ERROR;
try {
ecdsaSignature = Signature.getInstance(Signature.ALG_ECDSA_SHA, false);
- } catch (CryptoException ce) {
+ } catch (CardRuntimeException ce) {
sw = ce.getReason();
- } catch (Exception e) {
- sw = ISO7816.SW_UNKNOWN;
}
return sw;
}
@@ -60,10 +55,8 @@ public class ECKeyTester {
try {
ka.init(privateKey);
length = ka.generateSecret(pubkeyBuffer, pubkeyOffset, pubkeyLength, outputBuffer, outputOffset);
- } catch (CryptoException ce) {
+ } catch (CardRuntimeException ce) {
sw = ce.getReason();
- } catch (Exception e) {
- sw = ISO7816.SW_UNKNOWN;
}
return length;
}
@@ -135,10 +128,8 @@ public class ECKeyTester {
if (!correct) {
sw = ECTesterApplet.SW_SIG_VERIFY_FAIL;
}
- } catch (CryptoException ce) {
+ } catch (CardRuntimeException ce) {
sw = ce.getReason();
- } catch (Exception e) {
- sw = ISO7816.SW_UNKNOWN;
}
return length;
}