Support import from application/autocrypt-setup type

This commit is contained in:
Vincent Breitmoser
2018-04-13 21:36:09 +02:00
parent 079305c375
commit 9bb19a3ad7
10 changed files with 59 additions and 12 deletions

View File

@@ -41,6 +41,7 @@ public abstract class PgpDecryptVerifyInputParcel implements Parcelable {
abstract boolean isAllowSymmetricDecryption();
abstract boolean isDecryptMetadataOnly();
abstract boolean isAutocryptSetup();
@Nullable
abstract List<Long> 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<Long> allowedKeyIds);
abstract List<Long> getAllowedKeyIds();

View File

@@ -315,7 +315,12 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp
if (armorHeaders.backupVersion != null && armorHeaders.backupVersion == 2) {
customRequiredInputParcel = RequiredInputParcel.createRequiredBackupCode();
} else if (PASSPHRASE_FORMAT_NUMERIC9X4.equalsIgnoreCase(armorHeaders.passphraseFormat)) {
customRequiredInputParcel = RequiredInputParcel.createRequiredNumeric9x4(armorHeaders.passphraseBegin);
if (input.isAutocryptSetup()) {
customRequiredInputParcel =
RequiredInputParcel.createRequiredNumeric9x4Autocrypt(armorHeaders.passphraseBegin);
} else {
customRequiredInputParcel = RequiredInputParcel.createRequiredNumeric9x4(armorHeaders.passphraseBegin);
}
}
OpenPgpDecryptionResultBuilder decryptionResultBuilder = new OpenPgpDecryptionResultBuilder();