Remove some Ids...
This commit is contained in:
@@ -28,92 +28,6 @@ import org.spongycastle.bcpg.CompressionAlgorithmTags;
|
|||||||
*/
|
*/
|
||||||
public final class Id {
|
public final class Id {
|
||||||
|
|
||||||
public static final class menu {
|
|
||||||
|
|
||||||
public static final class option {
|
|
||||||
public static final int new_passphrase = 0x21070001;
|
|
||||||
public static final int create = 0x21070002;
|
|
||||||
public static final int about = 0x21070003;
|
|
||||||
public static final int manage_public_keys = 0x21070004;
|
|
||||||
public static final int manage_secret_keys = 0x21070005;
|
|
||||||
public static final int export_keys = 0x21070007;
|
|
||||||
public static final int preferences = 0x21070008;
|
|
||||||
public static final int search = 0x21070009;
|
|
||||||
public static final int help = 0x21070010;
|
|
||||||
public static final int key_server = 0x21070011;
|
|
||||||
public static final int scanQRCode = 0x21070012;
|
|
||||||
public static final int encrypt = 0x21070013;
|
|
||||||
public static final int encrypt_to_clipboard = 0x21070014;
|
|
||||||
public static final int decrypt = 0x21070015;
|
|
||||||
public static final int reply = 0x21070016;
|
|
||||||
public static final int cancel = 0x21070017;
|
|
||||||
public static final int save = 0x21070018;
|
|
||||||
public static final int okay = 0x21070019;
|
|
||||||
public static final int import_from_file = 0x21070020;
|
|
||||||
public static final int import_from_qr_code = 0x21070021;
|
|
||||||
public static final int import_from_nfc = 0x21070022;
|
|
||||||
public static final int crypto_consumers = 0x21070023;
|
|
||||||
public static final int createExpert = 0x21070024;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// use only lower 16 bits due to compatibility lib
|
|
||||||
public static final class message {
|
|
||||||
public static final int progress_update = 0x00006001;
|
|
||||||
public static final int done = 0x00006002;
|
|
||||||
public static final int import_keys = 0x00006003;
|
|
||||||
public static final int export_keys = 0x00006004;
|
|
||||||
public static final int import_done = 0x00006005;
|
|
||||||
public static final int export_done = 0x00006006;
|
|
||||||
public static final int create_key = 0x00006007;
|
|
||||||
public static final int edit_key = 0x00006008;
|
|
||||||
public static final int delete_done = 0x00006009;
|
|
||||||
public static final int query_done = 0x00006010;
|
|
||||||
public static final int unknown_signature_key = 0x00006011;
|
|
||||||
}
|
|
||||||
|
|
||||||
// use only lower 16 bits due to compatibility lib
|
|
||||||
public static final class request {
|
|
||||||
public static final int public_keys = 0x00007001;
|
|
||||||
public static final int secret_keys = 0x00007002;
|
|
||||||
public static final int filename = 0x00007003;
|
|
||||||
// public static final int output_filename = 0x00007004;
|
|
||||||
public static final int key_server_preference = 0x00007005;
|
|
||||||
// public static final int look_up_key_id = 0x00007006;
|
|
||||||
public static final int export_to_server = 0x00007007;
|
|
||||||
public static final int import_from_qr_code = 0x00007008;
|
|
||||||
public static final int sign_key = 0x00007009;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class dialog {
|
|
||||||
public static final int passphrase = 0x21070001;
|
|
||||||
public static final int encrypting = 0x21070002;
|
|
||||||
public static final int decrypting = 0x21070003;
|
|
||||||
public static final int new_passphrase = 0x21070004;
|
|
||||||
public static final int passphrases_do_not_match = 0x21070005;
|
|
||||||
public static final int no_passphrase = 0x21070006;
|
|
||||||
public static final int saving = 0x21070007;
|
|
||||||
public static final int delete_key = 0x21070008;
|
|
||||||
public static final int import_keys = 0x21070009;
|
|
||||||
public static final int importing = 0x2107000a;
|
|
||||||
public static final int export_key = 0x2107000b;
|
|
||||||
public static final int export_keys = 0x2107000c;
|
|
||||||
public static final int exporting = 0x2107000d;
|
|
||||||
public static final int new_account = 0x2107000e;
|
|
||||||
public static final int change_log = 0x21070010;
|
|
||||||
public static final int output_filename = 0x21070011;
|
|
||||||
public static final int delete_file = 0x21070012;
|
|
||||||
public static final int deleting = 0x21070013;
|
|
||||||
public static final int help = 0x21070014;
|
|
||||||
public static final int querying = 0x21070015;
|
|
||||||
public static final int lookup_unknown_key = 0x21070016;
|
|
||||||
public static final int signing = 0x21070017;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class task {
|
|
||||||
public static final int import_keys = 0x21070001;
|
|
||||||
public static final int export_keys = 0x21070002;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class type {
|
public static final class type {
|
||||||
public static final int public_key = 0x21070001;
|
public static final int public_key = 0x21070001;
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ import org.spongycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
|
|||||||
import org.spongycastle.openpgp.operator.jcajce.JcePublicKeyDataDecryptorFactoryBuilder;
|
import org.spongycastle.openpgp.operator.jcajce.JcePublicKeyDataDecryptorFactoryBuilder;
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||||
import org.sufficientlysecure.keychain.util.InputData;
|
import org.sufficientlysecure.keychain.util.InputData;
|
||||||
@@ -194,15 +193,9 @@ public class PgpDecryptVerify {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decrypts and/or verifies data based on parameters of class
|
* Decrypts and/or verifies data based on parameters of class
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* @throws IOException
|
|
||||||
* @throws PgpGeneralException
|
|
||||||
* @throws PGPException
|
|
||||||
* @throws SignatureException
|
|
||||||
*/
|
*/
|
||||||
public PgpDecryptVerifyResult execute()
|
public PgpDecryptVerifyResult execute()
|
||||||
throws IOException, PgpGeneralException, PGPException, SignatureException,
|
throws IOException, PGPException, SignatureException,
|
||||||
WrongPassphraseException, NoSecretKeyException, KeyExtractionException,
|
WrongPassphraseException, NoSecretKeyException, KeyExtractionException,
|
||||||
InvalidDataException, IntegrityCheckFailedException {
|
InvalidDataException, IntegrityCheckFailedException {
|
||||||
// automatically works with ascii armor input and binary
|
// automatically works with ascii armor input and binary
|
||||||
@@ -224,16 +217,9 @@ public class PgpDecryptVerify {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decrypt and/or verifies binary or ascii armored pgp
|
* Decrypt and/or verifies binary or ascii armored pgp
|
||||||
*
|
|
||||||
* @param in
|
|
||||||
* @return
|
|
||||||
* @throws IOException
|
|
||||||
* @throws PgpGeneralException
|
|
||||||
* @throws PGPException
|
|
||||||
* @throws SignatureException
|
|
||||||
*/
|
*/
|
||||||
private PgpDecryptVerifyResult decryptVerify(InputStream in)
|
private PgpDecryptVerifyResult decryptVerify(InputStream in)
|
||||||
throws IOException, PgpGeneralException, PGPException, SignatureException,
|
throws IOException, PGPException, SignatureException,
|
||||||
WrongPassphraseException, KeyExtractionException, NoSecretKeyException,
|
WrongPassphraseException, KeyExtractionException, NoSecretKeyException,
|
||||||
InvalidDataException, IntegrityCheckFailedException {
|
InvalidDataException, IntegrityCheckFailedException {
|
||||||
PgpDecryptVerifyResult result = new PgpDecryptVerifyResult();
|
PgpDecryptVerifyResult result = new PgpDecryptVerifyResult();
|
||||||
@@ -574,15 +560,9 @@ public class PgpDecryptVerify {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* The method is heavily based on
|
* The method is heavily based on
|
||||||
* pg/src/main/java/org/spongycastle/openpgp/examples/ClearSignedFileProcessor.java
|
* pg/src/main/java/org/spongycastle/openpgp/examples/ClearSignedFileProcessor.java
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* @throws IOException
|
|
||||||
* @throws PgpGeneralException
|
|
||||||
* @throws PGPException
|
|
||||||
* @throws SignatureException
|
|
||||||
*/
|
*/
|
||||||
private PgpDecryptVerifyResult verifyCleartextSignature(ArmoredInputStream aIn)
|
private PgpDecryptVerifyResult verifyCleartextSignature(ArmoredInputStream aIn)
|
||||||
throws IOException, PgpGeneralException, PGPException, SignatureException, InvalidDataException {
|
throws IOException, PGPException, SignatureException, InvalidDataException {
|
||||||
PgpDecryptVerifyResult result = new PgpDecryptVerifyResult();
|
PgpDecryptVerifyResult result = new PgpDecryptVerifyResult();
|
||||||
OpenPgpSignatureResult signatureResult = new OpenPgpSignatureResult();
|
OpenPgpSignatureResult signatureResult = new OpenPgpSignatureResult();
|
||||||
// cleartext signatures are never encrypted ;)
|
// cleartext signatures are never encrypted ;)
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ import org.spongycastle.openpgp.operator.jcajce.JcePublicKeyKeyEncryptionMethodG
|
|||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.Id;
|
import org.sufficientlysecure.keychain.Id;
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
|
||||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||||
import org.sufficientlysecure.keychain.util.InputData;
|
import org.sufficientlysecure.keychain.util.InputData;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
@@ -248,16 +247,9 @@ public class PgpSignEncrypt {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Signs and/or encrypts data based on parameters of class
|
* Signs and/or encrypts data based on parameters of class
|
||||||
*
|
|
||||||
* @throws IOException
|
|
||||||
* @throws PgpGeneralException
|
|
||||||
* @throws PGPException
|
|
||||||
* @throws NoSuchProviderException
|
|
||||||
* @throws NoSuchAlgorithmException
|
|
||||||
* @throws SignatureException
|
|
||||||
*/
|
*/
|
||||||
public void execute()
|
public void execute()
|
||||||
throws IOException, PgpGeneralException, PGPException, NoSuchProviderException,
|
throws IOException, PGPException, NoSuchProviderException,
|
||||||
NoSuchAlgorithmException, SignatureException, KeyExtractionException, NoSigningKeyException, NoPassphraseException {
|
NoSuchAlgorithmException, SignatureException, KeyExtractionException, NoSigningKeyException, NoPassphraseException {
|
||||||
|
|
||||||
boolean enableSignature = mSignatureMasterKeyId != Id.key.none;
|
boolean enableSignature = mSignatureMasterKeyId != Id.key.none;
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2012-2013 Dominik Schürmann <dominik@dominikschuermann.de>
|
|
||||||
* Copyright (C) 2010-2014 Thialfihar <thi@thialfihar.org>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.sufficientlysecure.keychain.pgp.exception;
|
|
||||||
|
|
||||||
public class NoAsymmetricEncryptionException extends Exception {
|
|
||||||
static final long serialVersionUID = 0xf812773343L;
|
|
||||||
|
|
||||||
public NoAsymmetricEncryptionException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -30,28 +30,24 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.beardedhen.androidbootstrap.BootstrapButton;
|
import com.beardedhen.androidbootstrap.BootstrapButton;
|
||||||
|
|
||||||
import org.spongycastle.openpgp.PGPPublicKey;
|
|
||||||
import org.spongycastle.openpgp.PGPPublicKeyRing;
|
|
||||||
import org.spongycastle.openpgp.PGPSecretKey;
|
import org.spongycastle.openpgp.PGPSecretKey;
|
||||||
import org.spongycastle.openpgp.PGPSecretKeyRing;
|
import org.spongycastle.openpgp.PGPSecretKeyRing;
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.Id;
|
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.provider.KeychainContract;
|
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
public class EncryptAsymmetricFragment extends Fragment {
|
public class EncryptAsymmetricFragment extends Fragment {
|
||||||
public static final String ARG_SIGNATURE_KEY_ID = "signature_key_id";
|
public static final String ARG_SIGNATURE_KEY_ID = "signature_key_id";
|
||||||
public static final String ARG_ENCRYPTION_KEY_IDS = "encryption_key_ids";
|
public static final String ARG_ENCRYPTION_KEY_IDS = "encryption_key_ids";
|
||||||
|
|
||||||
public static final int RESULT_CODE_PUBLIC_KEYS = 0x00007001;
|
public static final int REQUEST_CODE_PUBLIC_KEYS = 0x00007001;
|
||||||
public static final int RESULT_CODE_SECRET_KEYS = 0x00007002;
|
public static final int REQUEST_CODE_SECRET_KEYS = 0x00007002;
|
||||||
|
|
||||||
ProviderHelper mProviderHelper;
|
ProviderHelper mProviderHelper;
|
||||||
|
|
||||||
@@ -242,18 +238,18 @@ public class EncryptAsymmetricFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
intent.putExtra(SelectPublicKeyActivity.EXTRA_SELECTED_MASTER_KEY_IDS, initialKeyIds);
|
intent.putExtra(SelectPublicKeyActivity.EXTRA_SELECTED_MASTER_KEY_IDS, initialKeyIds);
|
||||||
startActivityForResult(intent, Id.request.public_keys);
|
startActivityForResult(intent, REQUEST_CODE_PUBLIC_KEYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectSecretKey() {
|
private void selectSecretKey() {
|
||||||
Intent intent = new Intent(getActivity(), SelectSecretKeyActivity.class);
|
Intent intent = new Intent(getActivity(), SelectSecretKeyActivity.class);
|
||||||
startActivityForResult(intent, Id.request.secret_keys);
|
startActivityForResult(intent, REQUEST_CODE_SECRET_KEYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case RESULT_CODE_PUBLIC_KEYS: {
|
case REQUEST_CODE_PUBLIC_KEYS: {
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
Bundle bundle = data.getExtras();
|
Bundle bundle = data.getExtras();
|
||||||
setEncryptionKeyIds(bundle
|
setEncryptionKeyIds(bundle
|
||||||
@@ -262,7 +258,7 @@ public class EncryptAsymmetricFragment extends Fragment {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case RESULT_CODE_SECRET_KEYS: {
|
case REQUEST_CODE_SECRET_KEYS: {
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
Uri uriMasterKey = data.getData();
|
Uri uriMasterKey = data.getData();
|
||||||
setSignatureKeyId(Long.valueOf(uriMasterKey.getLastPathSegment()));
|
setSignatureKeyId(Long.valueOf(uriMasterKey.getLastPathSegment()));
|
||||||
|
|||||||
@@ -106,12 +106,12 @@ public class EncryptFileFragment extends Fragment {
|
|||||||
mBrowse.setOnClickListener(new View.OnClickListener() {
|
mBrowse.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
FileHelper.openFile(EncryptFileFragment.this, mFilename.getText().toString(), "*/*",
|
FileHelper.openFile(EncryptFileFragment.this, mFilename.getText().toString(), "*/*",
|
||||||
Id.request.filename);
|
RESULT_CODE_FILE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mFileCompression = (Spinner) view.findViewById(R.id.fileCompression);
|
mFileCompression = (Spinner) view.findViewById(R.id.fileCompression);
|
||||||
Choice[] choices = new Choice[] {
|
Choice[] choices = new Choice[]{
|
||||||
new Choice(Id.choice.compression.none, getString(R.string.choice_none) + " ("
|
new Choice(Id.choice.compression.none, getString(R.string.choice_none) + " ("
|
||||||
+ getString(R.string.compression_fast) + ")"),
|
+ getString(R.string.compression_fast) + ")"),
|
||||||
new Choice(Id.choice.compression.zip, "ZIP ("
|
new Choice(Id.choice.compression.zip, "ZIP ("
|
||||||
@@ -253,17 +253,17 @@ public class EncryptFileFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mEncryptInterface.getSignatureKey() != 0 &&
|
if (mEncryptInterface.getSignatureKey() != 0 &&
|
||||||
PassphraseCacheService.getCachedPassphrase(getActivity(),
|
PassphraseCacheService.getCachedPassphrase(getActivity(),
|
||||||
mEncryptInterface.getSignatureKey()) == null) {
|
mEncryptInterface.getSignatureKey()) == null) {
|
||||||
PassphraseDialogFragment.show(getActivity(), mEncryptInterface.getSignatureKey(),
|
PassphraseDialogFragment.show(getActivity(), mEncryptInterface.getSignatureKey(),
|
||||||
new Handler() {
|
new Handler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message message) {
|
public void handleMessage(Message message) {
|
||||||
if (message.what == PassphraseDialogFragment.MESSAGE_OKAY) {
|
if (message.what == PassphraseDialogFragment.MESSAGE_OKAY) {
|
||||||
showOutputFileDialog();
|
showOutputFileDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -292,9 +292,9 @@ public class EncryptFileFragment extends Fragment {
|
|||||||
data.putString(KeychainIntentService.ENCRYPT_SYMMETRIC_PASSPHRASE, passphrase);
|
data.putString(KeychainIntentService.ENCRYPT_SYMMETRIC_PASSPHRASE, passphrase);
|
||||||
} else {
|
} else {
|
||||||
data.putLong(KeychainIntentService.ENCRYPT_SIGNATURE_KEY_ID,
|
data.putLong(KeychainIntentService.ENCRYPT_SIGNATURE_KEY_ID,
|
||||||
mEncryptInterface.getSignatureKey());
|
mEncryptInterface.getSignatureKey());
|
||||||
data.putLongArray(KeychainIntentService.ENCRYPT_ENCRYPTION_KEYS_IDS,
|
data.putLongArray(KeychainIntentService.ENCRYPT_ENCRYPTION_KEYS_IDS,
|
||||||
mEncryptInterface.getEncryptionKeys());
|
mEncryptInterface.getEncryptionKeys());
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(Constants.TAG, "mInputFilename=" + mInputFilename + ", mOutputFilename="
|
Log.d(Constants.TAG, "mInputFilename=" + mInputFilename + ", mOutputFilename="
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ public class ImportKeysFileFragment extends Fragment {
|
|||||||
private ImportKeysActivity mImportActivity;
|
private ImportKeysActivity mImportActivity;
|
||||||
private BootstrapButton mBrowse;
|
private BootstrapButton mBrowse;
|
||||||
|
|
||||||
|
public static final int REQUEST_CODE_FILE = 0x00007003;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new instance of this fragment
|
* Creates new instance of this fragment
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +63,7 @@ public class ImportKeysFileFragment extends Fragment {
|
|||||||
// setting it to text/plain prevents Cynaogenmod's file manager from selecting asc
|
// setting it to text/plain prevents Cynaogenmod's file manager from selecting asc
|
||||||
// or gpg types!
|
// or gpg types!
|
||||||
FileHelper.openFile(ImportKeysFileFragment.this, Constants.Path.APP_DIR + "/",
|
FileHelper.openFile(ImportKeysFileFragment.this, Constants.Path.APP_DIR + "/",
|
||||||
"*/*", Id.request.filename);
|
"*/*", REQUEST_CODE_FILE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -78,7 +80,7 @@ public class ImportKeysFileFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
switch (requestCode & 0xFFFF) {
|
switch (requestCode & 0xFFFF) {
|
||||||
case Id.request.filename: {
|
case REQUEST_CODE_FILE: {
|
||||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||||
|
|
||||||
// load data
|
// load data
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
public static final String ACTION_PREFS_GEN = "org.sufficientlysecure.keychain.ui.PREFS_GEN";
|
public static final String ACTION_PREFS_GEN = "org.sufficientlysecure.keychain.ui.PREFS_GEN";
|
||||||
public static final String ACTION_PREFS_ADV = "org.sufficientlysecure.keychain.ui.PREFS_ADV";
|
public static final String ACTION_PREFS_ADV = "org.sufficientlysecure.keychain.ui.PREFS_ADV";
|
||||||
|
|
||||||
|
public static final int REQUEST_CODE_KEYSERVER_PREF = 0x00007005;
|
||||||
|
|
||||||
private PreferenceScreen mKeyServerPreference = null;
|
private PreferenceScreen mKeyServerPreference = null;
|
||||||
private static Preferences sPreferences;
|
private static Preferences sPreferences;
|
||||||
|
|
||||||
@@ -76,7 +78,7 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
PreferencesKeyServerActivity.class);
|
PreferencesKeyServerActivity.class);
|
||||||
intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS,
|
intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS,
|
||||||
sPreferences.getKeyServers());
|
sPreferences.getKeyServers());
|
||||||
startActivityForResult(intent, Id.request.key_server_preference);
|
startActivityForResult(intent, REQUEST_CODE_KEYSERVER_PREF);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -88,12 +90,12 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_ENCRYPTION_ALGORITHM));
|
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_ENCRYPTION_ALGORITHM));
|
||||||
|
|
||||||
int[] valueIds = new int[]{Id.choice.compression.none, Id.choice.compression.zip,
|
int[] valueIds = new int[]{Id.choice.compression.none, Id.choice.compression.zip,
|
||||||
Id.choice.compression.zlib, Id.choice.compression.bzip2, };
|
Id.choice.compression.zlib, Id.choice.compression.bzip2,};
|
||||||
String[] entries = new String[]{
|
String[] entries = new String[]{
|
||||||
getString(R.string.choice_none) + " (" + getString(R.string.compression_fast) + ")",
|
getString(R.string.choice_none) + " (" + getString(R.string.compression_fast) + ")",
|
||||||
"ZIP (" + getString(R.string.compression_fast) + ")",
|
"ZIP (" + getString(R.string.compression_fast) + ")",
|
||||||
"ZLIB (" + getString(R.string.compression_fast) + ")",
|
"ZLIB (" + getString(R.string.compression_fast) + ")",
|
||||||
"BZIP2 (" + getString(R.string.compression_very_slow) + ")", };
|
"BZIP2 (" + getString(R.string.compression_very_slow) + ")",};
|
||||||
String[] values = new String[valueIds.length];
|
String[] values = new String[valueIds.length];
|
||||||
for (int i = 0; i < values.length; ++i) {
|
for (int i = 0; i < values.length; ++i) {
|
||||||
values[i] = "" + valueIds[i];
|
values[i] = "" + valueIds[i];
|
||||||
@@ -126,7 +128,7 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case Id.request.key_server_preference: {
|
case REQUEST_CODE_KEYSERVER_PREF: {
|
||||||
if (resultCode == RESULT_CANCELED || data == null) {
|
if (resultCode == RESULT_CANCELED || data == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -180,7 +182,7 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
PreferencesKeyServerActivity.class);
|
PreferencesKeyServerActivity.class);
|
||||||
intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS,
|
intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS,
|
||||||
sPreferences.getKeyServers());
|
sPreferences.getKeyServers());
|
||||||
startActivityForResult(intent, Id.request.key_server_preference);
|
startActivityForResult(intent, REQUEST_CODE_KEYSERVER_PREF);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -189,7 +191,7 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case Id.request.key_server_preference: {
|
case REQUEST_CODE_KEYSERVER_PREF: {
|
||||||
if (resultCode == RESULT_CANCELED || data == null) {
|
if (resultCode == RESULT_CANCELED || data == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -225,12 +227,12 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_ENCRYPTION_ALGORITHM));
|
(IntegerListPreference) findPreference(Constants.Pref.DEFAULT_ENCRYPTION_ALGORITHM));
|
||||||
|
|
||||||
int[] valueIds = new int[]{Id.choice.compression.none, Id.choice.compression.zip,
|
int[] valueIds = new int[]{Id.choice.compression.none, Id.choice.compression.zip,
|
||||||
Id.choice.compression.zlib, Id.choice.compression.bzip2, };
|
Id.choice.compression.zlib, Id.choice.compression.bzip2,};
|
||||||
String[] entries = new String[]{
|
String[] entries = new String[]{
|
||||||
getString(R.string.choice_none) + " (" + getString(R.string.compression_fast) + ")",
|
getString(R.string.choice_none) + " (" + getString(R.string.compression_fast) + ")",
|
||||||
"ZIP (" + getString(R.string.compression_fast) + ")",
|
"ZIP (" + getString(R.string.compression_fast) + ")",
|
||||||
"ZLIB (" + getString(R.string.compression_fast) + ")",
|
"ZLIB (" + getString(R.string.compression_fast) + ")",
|
||||||
"BZIP2 (" + getString(R.string.compression_very_slow) + ")", };
|
"BZIP2 (" + getString(R.string.compression_very_slow) + ")",};
|
||||||
String[] values = new String[valueIds.length];
|
String[] values = new String[valueIds.length];
|
||||||
for (int i = 0; i < values.length; ++i) {
|
for (int i = 0; i < values.length; ++i) {
|
||||||
values[i] = "" + valueIds[i];
|
values[i] = "" + valueIds[i];
|
||||||
@@ -280,9 +282,9 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
int valueIds[] = {PGPEncryptedData.AES_128, PGPEncryptedData.AES_192,
|
int valueIds[] = {PGPEncryptedData.AES_128, PGPEncryptedData.AES_192,
|
||||||
PGPEncryptedData.AES_256, PGPEncryptedData.BLOWFISH, PGPEncryptedData.TWOFISH,
|
PGPEncryptedData.AES_256, PGPEncryptedData.BLOWFISH, PGPEncryptedData.TWOFISH,
|
||||||
PGPEncryptedData.CAST5, PGPEncryptedData.DES, PGPEncryptedData.TRIPLE_DES,
|
PGPEncryptedData.CAST5, PGPEncryptedData.DES, PGPEncryptedData.TRIPLE_DES,
|
||||||
PGPEncryptedData.IDEA, };
|
PGPEncryptedData.IDEA,};
|
||||||
String entries[] = {"AES-128", "AES-192", "AES-256", "Blowfish", "Twofish", "CAST5",
|
String entries[] = {"AES-128", "AES-192", "AES-256", "Blowfish", "Twofish", "CAST5",
|
||||||
"DES", "Triple DES", "IDEA", };
|
"DES", "Triple DES", "IDEA",};
|
||||||
String values[] = new String[valueIds.length];
|
String values[] = new String[valueIds.length];
|
||||||
for (int i = 0; i < values.length; ++i) {
|
for (int i = 0; i < values.length; ++i) {
|
||||||
values[i] = "" + valueIds[i];
|
values[i] = "" + valueIds[i];
|
||||||
@@ -307,9 +309,9 @@ public class PreferencesActivity extends PreferenceActivity {
|
|||||||
(final IntegerListPreference mHashAlgorithm, int[] valueIds, String[] entries, String[] values) {
|
(final IntegerListPreference mHashAlgorithm, int[] valueIds, String[] entries, String[] values) {
|
||||||
valueIds = new int[]{HashAlgorithmTags.MD5, HashAlgorithmTags.RIPEMD160,
|
valueIds = new int[]{HashAlgorithmTags.MD5, HashAlgorithmTags.RIPEMD160,
|
||||||
HashAlgorithmTags.SHA1, HashAlgorithmTags.SHA224, HashAlgorithmTags.SHA256,
|
HashAlgorithmTags.SHA1, HashAlgorithmTags.SHA224, HashAlgorithmTags.SHA256,
|
||||||
HashAlgorithmTags.SHA384, HashAlgorithmTags.SHA512, };
|
HashAlgorithmTags.SHA384, HashAlgorithmTags.SHA512,};
|
||||||
entries = new String[]{"MD5", "RIPEMD-160", "SHA-1", "SHA-224", "SHA-256", "SHA-384",
|
entries = new String[]{"MD5", "RIPEMD-160", "SHA-1", "SHA-224", "SHA-256", "SHA-384",
|
||||||
"SHA-512", };
|
"SHA-512",};
|
||||||
values = new String[valueIds.length];
|
values = new String[valueIds.length];
|
||||||
for (int i = 0; i < values.length; ++i) {
|
for (int i = 0; i < values.length; ++i) {
|
||||||
values[i] = "" + valueIds[i];
|
values[i] = "" + valueIds[i];
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import android.view.Window;
|
|||||||
import com.devspark.appmsg.AppMsg;
|
import com.devspark.appmsg.AppMsg;
|
||||||
|
|
||||||
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.compatibility.ClipboardReflection;
|
import org.sufficientlysecure.keychain.compatibility.ClipboardReflection;
|
||||||
import org.sufficientlysecure.keychain.helper.ExportHelper;
|
import org.sufficientlysecure.keychain.helper.ExportHelper;
|
||||||
@@ -54,8 +53,6 @@ import org.sufficientlysecure.keychain.ui.dialog.ShareQrCodeDialogFragment;
|
|||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.Provider;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class ViewKeyActivity extends ActionBarActivity {
|
public class ViewKeyActivity extends ActionBarActivity {
|
||||||
@@ -70,7 +67,7 @@ public class ViewKeyActivity extends ActionBarActivity {
|
|||||||
ViewPager mViewPager;
|
ViewPager mViewPager;
|
||||||
TabsAdapter mTabsAdapter;
|
TabsAdapter mTabsAdapter;
|
||||||
|
|
||||||
private static final int RESULT_CODE_LOOKUP_KEY = 0x00007006;
|
public static final int REQUEST_CODE_LOOKUP_KEY = 0x00007006;
|
||||||
|
|
||||||
// NFC
|
// NFC
|
||||||
private NfcAdapter mNfcAdapter;
|
private NfcAdapter mNfcAdapter;
|
||||||
@@ -189,7 +186,7 @@ public class ViewKeyActivity extends ActionBarActivity {
|
|||||||
private void uploadToKeyserver(Uri dataUri) {
|
private void uploadToKeyserver(Uri dataUri) {
|
||||||
Intent uploadIntent = new Intent(this, UploadKeyActivity.class);
|
Intent uploadIntent = new Intent(this, UploadKeyActivity.class);
|
||||||
uploadIntent.setData(dataUri);
|
uploadIntent.setData(dataUri);
|
||||||
startActivityForResult(uploadIntent, Id.request.export_to_server);
|
startActivityForResult(uploadIntent, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFromKeyserver(Uri dataUri, ProviderHelper providerHelper) {
|
private void updateFromKeyserver(Uri dataUri, ProviderHelper providerHelper) {
|
||||||
@@ -202,7 +199,7 @@ public class ViewKeyActivity extends ActionBarActivity {
|
|||||||
queryIntent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN);
|
queryIntent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN);
|
||||||
queryIntent.putExtra(ImportKeysActivity.EXTRA_FINGERPRINT, fingerprint);
|
queryIntent.putExtra(ImportKeysActivity.EXTRA_FINGERPRINT, fingerprint);
|
||||||
|
|
||||||
startActivityForResult(queryIntent, RESULT_CODE_LOOKUP_KEY);
|
startActivityForResult(queryIntent, REQUEST_CODE_LOOKUP_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shareKey(Uri dataUri, boolean fingerprintOnly, ProviderHelper providerHelper) {
|
private void shareKey(Uri dataUri, boolean fingerprintOnly, ProviderHelper providerHelper) {
|
||||||
@@ -298,7 +295,7 @@ public class ViewKeyActivity extends ActionBarActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case RESULT_CODE_LOOKUP_KEY: {
|
case REQUEST_CODE_LOOKUP_KEY: {
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
// TODO: reload key??? move this into fragment?
|
// TODO: reload key??? move this into fragment?
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user