diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index aa1125800..ea5147eb5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -602,7 +602,8 @@ public class PgpDecryptVerify extends BaseOperation { } catch (NfcSyncPublicKeyDataDecryptorFactoryBuilder.NfcInteractionNeeded e) { log.add(LogType.MSG_DC_PENDING_NFC, indent + 1); return new DecryptVerifyResult(log, RequiredInputParcel.createNfcDecryptOperation( - e.encryptedSessionKey, secretEncryptionKey.getKeyId() + secretEncryptionKey.getRing().getMasterKeyId(), + secretEncryptionKey.getKeyId(), e.encryptedSessionKey )); } encryptedData = encryptedDataAsymmetric; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java index 9073e81b9..89bdf1c89 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncryptOperation.java @@ -497,6 +497,7 @@ public class PgpSignEncryptOperation extends BaseOperation { // this secret key diverts to a OpenPGP card, throw exception with hash that will be signed log.add(LogType.MSG_PSE_PENDING_NFC, indent); return new PgpSignEncryptResult(log, RequiredInputParcel.createNfcSignOperation( + signingKey.getRing().getMasterKeyId(), signingKey.getKeyId(), e.hashToSign, e.hashAlgo, cryptoInput.getSignatureTime())); } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/RequiredInputParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/RequiredInputParcel.java index 535c1e735..6436589e3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/RequiredInputParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/RequiredInputParcel.java @@ -7,8 +7,6 @@ import java.util.Date; import android.os.Parcel; import android.os.Parcelable; -import org.sufficientlysecure.keychain.Constants.key; - public class RequiredInputParcel implements Parcelable { @@ -23,8 +21,8 @@ public class RequiredInputParcel implements Parcelable { public final byte[][] mInputHashes; public final int[] mSignAlgos; - private Long mMasterKeyId; - private Long mSubKeyId; + private long mMasterKeyId; + private long mSubKeyId; private RequiredInputParcel(RequiredInputType type, byte[][] inputHashes, int[] signAlgos, Date signatureTime, Long masterKeyId, Long subKeyId) { @@ -62,8 +60,8 @@ public class RequiredInputParcel implements Parcelable { } mSignatureTime = source.readInt() != 0 ? new Date(source.readLong()) : null; - mMasterKeyId = source.readInt() != 0 ? source.readLong() : null; - mSubKeyId = source.readInt() != 0 ? source.readLong() : null; + mMasterKeyId = source.readLong(); + mSubKeyId = source.readLong(); } @@ -76,15 +74,17 @@ public class RequiredInputParcel implements Parcelable { } public static RequiredInputParcel createNfcSignOperation( + long masterKeyId, long subKeyId, byte[] inputHash, int signAlgo, Date signatureTime) { return new RequiredInputParcel(RequiredInputType.NFC_SIGN, new byte[][] { inputHash }, new int[] { signAlgo }, - signatureTime, null, null); + signatureTime, masterKeyId, subKeyId); } - public static RequiredInputParcel createNfcDecryptOperation(byte[] inputHash, long subKeyId) { + public static RequiredInputParcel createNfcDecryptOperation( + long masterKeyId, long subKeyId, byte[] inputHash) { return new RequiredInputParcel(RequiredInputType.NFC_DECRYPT, - new byte[][] { inputHash }, null, null, null, subKeyId); + new byte[][] { inputHash }, null, null, masterKeyId, subKeyId); } public static RequiredInputParcel createRequiredSignPassphrase( @@ -136,18 +136,8 @@ public class RequiredInputParcel implements Parcelable { } else { dest.writeInt(0); } - if (mMasterKeyId != null) { - dest.writeInt(1); - dest.writeLong(mMasterKeyId); - } else { - dest.writeInt(0); - } - if (mSubKeyId != null) { - dest.writeInt(1); - dest.writeLong(mSubKeyId); - } else { - dest.writeInt(0); - } + dest.writeLong(mMasterKeyId); + dest.writeLong(mSubKeyId); } @@ -165,10 +155,10 @@ public class RequiredInputParcel implements Parcelable { Date mSignatureTime; ArrayList mSignAlgos = new ArrayList<>(); ArrayList mInputHashes = new ArrayList<>(); - Long mMasterKeyId; - Long mSubKeyId; + long mMasterKeyId; + long mSubKeyId; - public NfcSignOperationsBuilder(Date signatureTime, Long masterKeyId, Long subKeyId) { + public NfcSignOperationsBuilder(Date signatureTime, long masterKeyId, long subKeyId) { mSignatureTime = signatureTime; mMasterKeyId = masterKeyId; mSubKeyId = subKeyId;