mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -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) {
|
} catch (NfcSyncPublicKeyDataDecryptorFactoryBuilder.NfcInteractionNeeded e) {
|
||||||
log.add(LogType.MSG_DC_PENDING_NFC, indent + 1);
|
log.add(LogType.MSG_DC_PENDING_NFC, indent + 1);
|
||||||
return new DecryptVerifyResult(log, RequiredInputParcel.createNfcDecryptOperation(
|
return new DecryptVerifyResult(log, RequiredInputParcel.createNfcDecryptOperation(
|
||||||
e.encryptedSessionKey, secretEncryptionKey.getKeyId()
|
secretEncryptionKey.getRing().getMasterKeyId(),
|
||||||
|
secretEncryptionKey.getKeyId(), e.encryptedSessionKey
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
encryptedData = encryptedDataAsymmetric;
|
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
|
// this secret key diverts to a OpenPGP card, throw exception with hash that will be signed
|
||||||
log.add(LogType.MSG_PSE_PENDING_NFC, indent);
|
log.add(LogType.MSG_PSE_PENDING_NFC, indent);
|
||||||
return new PgpSignEncryptResult(log, RequiredInputParcel.createNfcSignOperation(
|
return new PgpSignEncryptResult(log, RequiredInputParcel.createNfcSignOperation(
|
||||||
|
signingKey.getRing().getMasterKeyId(), signingKey.getKeyId(),
|
||||||
e.hashToSign, e.hashAlgo, cryptoInput.getSignatureTime()));
|
e.hashToSign, e.hashAlgo, cryptoInput.getSignatureTime()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,6 @@ import java.util.Date;
|
|||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.Constants.key;
|
|
||||||
|
|
||||||
|
|
||||||
public class RequiredInputParcel implements Parcelable {
|
public class RequiredInputParcel implements Parcelable {
|
||||||
|
|
||||||
@ -23,8 +21,8 @@ public class RequiredInputParcel implements Parcelable {
|
|||||||
public final byte[][] mInputHashes;
|
public final byte[][] mInputHashes;
|
||||||
public final int[] mSignAlgos;
|
public final int[] mSignAlgos;
|
||||||
|
|
||||||
private Long mMasterKeyId;
|
private long mMasterKeyId;
|
||||||
private Long mSubKeyId;
|
private long mSubKeyId;
|
||||||
|
|
||||||
private RequiredInputParcel(RequiredInputType type, byte[][] inputHashes,
|
private RequiredInputParcel(RequiredInputType type, byte[][] inputHashes,
|
||||||
int[] signAlgos, Date signatureTime, Long masterKeyId, Long subKeyId) {
|
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;
|
mSignatureTime = source.readInt() != 0 ? new Date(source.readLong()) : null;
|
||||||
mMasterKeyId = source.readInt() != 0 ? source.readLong() : null;
|
mMasterKeyId = source.readLong();
|
||||||
mSubKeyId = source.readInt() != 0 ? source.readLong() : null;
|
mSubKeyId = source.readLong();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,15 +74,17 @@ public class RequiredInputParcel implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static RequiredInputParcel createNfcSignOperation(
|
public static RequiredInputParcel createNfcSignOperation(
|
||||||
|
long masterKeyId, long subKeyId,
|
||||||
byte[] inputHash, int signAlgo, Date signatureTime) {
|
byte[] inputHash, int signAlgo, Date signatureTime) {
|
||||||
return new RequiredInputParcel(RequiredInputType.NFC_SIGN,
|
return new RequiredInputParcel(RequiredInputType.NFC_SIGN,
|
||||||
new byte[][] { inputHash }, new int[] { signAlgo },
|
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,
|
return new RequiredInputParcel(RequiredInputType.NFC_DECRYPT,
|
||||||
new byte[][] { inputHash }, null, null, null, subKeyId);
|
new byte[][] { inputHash }, null, null, masterKeyId, subKeyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RequiredInputParcel createRequiredSignPassphrase(
|
public static RequiredInputParcel createRequiredSignPassphrase(
|
||||||
@ -136,18 +136,8 @@ public class RequiredInputParcel implements Parcelable {
|
|||||||
} else {
|
} else {
|
||||||
dest.writeInt(0);
|
dest.writeInt(0);
|
||||||
}
|
}
|
||||||
if (mMasterKeyId != null) {
|
dest.writeLong(mMasterKeyId);
|
||||||
dest.writeInt(1);
|
dest.writeLong(mSubKeyId);
|
||||||
dest.writeLong(mMasterKeyId);
|
|
||||||
} else {
|
|
||||||
dest.writeInt(0);
|
|
||||||
}
|
|
||||||
if (mSubKeyId != null) {
|
|
||||||
dest.writeInt(1);
|
|
||||||
dest.writeLong(mSubKeyId);
|
|
||||||
} else {
|
|
||||||
dest.writeInt(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,10 +155,10 @@ public class RequiredInputParcel implements Parcelable {
|
|||||||
Date mSignatureTime;
|
Date mSignatureTime;
|
||||||
ArrayList<Integer> mSignAlgos = new ArrayList<>();
|
ArrayList<Integer> mSignAlgos = new ArrayList<>();
|
||||||
ArrayList<byte[]> mInputHashes = new ArrayList<>();
|
ArrayList<byte[]> mInputHashes = new ArrayList<>();
|
||||||
Long mMasterKeyId;
|
long mMasterKeyId;
|
||||||
Long mSubKeyId;
|
long mSubKeyId;
|
||||||
|
|
||||||
public NfcSignOperationsBuilder(Date signatureTime, Long masterKeyId, Long subKeyId) {
|
public NfcSignOperationsBuilder(Date signatureTime, long masterKeyId, long subKeyId) {
|
||||||
mSignatureTime = signatureTime;
|
mSignatureTime = signatureTime;
|
||||||
mMasterKeyId = masterKeyId;
|
mMasterKeyId = masterKeyId;
|
||||||
mSubKeyId = subKeyId;
|
mSubKeyId = subKeyId;
|
||||||
|
Loading…
Reference in New Issue
Block a user