mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-19 20:31:52 -05:00
added placeholder proxy to AddKeyServer
This commit is contained in:
parent
3663f55d50
commit
efb77a4c2d
@ -466,13 +466,13 @@ public class KeychainService extends Service implements Progressable {
|
|||||||
|
|
||||||
Thread actionThread = new Thread(actionRunnable);
|
Thread actionThread = new Thread(actionRunnable);
|
||||||
actionThread.start();
|
actionThread.start();
|
||||||
|
|
||||||
return START_NOT_STICKY;
|
return START_NOT_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Proxy getProxyFromBundle(Bundle data) {
|
private final Proxy getProxyFromBundle(Bundle data) {
|
||||||
ParcelableProxy parcelableProxy = data.getParcelable(EXTRA_PARCELABLE_PROXY);
|
ParcelableProxy parcelableProxy = data.getParcelable(EXTRA_PARCELABLE_PROXY);
|
||||||
return parcelableProxy==null?null:parcelableProxy.getProxy();
|
return parcelableProxy == null ? null : parcelableProxy.getProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendProofError(List<String> log, String label) {
|
private void sendProofError(List<String> log, String label) {
|
||||||
|
@ -100,8 +100,7 @@ public class ImportKeysListCloudLoader
|
|||||||
*/
|
*/
|
||||||
private void queryServer(boolean enforceFingerprint) {
|
private void queryServer(boolean enforceFingerprint) {
|
||||||
try {
|
try {
|
||||||
ArrayList<ImportKeysListEntry> searchResult
|
ArrayList<ImportKeysListEntry> searchResult = CloudSearch.search(mServerQuery, mCloudPrefs, mProxy);
|
||||||
= CloudSearch.search(mServerQuery, mCloudPrefs, mProxy);
|
|
||||||
|
|
||||||
mEntryList.clear();
|
mEntryList.clear();
|
||||||
// add result to data
|
// add result to data
|
||||||
|
@ -42,17 +42,16 @@ import android.widget.EditText;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.TextView.OnEditorActionListener;
|
import android.widget.TextView.OnEditorActionListener;
|
||||||
|
|
||||||
|
import com.squareup.okhttp.OkHttpClient;
|
||||||
|
import com.squareup.okhttp.Request;
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
|
import org.sufficientlysecure.keychain.keyimport.HkpKeyserver;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
import org.sufficientlysecure.keychain.util.TlsHelper;
|
import org.sufficientlysecure.keychain.util.TlsHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.*;
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
|
||||||
@ -80,7 +79,6 @@ public class AddKeyserverDialogFragment extends DialogFragment implements OnEdit
|
|||||||
/**
|
/**
|
||||||
* Creates new instance of this dialog fragment
|
* Creates new instance of this dialog fragment
|
||||||
*
|
*
|
||||||
* @param title title of dialog
|
|
||||||
* @param messenger to communicate back after setting the passphrase
|
* @param messenger to communicate back after setting the passphrase
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -171,7 +169,8 @@ public class AddKeyserverDialogFragment extends DialogFragment implements OnEdit
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
String keyserverUrl = mKeyserverEditText.getText().toString();
|
String keyserverUrl = mKeyserverEditText.getText().toString();
|
||||||
if (mVerifyKeyserverCheckBox.isChecked()) {
|
if (mVerifyKeyserverCheckBox.isChecked()) {
|
||||||
verifyConnection(keyserverUrl);
|
// TODO: PHILIP Implement proxy
|
||||||
|
verifyConnection(keyserverUrl, null);
|
||||||
} else {
|
} else {
|
||||||
dismiss();
|
dismiss();
|
||||||
// return unverified keyserver back to activity
|
// return unverified keyserver back to activity
|
||||||
@ -198,7 +197,7 @@ public class AddKeyserverDialogFragment extends DialogFragment implements OnEdit
|
|||||||
sendMessageToHandler(MESSAGE_VERIFICATION_FAILED, data);
|
sendMessageToHandler(MESSAGE_VERIFICATION_FAILED, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void verifyConnection(String keyserver) {
|
public void verifyConnection(String keyserver, final Proxy proxy) {
|
||||||
|
|
||||||
new AsyncTask<String, Void, FailureReason>() {
|
new AsyncTask<String, Void, FailureReason>() {
|
||||||
ProgressDialog mProgressDialog;
|
ProgressDialog mProgressDialog;
|
||||||
@ -228,7 +227,10 @@ public class AddKeyserverDialogFragment extends DialogFragment implements OnEdit
|
|||||||
URI newKeyserver = new URI(scheme, schemeSpecificPart, fragment);
|
URI newKeyserver = new URI(scheme, schemeSpecificPart, fragment);
|
||||||
|
|
||||||
Log.d("Converted URL", newKeyserver.toString());
|
Log.d("Converted URL", newKeyserver.toString());
|
||||||
TlsHelper.openConnection(newKeyserver.toURL()).getInputStream();
|
|
||||||
|
OkHttpClient client = HkpKeyserver.getClient(newKeyserver.toURL(), proxy);
|
||||||
|
TlsHelper.pinCertificateIfNecessary(client, newKeyserver.toURL());
|
||||||
|
client.newCall(new Request.Builder().url(newKeyserver.toURL()).build()).execute();
|
||||||
} catch (TlsHelper.TlsHelperException e) {
|
} catch (TlsHelper.TlsHelperException e) {
|
||||||
reason = FailureReason.CONNECTION_FAILED;
|
reason = FailureReason.CONNECTION_FAILED;
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user