wrapped-key-ring: small fix to make it work again

This commit is contained in:
Vincent Breitmoser 2014-05-03 19:14:30 +02:00
parent ef6211e0bd
commit 32baf42515
2 changed files with 12 additions and 14 deletions

View File

@ -54,8 +54,4 @@ public abstract class CachedKeyRing {
return mVerified; return mVerified;
} }
public void initSignature(PGPSignature sig) {
}
} }

View File

@ -366,6 +366,7 @@ public class PgpDecryptVerify {
Object dataChunk = plainFact.nextObject(); Object dataChunk = plainFact.nextObject();
OpenPgpSignatureResultBuilder signatureResultBuilder = new OpenPgpSignatureResultBuilder(); OpenPgpSignatureResultBuilder signatureResultBuilder = new OpenPgpSignatureResultBuilder();
int signatureIndex = -1; int signatureIndex = -1;
CachedPublicKeyRing signingRing = null;
CachedPublicKey signingKey = null; CachedPublicKey signingKey = null;
if (dataChunk instanceof PGPCompressedData) { if (dataChunk instanceof PGPCompressedData) {
@ -390,7 +391,7 @@ public class PgpDecryptVerify {
for (int i = 0; i < sigList.size(); ++i) { for (int i = 0; i < sigList.size(); ++i) {
try { try {
long sigKeyId = sigList.get(i).getKeyID(); long sigKeyId = sigList.get(i).getKeyID();
CachedPublicKeyRing signingRing = mProviderHelper.getCachedPublicKeyRing( signingRing = mProviderHelper.getCachedPublicKeyRing(
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri( KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(
Long.toString(sigKeyId) Long.toString(sigKeyId)
) )
@ -409,9 +410,9 @@ public class PgpDecryptVerify {
signatureResultBuilder.signatureAvailable(true); signatureResultBuilder.signatureAvailable(true);
signatureResultBuilder.knownKey(true); signatureResultBuilder.knownKey(true);
signatureResultBuilder.keyId(signingKey.getKeyRing().getMasterKeyId()); signatureResultBuilder.keyId(signingRing.getMasterKeyId());
signatureResultBuilder.userId(signingKey.getKeyRing().getPrimaryUserId()); signatureResultBuilder.userId(signingRing.getPrimaryUserId());
signatureResultBuilder.signatureKeyCertified(signingKey.getKeyRing().getVerified() > 0); signatureResultBuilder.signatureKeyCertified(signingRing.getVerified() > 0);
signingKey.initSignature(signature); signingKey.initSignature(signature);
} else { } else {
@ -488,7 +489,7 @@ public class PgpDecryptVerify {
// Verify signature and check binding signatures // Verify signature and check binding signatures
boolean validSignature = signature.verify(messageSignature); boolean validSignature = signature.verify(messageSignature);
boolean validKeyBinding = signingKey.getKeyRing().verifySubkeyBinding(signingKey); boolean validKeyBinding = signingRing.verifySubkeyBinding(signingKey);
signatureResultBuilder.validSignature(validSignature); signatureResultBuilder.validSignature(validSignature);
signatureResultBuilder.validKeyBinding(validKeyBinding); signatureResultBuilder.validKeyBinding(validKeyBinding);
@ -564,6 +565,7 @@ public class PgpDecryptVerify {
throw new InvalidDataException(); throw new InvalidDataException();
} }
CachedPublicKeyRing signingRing = null;
CachedPublicKey signingKey = null; CachedPublicKey signingKey = null;
int signatureIndex = -1; int signatureIndex = -1;
@ -572,7 +574,7 @@ public class PgpDecryptVerify {
for (int i = 0; i < sigList.size(); ++i) { for (int i = 0; i < sigList.size(); ++i) {
try { try {
long sigKeyId = sigList.get(i).getKeyID(); long sigKeyId = sigList.get(i).getKeyID();
CachedPublicKeyRing signingRing = mProviderHelper.getCachedPublicKeyRing( signingRing = mProviderHelper.getCachedPublicKeyRing(
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri( KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(
Long.toString(sigKeyId) Long.toString(sigKeyId)
) )
@ -593,9 +595,9 @@ public class PgpDecryptVerify {
signatureResultBuilder.signatureAvailable(true); signatureResultBuilder.signatureAvailable(true);
signatureResultBuilder.knownKey(true); signatureResultBuilder.knownKey(true);
signatureResultBuilder.keyId(signingKey.getKeyRing().getMasterKeyId()); signatureResultBuilder.keyId(signingRing.getMasterKeyId());
signatureResultBuilder.userId(signingKey.getKeyRing().getPrimaryUserId()); signatureResultBuilder.userId(signingRing.getPrimaryUserId());
signatureResultBuilder.signatureKeyCertified(signingKey.getKeyRing().getVerified() > 0); signatureResultBuilder.signatureKeyCertified(signingRing.getVerified() > 0);
signingKey.initSignature(signature); signingKey.initSignature(signature);
} else { } else {
@ -629,7 +631,7 @@ public class PgpDecryptVerify {
// Verify signature and check binding signatures // Verify signature and check binding signatures
boolean validSignature = signature.verify(); boolean validSignature = signature.verify();
boolean validKeyBinding = signingKey.getKeyRing().verifySubkeyBinding(signingKey); boolean validKeyBinding = signingRing.verifySubkeyBinding(signingKey);
signatureResultBuilder.validSignature(validSignature); signatureResultBuilder.validSignature(validSignature);
signatureResultBuilder.validKeyBinding(validKeyBinding); signatureResultBuilder.validKeyBinding(validKeyBinding);