<string name="select_slot">Select Slot</string>
<string name="slot_1">Slot 1</string>
<string name="slot_2">Slot 2</string>
+ <string name="need_slot">You must select which slot to use</string>
<string name="enrollresult">Enrollment result:</string>
+ <string name="enroll_success">Token successfully bound to the device</string>
<string name="challenging">Ready to send challenge</string>
- <string name="swipe">Please touch the token with the phone</string>
+ <string name="swipe">Please touch the back of the phone with the NFC token to enroll it</string>
<string name="no_nfc">Cannot reach the NFC adapter</string>
<string name="nfc_disabled">Need to enable NFC in Settings</string>
<string name="tag_lost">Communitation with the tag lost</string>
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},
if (slot > 0) {
runEnrollment(slot);
} else {
- showEnrollResult("Must specify which slot to use");
+ showEnrollResult(R.string.need_slot);
}
}
editor.putString("challenge", hex(challenge));
editor.putString("response", hex(response));
editor.commit();
+ showEnrollResult(R.string.enroll_success);
Log.v(TAG, "stored new challenge and response");
}
- private void showEnrollResult(final String msg) {
- Log.v(TAG, "Show result: \"" + msg + "\"");
-
+ private void showEnrollResult(int messageid) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.enrollresult);
- builder.setMessage(msg);
+ builder.setMessage(messageid);
builder.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
throw new CRException(
"NFC Error code in the response to CR");
}
+ if (length != 22) {
+ throw new CRException(
+ "NFC wrong response size: " + (length-2));
+ }
return Arrays.copyOf(resp, length-2);
} catch (TagLostException e) {
throw new CRException("NFC connection lost", e);