- private void doChallengeYubiKey(IsoDep isoTag, int slot)
- throws IOException {
- Intent data = getIntent();
- data.putExtra("response","<FIXME>real data here");
- setResult(RESULT_OK, data);
+ private byte[] doChallengeYubiKey(IsoDep isoTag, int slot,
+ byte[] challenge) {
+ try {
+ isoTag.connect();
+ byte[] resp = isoTag.transceive(selectCommand);
+ int length = resp.length;
+ if (resp[length - 2] == (byte)0x90 &&
+ resp[length - 1] == 0x00) {
+ return challenge;
+ } else {
+ Toast.makeText(this, R.string.tag_error,
+ Toast.LENGTH_LONG).show();
+ }
+ } catch (TagLostException e) {
+ Toast.makeText(this,
+ R.string.tag_lost, Toast.LENGTH_LONG).show();
+ } catch (IOException e) {
+ Toast.makeText(this,
+ getText(R.string.tag_error) +
+ e.getMessage(),
+ Toast.LENGTH_LONG).show();
+ }
+ return null;