- //Log.v(TAG, "Wrong response to challenge");
- //Toast.makeText(this, R.string.tag_error,
- // Toast.LENGTH_LONG).show();
- return null;
+ throw new CRException(String.format(
+ "NFC CR error code: %02x:%02x",
+ resp[length - 2], resp[length - 1]));
+ }
+ if (length != 22) {
+ throw new CRException(String.format(
+ "NFC wrong response size: got %d, need 20",
+ length-2));