1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-30 08:12:06 +01:00

Remove unused OPS methods

This commit is contained in:
Paul Schaub 2021-10-03 14:12:26 +02:00
parent 0e1d6cb5a1
commit 76a0a6479a
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 8 additions and 32 deletions

View file

@ -239,11 +239,13 @@ public final class DecryptionStreamFactory {
return literalDataInputStream;
}
// Parse signatures from message
PGPSignatureList signatures = parseSignatures(objectFactory);
List<PGPSignature> signatureList = SignatureUtils.toList(signatures);
// Set signatures as comparison sigs in OPS checks
for (int i = 0; i < onePassSignatureChecks.size(); i++) {
onePassSignatureChecks.get(i).setSignature(signatureList.get(onePassSignatureChecks.size() - i - 1));
int reversedIndex = onePassSignatureChecks.size() - i - 1;
onePassSignatureChecks.get(i).setSignature(signatureList.get(reversedIndex));
}
return new SignatureInputStream.VerifySignatures(literalDataInputStream,

View file

@ -15,11 +15,9 @@
*/
package org.pgpainless.signature;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPOnePassSignature;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPSignature;
import org.pgpainless.decryption_verification.SignatureInputStream;
import org.pgpainless.key.OpenPgpV4Fingerprint;
import org.pgpainless.key.SubkeyIdentifier;
@ -32,7 +30,6 @@ public class OnePassSignatureCheck {
private final PGPOnePassSignature onePassSignature;
private final PGPPublicKeyRing verificationKeys;
private PGPSignature signature;
private boolean verified;
/**
* Create a new {@link OnePassSignatureCheck}.
@ -49,15 +46,6 @@ public class OnePassSignatureCheck {
this.signature = signature;
}
/**
* Return true if the signature is verified.
*
* @return verified
*/
public boolean isVerified() {
return verified;
}
/**
* Return the {@link PGPOnePassSignature} object.
*
@ -76,23 +64,6 @@ public class OnePassSignatureCheck {
return new SubkeyIdentifier(verificationKeys, onePassSignature.getKeyID());
}
/**
* Verify the one-pass signature.
* Note: This method only checks if the signature itself is correct.
* It does not check if the signing key was eligible to create the signature, or if the signature is expired etc.
* Those checks are being done by {@link SignatureInputStream.VerifySignatures}.
*
* @return true if the signature was verified, false otherwise
* @throws PGPException if signature verification fails with an exception.
*/
public boolean verify() throws PGPException {
if (signature == null) {
throw new IllegalStateException("No comparison signature provided.");
}
this.verified = getOnePassSignature().verify(signature);
return verified;
}
/**
* Return the signature.
*

View file

@ -435,7 +435,10 @@ public final class SignatureVerifier {
}
try {
if (!onePassSignature.verify()) {
if (onePassSignature.getSignature() == null) {
throw new IllegalStateException("No comparison signature provided.");
}
if (!onePassSignature.getOnePassSignature().verify(signature)) {
throw new SignatureValidationException("Bad signature of key " + Long.toHexString(signingKey.getKeyID()));
}
} catch (PGPException e) {