mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
expose key server API
This commit is contained in:
parent
3f7870243b
commit
ba08970850
@ -292,6 +292,7 @@
|
|||||||
<intent-filter android:label="@string/intent_import_key">
|
<intent-filter android:label="@string/intent_import_key">
|
||||||
<action android:name="org.sufficientlysecure.keychain.action.IMPORT_KEY" />
|
<action android:name="org.sufficientlysecure.keychain.action.IMPORT_KEY" />
|
||||||
<action android:name="org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_QR_CODE" />
|
<action android:name="org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_QR_CODE" />
|
||||||
|
<action android:name="org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_KEY_SERVER" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -239,7 +239,7 @@ public class DecryptActivity extends DrawerActivity {
|
|||||||
DecryptActivity.this, mSignatureKeyId);
|
DecryptActivity.this, mSignatureKeyId);
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
Intent intent = new Intent(DecryptActivity.this, ImportKeysActivity.class);
|
Intent intent = new Intent(DecryptActivity.this, ImportKeysActivity.class);
|
||||||
intent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEYSERVER);
|
intent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEY_SERVER);
|
||||||
intent.putExtra(ImportKeysActivity.EXTRA_KEY_ID, mSignatureKeyId);
|
intent.putExtra(ImportKeysActivity.EXTRA_KEY_ID, mSignatureKeyId);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.Id;
|
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||||
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
import org.sufficientlysecure.keychain.service.KeychainIntentService;
|
||||||
@ -56,8 +55,8 @@ public class ImportKeysActivity extends DrawerActivity implements ActionBar.OnNa
|
|||||||
public static final String ACTION_IMPORT_KEY = Constants.INTENT_PREFIX + "IMPORT_KEY";
|
public static final String ACTION_IMPORT_KEY = Constants.INTENT_PREFIX + "IMPORT_KEY";
|
||||||
public static final String ACTION_IMPORT_KEY_FROM_QR_CODE = Constants.INTENT_PREFIX
|
public static final String ACTION_IMPORT_KEY_FROM_QR_CODE = Constants.INTENT_PREFIX
|
||||||
+ "IMPORT_KEY_FROM_QR_CODE";
|
+ "IMPORT_KEY_FROM_QR_CODE";
|
||||||
public static final String ACTION_IMPORT_KEY_FROM_KEYSERVER = Constants.INTENT_PREFIX
|
public static final String ACTION_IMPORT_KEY_FROM_KEY_SERVER = Constants.INTENT_PREFIX
|
||||||
+ "IMPORT_KEY_FROM_KEYSERVER";
|
+ "IMPORT_KEY_FROM_KEY_SERVER";
|
||||||
|
|
||||||
// Actions for internal use only:
|
// Actions for internal use only:
|
||||||
public static final String ACTION_IMPORT_KEY_FROM_FILE = Constants.INTENT_PREFIX
|
public static final String ACTION_IMPORT_KEY_FROM_FILE = Constants.INTENT_PREFIX
|
||||||
@ -68,11 +67,10 @@ public class ImportKeysActivity extends DrawerActivity implements ActionBar.OnNa
|
|||||||
// only used by ACTION_IMPORT_KEY
|
// only used by ACTION_IMPORT_KEY
|
||||||
public static final String EXTRA_KEY_BYTES = "key_bytes";
|
public static final String EXTRA_KEY_BYTES = "key_bytes";
|
||||||
|
|
||||||
// only used by ACTION_IMPORT_KEY_FROM_KEYSERVER
|
// only used by ACTION_IMPORT_KEY_FROM_KEY_SERVER
|
||||||
public static final String EXTRA_QUERY = "query";
|
public static final String EXTRA_QUERY = "query";
|
||||||
public static final String EXTRA_KEY_ID = "key_id";
|
public static final String EXTRA_KEY_ID = "key_id";
|
||||||
public static final String EXTRA_FINGERPRINT = "fingerprint";
|
public static final String EXTRA_FINGERPRINT = "fingerprint";
|
||||||
// public static final String RESULT_EXTRA_TEXT = "text";
|
|
||||||
|
|
||||||
// view
|
// view
|
||||||
private ImportKeysListFragment mListFragment;
|
private ImportKeysListFragment mListFragment;
|
||||||
@ -103,7 +101,6 @@ public class ImportKeysActivity extends DrawerActivity implements ActionBar.OnNa
|
|||||||
Context context = getSupportActionBar().getThemedContext();
|
Context context = getSupportActionBar().getThemedContext();
|
||||||
ArrayAdapter<CharSequence> navigationAdapter = ArrayAdapter.createFromResource(context,
|
ArrayAdapter<CharSequence> navigationAdapter = ArrayAdapter.createFromResource(context,
|
||||||
R.array.import_action_list, android.R.layout.simple_spinner_dropdown_item);
|
R.array.import_action_list, android.R.layout.simple_spinner_dropdown_item);
|
||||||
// list.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
|
|
||||||
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
|
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
|
||||||
getSupportActionBar().setListNavigationCallbacks(navigationAdapter, this);
|
getSupportActionBar().setListNavigationCallbacks(navigationAdapter, this);
|
||||||
|
|
||||||
@ -145,7 +142,7 @@ public class ImportKeysActivity extends DrawerActivity implements ActionBar.OnNa
|
|||||||
// directly load data
|
// directly load data
|
||||||
startListFragment(savedInstanceState, importData, null, null);
|
startListFragment(savedInstanceState, importData, null, null);
|
||||||
}
|
}
|
||||||
} else if (ACTION_IMPORT_KEY_FROM_KEYSERVER.equals(action)) {
|
} else if (ACTION_IMPORT_KEY_FROM_KEY_SERVER.equals(action)) {
|
||||||
String query = null;
|
String query = null;
|
||||||
if (extras.containsKey(EXTRA_QUERY)) {
|
if (extras.containsKey(EXTRA_QUERY)) {
|
||||||
query = extras.getString(EXTRA_QUERY);
|
query = extras.getString(EXTRA_QUERY);
|
||||||
|
@ -398,7 +398,7 @@ public class ViewKeyActivity extends ActionBarActivity implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
Intent queryIntent = new Intent(this, ImportKeysActivity.class);
|
Intent queryIntent = new Intent(this, ImportKeysActivity.class);
|
||||||
queryIntent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEYSERVER);
|
queryIntent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEY_SERVER);
|
||||||
queryIntent.putExtra(ImportKeysActivity.EXTRA_KEY_ID, updateKeyId);
|
queryIntent.putExtra(ImportKeysActivity.EXTRA_KEY_ID, updateKeyId);
|
||||||
|
|
||||||
// TODO: lookup??
|
// TODO: lookup??
|
||||||
|
@ -89,7 +89,7 @@ public class LookupUnknownKeyDialogFragment extends DialogFragment {
|
|||||||
sendMessageToHandler(MESSAGE_OKAY);
|
sendMessageToHandler(MESSAGE_OKAY);
|
||||||
|
|
||||||
Intent intent = new Intent(activity, ImportKeysActivity.class);
|
Intent intent = new Intent(activity, ImportKeysActivity.class);
|
||||||
intent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEYSERVER);
|
intent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEY_SERVER);
|
||||||
intent.putExtra(ImportKeysActivity.EXTRA_KEY_ID, unknownKeyId);
|
intent.putExtra(ImportKeysActivity.EXTRA_KEY_ID, unknownKeyId);
|
||||||
startActivityForResult(intent, Id.request.look_up_key_id);
|
startActivityForResult(intent, Id.request.look_up_key_id);
|
||||||
}
|
}
|
||||||
|
@ -74,8 +74,9 @@ To do automatic encryption/decryption/sign/verify use the OpenPGP Remote API.
|
|||||||
* ``org.sufficientlysecure.keychain.action.IMPORT_KEY``
|
* ``org.sufficientlysecure.keychain.action.IMPORT_KEY``
|
||||||
* Extras: ``key_bytes`` (type: ``byte[]``)
|
* Extras: ``key_bytes`` (type: ``byte[]``)
|
||||||
* or set data ``Uri`` (``intent.setData()``) pointing to a file
|
* or set data ``Uri`` (``intent.setData()``) pointing to a file
|
||||||
* ``org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_KEYSERVER``
|
* ``org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_KEY_SERVER``
|
||||||
* Extras: ``query`` (type: ``String``)
|
* Extras: ``query`` (type: ``String``)
|
||||||
|
* or ``fingerprint`` (type: ``String``)
|
||||||
* ``org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_QR_CODE``
|
* ``org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_QR_CODE``
|
||||||
* without extras, starts Barcode Scanner to get QR Code
|
* without extras, starts Barcode Scanner to get QR Code
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user