import android.widget.Toast;
import org.average.nfcauthcr.YkNeo;
+import org.average.nfcauthcr.CRException;
public class Check extends Activity {
Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
if (tag == null) return;
IsoDep isoTag = IsoDep.get(tag);
- byte[] response = YkNeo.doChallengeYubiKey(
+ try {
+ byte[] response = YkNeo.doChallengeYubiKey(
isoTag, slot, challenge);
- if (response != null) {
Intent data = getIntent();
data.putExtra("response", response);
setResult(RESULT_OK, data);
+ } catch (CRException e) {
+ Log.v(TAG, e.getMessage());
+ Toast.makeText(this, e.getMessage(),
+ Toast.LENGTH_LONG).show();
}
finish();
}
Toast.makeText(this, R.string.no_nfc,
Toast.LENGTH_LONG).show();
finish();
- return;
}
if (! adapter.isEnabled()) {
Toast.makeText(this, R.string.nfc_disabled,
Toast.LENGTH_LONG).show();
finish();
- return;
}
adapter.enableForegroundDispatch(
this, tagIntent, new IntentFilter[] {iso},