mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-30 00:02:06 +01:00
Move getResult() method around
This commit is contained in:
parent
03d04fb324
commit
e976cc6dd2
1 changed files with 27 additions and 27 deletions
|
@ -799,6 +799,33 @@ public class OpenPgpMessageInputStream extends DecryptionStream {
|
|||
return new MessageMetadata((MessageMetadata.Message) metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpenPgpMetadata getResult() {
|
||||
MessageMetadata m = getMetadata();
|
||||
resultBuilder.setCompressionAlgorithm(m.getCompressionAlgorithm());
|
||||
resultBuilder.setModificationDate(m.getModificationDate());
|
||||
resultBuilder.setFileName(m.getFilename());
|
||||
resultBuilder.setFileEncoding(m.getFormat());
|
||||
resultBuilder.setSessionKey(m.getSessionKey());
|
||||
resultBuilder.setDecryptionKey(m.getDecryptionKey());
|
||||
|
||||
for (SignatureVerification accepted : m.getVerifiedDetachedSignatures()) {
|
||||
resultBuilder.addVerifiedDetachedSignature(accepted);
|
||||
}
|
||||
for (SignatureVerification.Failure rejected : m.getRejectedDetachedSignatures()) {
|
||||
resultBuilder.addInvalidDetachedSignature(rejected.getSignatureVerification(), rejected.getValidationException());
|
||||
}
|
||||
|
||||
for (SignatureVerification accepted : m.getVerifiedInlineSignatures()) {
|
||||
resultBuilder.addVerifiedInbandSignature(accepted);
|
||||
}
|
||||
for (SignatureVerification.Failure rejected : m.getRejectedInlineSignatures()) {
|
||||
resultBuilder.addInvalidInbandSignature(rejected.getSignatureVerification(), rejected.getValidationException());
|
||||
}
|
||||
|
||||
return resultBuilder.build();
|
||||
}
|
||||
|
||||
private static class SortedESKs {
|
||||
|
||||
private final List<PGPPBEEncryptedData> skesks = new ArrayList<>();
|
||||
|
@ -832,33 +859,6 @@ public class OpenPgpMessageInputStream extends DecryptionStream {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpenPgpMetadata getResult() {
|
||||
MessageMetadata m = getMetadata();
|
||||
resultBuilder.setCompressionAlgorithm(m.getCompressionAlgorithm());
|
||||
resultBuilder.setModificationDate(m.getModificationDate());
|
||||
resultBuilder.setFileName(m.getFilename());
|
||||
resultBuilder.setFileEncoding(m.getFormat());
|
||||
resultBuilder.setSessionKey(m.getSessionKey());
|
||||
resultBuilder.setDecryptionKey(m.getDecryptionKey());
|
||||
|
||||
for (SignatureVerification accepted : m.getVerifiedDetachedSignatures()) {
|
||||
resultBuilder.addVerifiedDetachedSignature(accepted);
|
||||
}
|
||||
for (SignatureVerification.Failure rejected : m.getRejectedDetachedSignatures()) {
|
||||
resultBuilder.addInvalidDetachedSignature(rejected.getSignatureVerification(), rejected.getValidationException());
|
||||
}
|
||||
|
||||
for (SignatureVerification accepted : m.getVerifiedInlineSignatures()) {
|
||||
resultBuilder.addVerifiedInbandSignature(accepted);
|
||||
}
|
||||
for (SignatureVerification.Failure rejected : m.getRejectedInlineSignatures()) {
|
||||
resultBuilder.addInvalidInbandSignature(rejected.getSignatureVerification(), rejected.getValidationException());
|
||||
}
|
||||
|
||||
return resultBuilder.build();
|
||||
}
|
||||
|
||||
// In 'OPS LIT("Foo") SIG', OPS is only updated with "Foo"
|
||||
// In 'OPS[1] OPS LIT("Foo") SIG SIG', OPS[1] (nested) is updated with OPS LIT("Foo") SIG.
|
||||
// Therefore, we need to handle the innermost signature layer differently when updating with Literal data.
|
||||
|
|
Loading…
Reference in a new issue