Add support for NDEF tags with openpgp4fpr URIs
This change allows importing keys from NDEF tags that have fingerprint encoded as an `openpgp4fpr` URI when the application is in background. After scanning a tag the `Import keys` activity is shown with results of the search for key fingerprint encoded in the tag.
This commit is contained in:
@@ -743,6 +743,20 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- NFC: Handle NFC tags with "openpgp4fpr" scheme URIs detected from outside our application -->
|
||||
<intent-filter>
|
||||
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<!-- Android's scheme matcher is case-sensitive, so include most likely variations -->
|
||||
<data android:scheme="openpgp4fpr" />
|
||||
<data android:scheme="OPENPGP4FPR" />
|
||||
<data android:scheme="OpenPGP4FPR" />
|
||||
<data android:scheme="OpenPGP4Fpr" />
|
||||
<data android:scheme="OpenPGP4fpr" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ui.MainActivity" />
|
||||
|
||||
@@ -20,6 +20,7 @@ package org.sufficientlysecure.keychain.ui;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
@@ -123,7 +124,7 @@ public class ImportKeysActivity extends BaseActivity implements ImportKeysListen
|
||||
action = ACTION_IMPORT_KEY_FROM_FACEBOOK;
|
||||
} else if ("http".equalsIgnoreCase(scheme) || "https".equalsIgnoreCase(scheme)) {
|
||||
action = ACTION_SEARCH_KEYSERVER_FROM_URL;
|
||||
} else if ("openpgp4fpr".equalsIgnoreCase(scheme)) {
|
||||
} else if (Constants.FINGERPRINT_SCHEME.equalsIgnoreCase(scheme)) {
|
||||
action = ACTION_IMPORT_KEY_FROM_KEYSERVER;
|
||||
extras.putString(EXTRA_FINGERPRINT, dataUri.getSchemeSpecificPart());
|
||||
} else {
|
||||
@@ -131,7 +132,11 @@ public class ImportKeysActivity extends BaseActivity implements ImportKeysListen
|
||||
// delegate action to ACTION_IMPORT_KEY
|
||||
action = ACTION_IMPORT_KEY;
|
||||
}
|
||||
} else if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action) && Constants.FINGERPRINT_SCHEME.equalsIgnoreCase(scheme)) {
|
||||
action = ACTION_IMPORT_KEY_FROM_KEYSERVER;
|
||||
extras.putString(EXTRA_FINGERPRINT, dataUri.getSchemeSpecificPart());
|
||||
}
|
||||
|
||||
if (action == null) {
|
||||
// -> switch to default below
|
||||
action = "";
|
||||
|
||||
Reference in New Issue
Block a user