<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.average.nfcauthcr"
+ package="org.average.ykneocr"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10"
<?xml version="1.0" encoding="UTF-8"?>
-<project name="NFCAuthCR" default="help">
+<project name="YkNeoCR" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- tools:context=".NFCAuthCREnroll"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
>
+ <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/info"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/info"
+ />
+
<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_centerHorizontal="true"
- android:layout_alignParentTop="true"
+ android:layout_alignParentBottom="true"
>
<RadioButton android:id="@+id/slot_1"
android:layout_width="wrap_content"
android:onClick="onSlotSelectionClicked"
/>
</RadioGroup>
- <Button
- android:id="@+id/enroll"
- android:text="@string/enroll"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerInParent="true"
- android:onClick="onEnrollClicked"
- />
</RelativeLayout>
-
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="app_name">NFC Auth</string>
- <string name="enroll">Enroll</string>
+ <string name="app_name">YkNeo CR</string>
+ <string name="info"><![CDATA[
+You need to specify the slot number of the Yubikey Neo to use for
+Challenge-Response.
+ ]]>
+ </string>
+ <string name="enroll">Set Slot</string>
<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 communicate</string>
- <string name="swipe">Please touch the back of the phone with the NFC token</string>
+ <string name="swipe">Please touch the back of the device with the NFC token</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>
-package org.average.nfcauthcr;
+package org.average.ykneocr;
import java.util.Random;
import android.view.View;
import android.widget.RadioButton;
-import org.average.nfcauthcr.QueryCrToken;
+import org.average.ykneocr.QueryCrToken;
public class Enroll extends Activity {
editor.commit();
Log.v(TAG, "stored slot number " + slot);
}
-
- public void onEnrollClicked(View view) {
- Log.v(TAG, "Enroll clicked");
- if (slot > 0) {
- runEnrollment(slot);
- } else {
- showEnrollResult(R.string.need_slot);
- }
- }
-
- public void onActivityResult(int requestCode, int resultCode,
- Intent intent) {
- Log.v(TAG, "Got activity result");
- waitingForResult = false;
-
- if (resultCode != RESULT_OK) {
- Log.v(TAG, "Error result code " + resultCode);
- return;
- }
- byte[] challenge = intent.getByteArrayExtra("challenge");
- Log.v(TAG, "Challenge is \"" + hex(challenge) + "\"");
- byte[] response = intent.getByteArrayExtra("response");
- Log.v(TAG, "Response is \"" + hex(response) + "\"");
- Editor editor = prefs.edit();
- 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(int messageid) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(R.string.enrollresult);
- builder.setMessage(messageid);
- builder.setPositiveButton(android.R.string.ok,
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- if (!waitingForResult) { finish(); }
- }
- });
- AlertDialog dialog = builder.create();
- dialog.show();
- }
-
- private void runEnrollment(int slot) {
- Random rng = new Random();
- byte[] challenge = new byte[63];
- rng.nextBytes(challenge);
- Log.v(TAG, "Random challenge: " + hex(challenge));
- Intent crIntent = new Intent(this, QueryCrToken.class);
- crIntent.putExtra("challenge", challenge);
- waitingForResult = true;
- this.startActivityForResult(crIntent, 0);
- }
-
- 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();
- }
}
-package org.average.nfcauthcr;
+package org.average.ykneocr;
import java.io.IOException;
import java.util.ArrayList;
import android.util.Log;
import android.widget.Toast;
-import org.average.nfcauthcr.YkNeo;
-import org.average.nfcauthcr.CRException;
+import org.average.ykneocr.YkNeo;
+import org.average.ykneocr.CRException;
public class NfcCRdispatch {
-package org.average.nfcauthcr;
+package org.average.ykneocr;
import java.util.ArrayList;
import android.util.Log;
import android.widget.Toast;
-import org.average.nfcauthcr.NfcCRdispatch;
+import org.average.ykneocr.NfcCRdispatch;
public class QueryCrToken extends Activity {
-package org.average.nfcauthcr;
+package org.average.ykneocr;
import java.io.IOException;
import java.lang.String;
import android.nfc.Tag;
import android.nfc.tech.IsoDep;
-import org.average.nfcauthcr.CRException;
+import org.average.ykneocr.CRException;
public class YkNeo {