mirror of
https://github.com/status-im/react-native-status-keycard.git
synced 2025-02-28 12:00:36 +00:00
Merge pull request #27 from bitgamma/master
make compatible with 2.1 Keycard applet
This commit is contained in:
commit
b7fe831dd7
@ -587,7 +587,18 @@ public class SmartCard extends BroadcastReceiver implements CardListener {
|
||||
Log.i(TAG, "pin verified");
|
||||
|
||||
byte[] hash = Hex.decode(message);
|
||||
RecoverableSignature signature = new RecoverableSignature(hash, cmdSet.signWithPath(hash, path, false).checkOK().getData());
|
||||
|
||||
RecoverableSignature signature;
|
||||
|
||||
if (cmdSet.getApplicationInfo().getAppVersion() < 0x0202) {
|
||||
String actualPath = new KeyPath(cmdSet.getStatus(KeycardCommandSet.GET_STATUS_P1_KEY_PATH).checkOK().getData()).toString();
|
||||
if (!actualPath.equals(path)) {
|
||||
cmdSet.deriveKey(path).checkOK();
|
||||
}
|
||||
signature = new RecoverableSignature(hash, cmdSet.sign(hash).checkOK().getData());
|
||||
} else {
|
||||
signature = new RecoverableSignature(hash, cmdSet.signWithPath(hash, path, false).checkOK().getData());
|
||||
}
|
||||
|
||||
Log.i(TAG, "Signed hash: " + Hex.toHexString(hash));
|
||||
Log.i(TAG, "Recovery ID: " + signature.getRecId());
|
||||
|
Loading…
x
Reference in New Issue
Block a user