aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/reader/command/Command.java
diff options
context:
space:
mode:
authorJ08nY2019-02-26 16:41:28 +0100
committerJ08nY2019-02-26 16:41:28 +0100
commit2b22e8032eb585d717cb1fdc98859a079c171d7e (patch)
tree3ef0219438d9671b7cbd46666ff84e650bf46248 /src/cz/crcs/ectester/reader/command/Command.java
parentf535cb56d88e2bcc17dde1f15d021a17d1f1f511 (diff)
downloadECTester-2b22e8032eb585d717cb1fdc98859a079c171d7e.tar.gz
ECTester-2b22e8032eb585d717cb1fdc98859a079c171d7e.tar.zst
ECTester-2b22e8032eb585d717cb1fdc98859a079c171d7e.zip
Fix setting key parts in ECDH util function, fix exports of large keys.
Diffstat (limited to 'src/cz/crcs/ectester/reader/command/Command.java')
-rw-r--r--src/cz/crcs/ectester/reader/command/Command.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cz/crcs/ectester/reader/command/Command.java b/src/cz/crcs/ectester/reader/command/Command.java
index bf2441f..b5b9393 100644
--- a/src/cz/crcs/ectester/reader/command/Command.java
+++ b/src/cz/crcs/ectester/reader/command/Command.java
@@ -121,7 +121,7 @@ public abstract class Command implements Cloneable {
* @return a CommandAPDU setting params loaded on the keyPair/s
* @throws IOException if any of the key files cannot be found/opened
*/
- public static Command prepareKey(CardMngr cardManager, EC_Store dataStore, ECTesterReader.Config cfg, byte keyPair) throws IOException {
+ public static Command prepareKey(CardMngr cardManager, EC_Store dataStore, ECTesterReader.Config cfg, byte keyPair, short allowedParams) throws IOException {
short params = EC_Consts.PARAMETERS_NONE;
byte[] data = null;
@@ -147,7 +147,7 @@ public abstract class Command implements Cloneable {
}
}
- if (cfg.publicKey != null || cfg.namedPublicKey != null) {
+ if ((cfg.publicKey != null || cfg.namedPublicKey != null) && ((allowedParams & EC_Consts.PARAMETER_W )!= 0)) {
params |= EC_Consts.PARAMETER_W;
EC_Params pub;
if (cfg.publicKey != null) {
@@ -172,7 +172,7 @@ public abstract class Command implements Cloneable {
}
data = pubkey;
}
- if (cfg.privateKey != null || cfg.namedPrivateKey != null) {
+ if ((cfg.privateKey != null || cfg.namedPrivateKey != null) && ((allowedParams & EC_Consts.PARAMETER_S )!= 0)) {
params |= EC_Consts.PARAMETER_S;
EC_Params priv;
if (cfg.privateKey != null) {