+
+ private void runEnrollment(int slot) {
+ Random rng = new Random();
+ byte[] challenge = new byte[63];
+ rng.nextBytes(challenge);
+ Log.v(TAG, "Random challenge: " + hex(challenge));
+ Log.v(TAG, "Launching challenging activity");
+ Intent crIntent = new Intent(this, NFCAuthCRCheck.class);
+ crIntent.putExtra("slot", slot);
+ crIntent.putExtra("challenge", challenge);
+ this.startActivityForResult(crIntent, 0);
+ waitingForResult = true;
+ }
+
+ private String hex(byte[] a) {
+ StringBuilder sb = new StringBuilder();
+ if (a == null) return "<null>";
+ for (byte b: a) sb.append(String.format("%02x", b&0xff));
+ return sb.toString();
+ }