diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml
index 8d76101ae..fa0286a90 100644
--- a/OpenKeychain/src/main/AndroidManifest.xml
+++ b/OpenKeychain/src/main/AndroidManifest.xml
@@ -454,6 +454,14 @@
+
+
+
+
+
+
+
+
getAllowedKeyIds();
@@ -55,7 +56,8 @@ public abstract class PgpDecryptVerifyInputParcel implements Parcelable {
public static Builder builder() {
return new AutoValue_PgpDecryptVerifyInputParcel.Builder()
.setAllowSymmetricDecryption(false)
- .setDecryptMetadataOnly(false);
+ .setDecryptMetadataOnly(false)
+ .setAutocryptSetup(false);
}
@AutoValue.Builder
@@ -68,6 +70,7 @@ public abstract class PgpDecryptVerifyInputParcel implements Parcelable {
public abstract Builder setDecryptMetadataOnly(boolean decryptMetadataOnly);
public abstract Builder setDetachedSignature(byte[] detachedSignature);
public abstract Builder setSenderAddress(String senderAddress);
+ public abstract Builder setAutocryptSetup(boolean isAutocryptSetup);
public abstract Builder setAllowedKeyIds(List allowedKeyIds);
abstract List getAllowedKeyIds();
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java
index 0fab963c6..6451019a5 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java
@@ -315,7 +315,12 @@ public class PgpDecryptVerifyOperation extends BaseOperation inputUris, boolean canDelete) {
+ public void displayListFragment(ArrayList inputUris, boolean canDelete, boolean isAutocryptSetup) {
- DecryptListFragment frag = DecryptListFragment.newInstance(inputUris, canDelete);
+ DecryptListFragment frag = DecryptListFragment.newInstance(inputUris, canDelete, isAutocryptSetup);
FragmentManager fragMan = getSupportFragmentManager();
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java
index 17812a13a..b1aaecc20 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java
@@ -125,6 +125,7 @@ public class DecryptListFragment
public static final String ARG_CANCELLED_URIS = "cancelled_uris";
public static final String ARG_RESULTS = "results";
public static final String ARG_CAN_DELETE = "can_delete";
+ public static final String ARG_IS_AUTOCRYPT_SETUP = "is_autocrypt_setup";
private static final int REQUEST_CODE_OUTPUT = 0x00007007;
private static final int REQUEST_PERMISSION_READ_EXTERNAL_STORAGE = 12;
@@ -136,6 +137,7 @@ public class DecryptListFragment
private Uri mCurrentInputUri;
private boolean mCanDelete;
+ private boolean mIsAutocryptSetup;
private DecryptFilesAdapter mAdapter;
private Uri mCurrentSaveFileUri;
@@ -143,12 +145,13 @@ public class DecryptListFragment
/**
* Creates new instance of this fragment
*/
- public static DecryptListFragment newInstance(@NonNull ArrayList uris, boolean canDelete) {
+ public static DecryptListFragment newInstance(@NonNull ArrayList uris, boolean canDelete, boolean isAutocryptSetup) {
DecryptListFragment frag = new DecryptListFragment();
Bundle args = new Bundle();
args.putParcelableArrayList(ARG_INPUT_URIS, uris);
args.putBoolean(ARG_CAN_DELETE, canDelete);
+ args.putBoolean(ARG_IS_AUTOCRYPT_SETUP, isAutocryptSetup);
frag.setArguments(args);
return frag;
@@ -205,6 +208,7 @@ public class DecryptListFragment
outState.putParcelable(ARG_OUTPUT_URIS, new ParcelableHashMap<>(mInputDataResults));
outState.putParcelableArrayList(ARG_CANCELLED_URIS, mCancelledInputUris);
outState.putBoolean(ARG_CAN_DELETE, mCanDelete);
+ outState.putBoolean(ARG_IS_AUTOCRYPT_SETUP, mIsAutocryptSetup);
// this does not save mCurrentInputUri - if anything is being
// processed at fragment recreation time, the operation in
@@ -222,6 +226,7 @@ public class DecryptListFragment
ParcelableHashMap results = args.getParcelable(ARG_RESULTS);
mCanDelete = args.getBoolean(ARG_CAN_DELETE, false);
+ mIsAutocryptSetup = args.getBoolean(ARG_IS_AUTOCRYPT_SETUP, false);
displayInputUris(inputUris, cancelledUris,
results != null ? results.getMap() : null
@@ -638,11 +643,14 @@ public class DecryptListFragment
}
PgpDecryptVerifyInputParcel.Builder decryptInput = PgpDecryptVerifyInputParcel.builder()
- .setAllowSymmetricDecryption(true);
+ .setAllowSymmetricDecryption(true)
+ .setAutocryptSetup(mIsAutocryptSetup);
return InputDataParcel.createInputDataParcel(mCurrentInputUri, decryptInput.build());
}
+
+
/**
* Request READ_EXTERNAL_STORAGE permission on Android >= 6.0 to read content from "file" Uris.
*
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java
index 4e1424edc..bd0f84764 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java
@@ -203,7 +203,8 @@ public class PassphraseDialogActivity extends FragmentActivity {
return dialog;
}
- if (mRequiredInput.mType == RequiredInputType.NUMERIC_9X4) {
+ if (mRequiredInput.mType == RequiredInputType.NUMERIC_9X4 ||
+ mRequiredInput.mType == RequiredInputType.NUMERIC_9X4_AUTOCRYPT) {
LayoutInflater inflater = LayoutInflater.from(theme);
View view = inflater.inflate(R.layout.passphrase_dialog_numeric_9x4, null);
alert.setView(view);
@@ -234,9 +235,14 @@ public class PassphraseDialogActivity extends FragmentActivity {
setupEditTextFocusNext(mBackupCodeEditText, false);
}
+ if (mRequiredInput.mType == RequiredInputType.NUMERIC_9X4_AUTOCRYPT) {
+ TextView promptText = view.findViewById(R.id.passphrase_text);
+ promptText.setText(R.string.passphrase_transfer_autocrypt);
+ }
+
AlertDialog dialog = alert.create();
dialog.setButton(DialogInterface.BUTTON_POSITIVE,
- activity.getString(R.string.btn_unlock), (DialogInterface.OnClickListener) null);
+ activity.getString(R.string.btn_proceed), (DialogInterface.OnClickListener) null);
return dialog;
}
@@ -470,7 +476,8 @@ public class PassphraseDialogActivity extends FragmentActivity {
return;
}
- if (mRequiredInput.mType == RequiredInputType.NUMERIC_9X4) {
+ if (mRequiredInput.mType == RequiredInputType.NUMERIC_9X4 ||
+ mRequiredInput.mType == RequiredInputType.NUMERIC_9X4_AUTOCRYPT) {
StringBuilder backupCodeInput = new StringBuilder(36);
if (mRequiredInput.hasPassphraseBegin()) {
backupCodeInput.append(mRequiredInput.getPassphraseBegin());
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CryptoOperationHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CryptoOperationHelper.java
index 6af53d997..06dc54345 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CryptoOperationHelper.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CryptoOperationHelper.java
@@ -163,7 +163,8 @@ public class CryptoOperationHelper
diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml
index f8f73fa9f..045b3f572 100644
--- a/OpenKeychain/src/main/res/values/strings.xml
+++ b/OpenKeychain/src/main/res/values/strings.xml
@@ -102,6 +102,7 @@
"Encrypt text"
"Add additional email address"
"Unlock"
+ "Proceed"
"Add"
"Save as default"
"Saved!"
@@ -334,6 +335,7 @@
"Switch to alphabetic keyboard"
"Switch to numeric keyboard"
"Enter transfer code"
+ "To import this Autocrypt Setup Message, enter transfer code:"
"Enter PIN for '%s'"
"Enter PIN to access Security Token for '%s'"
"Hold Security Token against the NFC marker at the back of your device."
@@ -634,6 +636,7 @@
"Import Key with OpenKeychain"
"Encrypt with OpenKeychain"
"Decrypt with OpenKeychain"
+ "Import Autocrypt Setup Message"
"Show advanced information"