aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/applet/ECKeyGenerator.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/ECKeyGenerator.java
parent80b008850c961911ca9763947ebb6066f5288fff (diff)
downloadECTester-ac63cf8f8f7fd1c85b1a7802144c6a79c516a413.tar.gz
ECTester-ac63cf8f8f7fd1c85b1a7802144c6a79c516a413.tar.zst
ECTester-ac63cf8f8f7fd1c85b1a7802144c6a79c516a413.zip
Diffstat (limited to 'src/cz/crcs/ectester/applet/ECKeyGenerator.java')
-rw-r--r--src/cz/crcs/ectester/applet/ECKeyGenerator.java26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/cz/crcs/ectester/applet/ECKeyGenerator.java b/src/cz/crcs/ectester/applet/ECKeyGenerator.java
index 8c9c38e..bd4b8c4 100644
--- a/src/cz/crcs/ectester/applet/ECKeyGenerator.java
+++ b/src/cz/crcs/ectester/applet/ECKeyGenerator.java
@@ -1,9 +1,9 @@
package cz.crcs.ectester.applet;
+import javacard.framework.CardRuntimeException;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.framework.Util;
-import javacard.security.CryptoException;
import javacard.security.ECPrivateKey;
import javacard.security.ECPublicKey;
import javacard.security.KeyPair;
@@ -32,10 +32,8 @@ public class ECKeyGenerator {
} catch (Exception ignored) {
}
}
- } catch (CryptoException ce) {
+ } catch (CardRuntimeException ce) {
sw = ce.getReason();
- } catch (Exception e) {
- sw = ISO7816.SW_UNKNOWN;
}
return ecKeyPair;
}
@@ -45,10 +43,8 @@ public class ECKeyGenerator {
try {
if ((key & EC_Consts.KEY_PUBLIC) != 0) keypair.getPublic().clearKey();
if ((key & EC_Consts.KEY_PRIVATE) != 0) keypair.getPrivate().clearKey();
- } catch (CryptoException ce) {
+ } catch (CardRuntimeException ce) {
sw = ce.getReason();
- } catch (Exception e) {
- sw = ISO7816.SW_UNKNOWN;
}
return sw;
}
@@ -61,10 +57,8 @@ public class ECKeyGenerator {
sw = ISO7816.SW_NO_ERROR;
try {
keypair.genKeyPair();
- } catch (CryptoException ce) {
+ } catch (CardRuntimeException ce) {
sw = ce.getReason();
- } catch (Exception e) {
- sw = ISO7816.SW_UNKNOWN;
}
return sw;
}
@@ -224,10 +218,8 @@ public class ECKeyGenerator {
default:
ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED);
}
- } catch (CryptoException ce) {
+ } catch (CardRuntimeException ce) {
sw = ce.getReason();
- } catch (Exception e) {
- sw = ISO7816.SW_UNKNOWN;
}
return sw;
}
@@ -338,10 +330,8 @@ public class ECKeyGenerator {
default:
ISOException.throwIt(ISO7816.SW_FUNC_NOT_SUPPORTED);
}
- } catch (CryptoException ce) {
+ } catch (CardRuntimeException ce) {
sw = ce.getReason();
- } catch (Exception e) {
- sw = ISO7816.SW_UNKNOWN;
}
return length;
}
@@ -406,10 +396,8 @@ public class ECKeyGenerator {
}
param = (short) (param << 1);
}
- } catch (CryptoException ce) {
+ } catch (CardRuntimeException ce) {
sw = ce.getReason();
- } catch (Exception e) {
- sw = ISO7816.SW_UNKNOWN;
}
return sw;
}