1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-23 04:42:06 +01:00

Add toString() methods for SignatureVerification & failure

This commit is contained in:
Paul Schaub 2021-10-27 17:11:40 +02:00
parent e8bf2ea9e7
commit bc2afea7ed
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -7,6 +7,7 @@ package org.pgpainless.decryption_verification;
import javax.annotation.Nullable;
import org.bouncycastle.openpgp.PGPSignature;
import org.bouncycastle.util.encoders.Hex;
import org.pgpainless.exception.SignatureValidationException;
import org.pgpainless.key.SubkeyIdentifier;
@ -52,6 +53,12 @@ public class SignatureVerification {
return signingKey;
}
@Override
public String toString() {
return "Signature: " + (signature != null ? Hex.toHexString(signature.getDigestPrefix()) : "null")
+ "; Key: " + (signingKey != null ? signingKey.toString() : "null") + ";";
}
/**
* Tuple object of a {@link SignatureVerification} and the corresponding {@link SignatureValidationException}
* that caused the verification to fail.
@ -90,5 +97,10 @@ public class SignatureVerification {
public SignatureValidationException getValidationException() {
return validationException;
}
@Override
public String toString() {
return signatureVerification.toString() + " Failure: " + getValidationException().getMessage();
}
}
}