mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-26 22:32:07 +01:00
Rename DetachedSignature -> DetachedSignatureCheck
This commit is contained in:
parent
910bae58c0
commit
0e1d6cb5a1
3 changed files with 12 additions and 12 deletions
|
@ -63,7 +63,7 @@ import org.pgpainless.key.SubkeyIdentifier;
|
|||
import org.pgpainless.key.info.KeyRingInfo;
|
||||
import org.pgpainless.key.protection.SecretKeyRingProtector;
|
||||
import org.pgpainless.key.protection.UnlockSecretKey;
|
||||
import org.pgpainless.signature.DetachedSignature;
|
||||
import org.pgpainless.signature.DetachedSignatureCheck;
|
||||
import org.pgpainless.signature.OnePassSignatureCheck;
|
||||
import org.pgpainless.signature.SignatureUtils;
|
||||
import org.pgpainless.util.CRCingArmoredInputStreamWrapper;
|
||||
|
@ -81,7 +81,7 @@ public final class DecryptionStreamFactory {
|
|||
private final ConsumerOptions options;
|
||||
private final OpenPgpMetadata.Builder resultBuilder = OpenPgpMetadata.getBuilder();
|
||||
private final List<OnePassSignatureCheck> onePassSignatureChecks = new ArrayList<>();
|
||||
private final List<DetachedSignature> detachedSignatureChecks = new ArrayList<>();
|
||||
private final List<DetachedSignatureCheck> detachedSignatureChecks = new ArrayList<>();
|
||||
|
||||
private static final PGPContentVerifierBuilderProvider verifierBuilderProvider =
|
||||
ImplementationFactory.getInstance().getPGPContentVerifierBuilderProvider();
|
||||
|
@ -113,7 +113,7 @@ public final class DecryptionStreamFactory {
|
|||
SubkeyIdentifier signingKeyIdentifier = new SubkeyIdentifier(signingKeyRing, signingKey.getKeyID());
|
||||
try {
|
||||
signature.init(verifierBuilderProvider, signingKey);
|
||||
DetachedSignature detachedSignature = new DetachedSignature(signature, signingKeyRing, signingKeyIdentifier);
|
||||
DetachedSignatureCheck detachedSignature = new DetachedSignatureCheck(signature, signingKeyRing, signingKeyIdentifier);
|
||||
detachedSignatureChecks.add(detachedSignature);
|
||||
} catch (PGPException e) {
|
||||
LOGGER.warn("Cannot verify detached signature made by {}. Reason: {}", signingKeyIdentifier, e.getMessage(), e);
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.pgpainless.PGPainless;
|
|||
import org.pgpainless.exception.SignatureValidationException;
|
||||
import org.pgpainless.policy.Policy;
|
||||
import org.pgpainless.signature.CertificateValidator;
|
||||
import org.pgpainless.signature.DetachedSignature;
|
||||
import org.pgpainless.signature.DetachedSignatureCheck;
|
||||
import org.pgpainless.signature.OnePassSignatureCheck;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -45,14 +45,14 @@ public abstract class SignatureInputStream extends FilterInputStream {
|
|||
private static final Logger LOGGER = LoggerFactory.getLogger(VerifySignatures.class);
|
||||
|
||||
private final List<OnePassSignatureCheck> opSignatures;
|
||||
private final List<DetachedSignature> detachedSignatures;
|
||||
private final List<DetachedSignatureCheck> detachedSignatures;
|
||||
private final ConsumerOptions options;
|
||||
private final OpenPgpMetadata.Builder resultBuilder;
|
||||
|
||||
public VerifySignatures(
|
||||
InputStream literalDataStream,
|
||||
List<OnePassSignatureCheck> opSignatures,
|
||||
List<DetachedSignature> detachedSignatures,
|
||||
List<DetachedSignatureCheck> detachedSignatures,
|
||||
ConsumerOptions options,
|
||||
OpenPgpMetadata.Builder resultBuilder) {
|
||||
super(literalDataStream);
|
||||
|
@ -114,7 +114,7 @@ public abstract class SignatureInputStream extends FilterInputStream {
|
|||
|
||||
private void verifyDetachedSignatures() {
|
||||
Policy policy = PGPainless.getPolicy();
|
||||
for (DetachedSignature s : detachedSignatures) {
|
||||
for (DetachedSignatureCheck s : detachedSignatures) {
|
||||
try {
|
||||
signatureWasCreatedInBounds(options.getVerifyNotBefore(), options.getVerifyNotAfter()).verify(s.getSignature());
|
||||
CertificateValidator.validateCertificateAndVerifyInitializedSignature(s.getSignature(), (PGPPublicKeyRing) s.getSigningKeyRing(), policy);
|
||||
|
@ -140,13 +140,13 @@ public abstract class SignatureInputStream extends FilterInputStream {
|
|||
}
|
||||
|
||||
private void updateDetachedSignatures(byte b) {
|
||||
for (DetachedSignature detachedSignature : detachedSignatures) {
|
||||
for (DetachedSignatureCheck detachedSignature : detachedSignatures) {
|
||||
detachedSignature.getSignature().update(b);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDetachedSignatures(byte[] b, int off, int read) {
|
||||
for (DetachedSignature detachedSignature : detachedSignatures) {
|
||||
for (DetachedSignatureCheck detachedSignature : detachedSignatures) {
|
||||
detachedSignature.getSignature().update(b, off, read);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,19 +24,19 @@ import org.pgpainless.key.SubkeyIdentifier;
|
|||
* Tuple-class which bundles together a signature, the signing key that created the signature,
|
||||
* an identifier of the signing key and a record of whether or not the signature was verified.
|
||||
*/
|
||||
public class DetachedSignature {
|
||||
public class DetachedSignatureCheck {
|
||||
private final PGPSignature signature;
|
||||
private final PGPKeyRing signingKeyRing;
|
||||
private final SubkeyIdentifier signingKeyIdentifier;
|
||||
|
||||
/**
|
||||
* Create a new {@link DetachedSignature} object.
|
||||
* Create a new {@link DetachedSignatureCheck} object.
|
||||
*
|
||||
* @param signature signature
|
||||
* @param signingKeyRing signing key that created the signature
|
||||
* @param signingKeyIdentifier identifier of the used signing key
|
||||
*/
|
||||
public DetachedSignature(PGPSignature signature, PGPKeyRing signingKeyRing, SubkeyIdentifier signingKeyIdentifier) {
|
||||
public DetachedSignatureCheck(PGPSignature signature, PGPKeyRing signingKeyRing, SubkeyIdentifier signingKeyIdentifier) {
|
||||
this.signature = signature;
|
||||
this.signingKeyRing = signingKeyRing;
|
||||
this.signingKeyIdentifier = signingKeyIdentifier;
|
Loading…
Reference in a new issue