1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-10 14:35:59 +01:00

Rename PainlessResult -> OpenPpgMetadata

This commit is contained in:
Paul Schaub 2018-07-23 16:23:23 +02:00
parent 8537f9a165
commit 9017fcaba0
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
6 changed files with 23 additions and 23 deletions

View file

@ -21,10 +21,10 @@ import java.io.InputStream;
public class DecryptionStream extends InputStream {
private final InputStream inputStream;
private final PainlessResult.Builder resultBuilder;
private final OpenPgpMetadata.Builder resultBuilder;
private boolean isClosed = false;
DecryptionStream(InputStream wrapped, PainlessResult.Builder resultBuilder) {
DecryptionStream(InputStream wrapped, OpenPgpMetadata.Builder resultBuilder) {
if (wrapped == null) {
throw new NullPointerException("Wrapped InputStream MUST NOT be null!");
@ -45,7 +45,7 @@ public class DecryptionStream extends InputStream {
this.isClosed = true;
}
public PainlessResult getResult() {
public OpenPgpMetadata getResult() {
if (!isClosed) {
throw new IllegalStateException("DecryptionStream MUST be closed before the result can be accessed.");
}

View file

@ -61,7 +61,7 @@ public final class DecryptionStreamFactory {
private final Set<PGPPublicKeyRing> verificationKeys = new HashSet<>();
private final MissingPublicKeyCallback missingPublicKeyCallback;
private final PainlessResult.Builder resultBuilder = PainlessResult.getBuilder();
private final OpenPgpMetadata.Builder resultBuilder = OpenPgpMetadata.getBuilder();
private final PGPContentVerifierBuilderProvider verifierBuilderProvider = new BcPGPContentVerifierBuilderProvider();
private final KeyFingerPrintCalculator fingerCalc = new BcKeyFingerprintCalculator();
private final Map<OpenPgpV4Fingerprint, PGPOnePassSignature> verifiableOnePassSignatures = new HashMap<>();

View file

@ -25,7 +25,7 @@ import org.pgpainless.algorithm.CompressionAlgorithm;
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.key.OpenPgpV4Fingerprint;
public class PainlessResult {
public class OpenPgpMetadata {
private final Set<Long> recipientKeyIds;
private final OpenPgpV4Fingerprint decryptionFingerprint;
@ -36,7 +36,7 @@ public class PainlessResult {
private final CompressionAlgorithm compressionAlgorithm;
private final boolean integrityProtected;
public PainlessResult(Set<Long> recipientKeyIds,
public OpenPgpMetadata(Set<Long> recipientKeyIds,
OpenPgpV4Fingerprint decryptionFingerprint,
SymmetricKeyAlgorithm symmetricKeyAlgorithm,
CompressionAlgorithm algorithm,
@ -152,8 +152,8 @@ public class PainlessResult {
return this;
}
public PainlessResult build() {
return new PainlessResult(recipientFingerprints, decryptionFingerprint, symmetricKeyAlgorithm, compressionAlgorithm, integrityProtected, unverifiedSignatureKeyIds, verifiedSignatureFingerprints);
public OpenPgpMetadata build() {
return new OpenPgpMetadata(recipientFingerprints, decryptionFingerprint, symmetricKeyAlgorithm, compressionAlgorithm, integrityProtected, unverifiedSignatureKeyIds, verifiedSignatureFingerprints);
}
}
}

View file

@ -37,14 +37,14 @@ public class SignatureVerifyingInputStream extends FilterInputStream {
private final PGPObjectFactory objectFactory;
private final Map<OpenPgpV4Fingerprint, PGPOnePassSignature> onePassSignatures;
private final PainlessResult.Builder resultBuilder;
private final OpenPgpMetadata.Builder resultBuilder;
private boolean validated = false;
protected SignatureVerifyingInputStream(InputStream inputStream,
PGPObjectFactory objectFactory,
Map<OpenPgpV4Fingerprint, PGPOnePassSignature> onePassSignatures,
PainlessResult.Builder resultBuilder) {
OpenPgpMetadata.Builder resultBuilder) {
super(inputStream);
this.objectFactory = objectFactory;
this.resultBuilder = resultBuilder;

View file

@ -43,7 +43,7 @@ import org.bouncycastle.openpgp.operator.bc.BcPublicKeyKeyEncryptionMethodGenera
import org.pgpainless.algorithm.CompressionAlgorithm;
import org.pgpainless.algorithm.HashAlgorithm;
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.decryption_verification.PainlessResult;
import org.pgpainless.decryption_verification.OpenPgpMetadata;
/**
* This class is based upon Jens Neuhalfen's Bouncy-GPG PGPEncryptingStream.
@ -56,7 +56,7 @@ public final class EncryptionStream extends OutputStream {
private static final int BUFFER_SIZE = 1 << 8;
private final PainlessResult result;
private final OpenPgpMetadata result;
private List<PGPSignatureGenerator> signatureGenerators = new ArrayList<>();
private boolean closed = false;
@ -157,7 +157,7 @@ public final class EncryptionStream extends OutputStream {
}
this.result = new PainlessResult(recipientKeyIds,
this.result = new OpenPgpMetadata(recipientKeyIds,
null, symmetricKeyAlgorithm,
compressionAlgorithm, true,
signingKeyIds, Collections.emptySet());
@ -259,7 +259,7 @@ public final class EncryptionStream extends OutputStream {
}
}
public PainlessResult getResult() {
public OpenPgpMetadata getResult() {
return result;
}
}

View file

@ -40,7 +40,7 @@ import org.pgpainless.algorithm.KeyFlag;
import org.pgpainless.algorithm.PublicKeyAlgorithm;
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
import org.pgpainless.decryption_verification.DecryptionStream;
import org.pgpainless.decryption_verification.PainlessResult;
import org.pgpainless.decryption_verification.OpenPgpMetadata;
import org.pgpainless.encryption_signing.EncryptionStream;
import org.pgpainless.key.collection.PGPKeyRing;
import org.pgpainless.key.generation.KeySpec;
@ -142,7 +142,7 @@ public class EncryptDecryptTest extends AbstractPGPainlessTest {
.signWith(keyDecryptor, senderSec)
.noArmor();
PainlessResult encryptionResult = encryptor.getResult();
OpenPgpMetadata encryptionResult = encryptor.getResult();
assertFalse(encryptionResult.getAllSignatureKeyFingerprints().isEmpty());
for (long keyId : encryptionResult.getAllSignatureKeyFingerprints()) {
@ -180,7 +180,7 @@ public class EncryptDecryptTest extends AbstractPGPainlessTest {
decryptor.close();
assertTrue(Arrays.equals(secretMessage, decryptedSecretMessage.toByteArray()));
PainlessResult result = decryptor.getResult();
OpenPgpMetadata result = decryptor.getResult();
assertTrue(result.containsVerifiedSignatureFrom(senderPub));
assertTrue(result.isIntegrityProtected());
assertTrue(result.isSigned());