From 4c1ddd77435ed769826947e5dafffa16148860c8 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Thu, 28 May 2015 23:14:03 +0200 Subject: [PATCH] Partially revert "make masterKeyId and subKeyId strictly required in CryptoInputParcel" We do need empty masterKeyIds for symmetric passphrases, whoops :) --- .../service/input/RequiredInputParcel.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) 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 6436589e3..5f90f6576 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 @@ -21,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) { @@ -60,8 +60,8 @@ public class RequiredInputParcel implements Parcelable { } mSignatureTime = source.readInt() != 0 ? new Date(source.readLong()) : null; - mMasterKeyId = source.readLong(); - mSubKeyId = source.readLong(); + mMasterKeyId = source.readInt() != 0 ? source.readLong() : null; + mSubKeyId = source.readInt() != 0 ? source.readLong() : null; } @@ -136,8 +136,18 @@ public class RequiredInputParcel implements Parcelable { } else { dest.writeInt(0); } - dest.writeLong(mMasterKeyId); - dest.writeLong(mSubKeyId); + 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); + } }