mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-17 14:25:08 -05:00
make masterKeyId and subKeyId strictly required in CryptoInputParcel
This commit is contained in:
parent
1deb5dbfda
commit
18844a20bb
@ -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;
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
@ -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<Integer> mSignAlgos = new ArrayList<>();
|
||||
ArrayList<byte[]> 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;
|
||||
|
Loading…
Reference in New Issue
Block a user