-
-
Notifications
You must be signed in to change notification settings - Fork 238
Closed
Description
Hello,
I would like to know whether GlobalPlatformPro support Put Key AES SCP03 ?
// Check for presence (thus replace)
// WORKAROUND: some cards reject the command if actually trying to replace existing key.
// List<GPKeyInfo> current = gp.getKeyInfoTemplate();
// boolean replace = current.stream().filter(p -> p.getVersion() == keyVersion).count() == 1 || args.has(OPT_REPLACE_KEY);
boolean replace = args.has(OPT_REPLACE_KEY);
if (kv.getPublic().isPresent()) {
gp.putKey(kv.getPublic().get(), keyVersion, replace);
} else if (kv.getSymmetric().isPresent()) {
byte[] k = kv.getSymmetric().get();
if (k.length != 16)
throw new IllegalArgumentException("Invalid key length: " + k.length);
// FIXME: implicit DES currently
gp.putKey(GPCrypto.des3key(k), keyVersion, replace);
} else {
throw new IllegalArgumentException("Only public and symmetric keys are supported for put-key");
}
}`
Metadata
Metadata
Assignees
Labels
No labels