mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-04 19:45:59 +01:00
Add toString() methods for SignatureVerification & failure
This commit is contained in:
parent
e8bf2ea9e7
commit
bc2afea7ed
1 changed files with 12 additions and 0 deletions
|
@ -7,6 +7,7 @@ package org.pgpainless.decryption_verification;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.bouncycastle.openpgp.PGPSignature;
|
import org.bouncycastle.openpgp.PGPSignature;
|
||||||
|
import org.bouncycastle.util.encoders.Hex;
|
||||||
import org.pgpainless.exception.SignatureValidationException;
|
import org.pgpainless.exception.SignatureValidationException;
|
||||||
import org.pgpainless.key.SubkeyIdentifier;
|
import org.pgpainless.key.SubkeyIdentifier;
|
||||||
|
|
||||||
|
@ -52,6 +53,12 @@ public class SignatureVerification {
|
||||||
return signingKey;
|
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}
|
* Tuple object of a {@link SignatureVerification} and the corresponding {@link SignatureValidationException}
|
||||||
* that caused the verification to fail.
|
* that caused the verification to fail.
|
||||||
|
@ -90,5 +97,10 @@ public class SignatureVerification {
|
||||||
public SignatureValidationException getValidationException() {
|
public SignatureValidationException getValidationException() {
|
||||||
return validationException;
|
return validationException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return signatureVerification.toString() + " Failure: " + getValidationException().getMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue