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:
Wiktor Kwapisiewicz
2018-05-15 12:43:36 +02:00
parent 225fdbb79a
commit 759e51e6f4
2 changed files with 20 additions and 1 deletions

View File

@@ -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 = "";