mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-12-10 14:21:09 +01:00
Fix checkstyle issues
This commit is contained in:
parent
5c93eb3705
commit
e25f6e1712
8 changed files with 75 additions and 41 deletions
|
|
@ -90,7 +90,7 @@ public class MessageMetadata {
|
|||
return (LiteralData) nested;
|
||||
}
|
||||
|
||||
public static abstract class Layer {
|
||||
public abstract static class Layer {
|
||||
protected final List<SignatureVerification> verifiedSignatures = new ArrayList<>();
|
||||
protected final List<SignatureVerification.Failure> failedSignatures = new ArrayList<>();
|
||||
protected Nested child;
|
||||
|
|
@ -198,11 +198,11 @@ public class MessageMetadata {
|
|||
}
|
||||
|
||||
|
||||
private static abstract class LayerIterator<O> implements Iterator<O> {
|
||||
private abstract static class LayerIterator<O> implements Iterator<O> {
|
||||
private Nested current;
|
||||
Layer last = null;
|
||||
|
||||
public LayerIterator(Message message) {
|
||||
LayerIterator(Message message) {
|
||||
super();
|
||||
this.current = message.child;
|
||||
if (matches(current)) {
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ import org.pgpainless.key.protection.UnlockSecretKey;
|
|||
import org.pgpainless.signature.SignatureUtils;
|
||||
import org.pgpainless.util.Passphrase;
|
||||
import org.pgpainless.util.Tuple;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -60,6 +62,8 @@ import java.util.List;
|
|||
|
||||
public class OpenPgpMessageInputStream extends InputStream {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(OpenPgpMessageInputStream.class);
|
||||
|
||||
protected final PDA automaton = new PDA();
|
||||
protected final ConsumerOptions options;
|
||||
protected final OpenPgpMetadata.Builder resultBuilder;
|
||||
|
|
@ -519,7 +523,7 @@ public class OpenPgpMessageInputStream extends InputStream {
|
|||
private final PGPOnePassSignatureList list;
|
||||
private final List<Boolean> encapsulating;
|
||||
|
||||
public PGPOnePassSignatureListWrapper(PGPOnePassSignatureList signatures, List<Boolean> encapsulating) {
|
||||
PGPOnePassSignatureListWrapper(PGPOnePassSignatureList signatures, List<Boolean> encapsulating) {
|
||||
this.list = signatures;
|
||||
this.encapsulating = encapsulating;
|
||||
}
|
||||
|
|
@ -529,7 +533,7 @@ public class OpenPgpMessageInputStream extends InputStream {
|
|||
}
|
||||
}
|
||||
|
||||
private static class Signatures {
|
||||
private static final class Signatures {
|
||||
final ConsumerOptions options;
|
||||
List<PGPSignature> detachedSignatures = new ArrayList<>();
|
||||
List<PGPSignature> prependedSignatures = new ArrayList<>();
|
||||
|
|
@ -551,7 +555,6 @@ public class OpenPgpMessageInputStream extends InputStream {
|
|||
}
|
||||
|
||||
void addPrependedSignatures(PGPSignatureList signatures) {
|
||||
System.out.println("Adding " + signatures.size() + " prepended Signatures");
|
||||
for (PGPSignature signature : signatures) {
|
||||
long keyId = SignatureUtils.determineIssuerKeyId(signature);
|
||||
PGPPublicKeyRing certificate = findCertificate(keyId);
|
||||
|
|
@ -561,7 +564,6 @@ public class OpenPgpMessageInputStream extends InputStream {
|
|||
}
|
||||
|
||||
void addOnePassSignatures(PGPOnePassSignatureListWrapper signatures) {
|
||||
System.out.println("Adding " + signatures.size() + " OPSs");
|
||||
for (PGPOnePassSignature ops : signatures.list) {
|
||||
PGPPublicKeyRing certificate = findCertificate(ops.getKeyID());
|
||||
initialize(ops, certificate);
|
||||
|
|
@ -570,7 +572,6 @@ public class OpenPgpMessageInputStream extends InputStream {
|
|||
}
|
||||
|
||||
void addOnePassCorrespondingSignatures(PGPSignatureList signatures) {
|
||||
System.out.println("Adding " + signatures.size() + " Corresponding Signatures");
|
||||
for (PGPSignature signature : signatures) {
|
||||
correspondingSignatures.add(signature);
|
||||
}
|
||||
|
|
@ -631,9 +632,9 @@ public class OpenPgpMessageInputStream extends InputStream {
|
|||
try {
|
||||
verified = detached.verify();
|
||||
} catch (PGPException e) {
|
||||
System.out.println(e.getMessage());
|
||||
LOGGER.debug("Cannot verify detached signature.", e);
|
||||
}
|
||||
System.out.println("Detached Signature by " + Long.toHexString(detached.getKeyID()) + " is " + (verified ? "verified" : "unverified"));
|
||||
LOGGER.debug("Detached Signature by " + Long.toHexString(detached.getKeyID()) + " is " + (verified ? "verified" : "unverified"));
|
||||
}
|
||||
|
||||
for (PGPSignature prepended : prependedSignatures) {
|
||||
|
|
@ -641,9 +642,9 @@ public class OpenPgpMessageInputStream extends InputStream {
|
|||
try {
|
||||
verified = prepended.verify();
|
||||
} catch (PGPException e) {
|
||||
System.out.println(e.getMessage());
|
||||
LOGGER.debug("Cannot verify prepended signature.", e);
|
||||
}
|
||||
System.out.println("Prepended Signature by " + Long.toHexString(prepended.getKeyID()) + " is " + (verified ? "verified" : "unverified"));
|
||||
LOGGER.debug("Prepended Signature by " + Long.toHexString(prepended.getKeyID()) + " is " + (verified ? "verified" : "unverified"));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -654,9 +655,9 @@ public class OpenPgpMessageInputStream extends InputStream {
|
|||
try {
|
||||
verified = ops.verify(signature);
|
||||
} catch (PGPException e) {
|
||||
System.out.println(e.getMessage());
|
||||
LOGGER.debug("Cannot verify OPS signature.", e);
|
||||
}
|
||||
System.out.println("One-Pass-Signature by " + Long.toHexString(ops.getKeyID()) + " is " + (verified ? "verified" : "unverified"));
|
||||
LOGGER.debug("One-Pass-Signature by " + Long.toHexString(ops.getKeyID()) + " is " + (verified ? "verified" : "unverified"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package org.pgpainless.decryption_verification.automaton;
|
||||
|
||||
import org.bouncycastle.openpgp.PGPCompressedData;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package org.pgpainless.decryption_verification.automaton;
|
||||
|
||||
import org.pgpainless.exception.MalformedOpenPgpMessageException;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package org.pgpainless.decryption_verification.automaton;
|
||||
|
||||
public enum StackAlphabet {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
/**
|
||||
* Pushdown Automaton to verify validity of packet sequences according to the OpenPGP Message format.
|
||||
*/
|
||||
package org.pgpainless.decryption_verification.automaton;
|
||||
Loading…
Add table
Add a link
Reference in a new issue