mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-23 03:17:58 +01:00
InlineVerifyImpl: Export signature mode in Verification result
This commit is contained in:
parent
9a0b60ac7e
commit
05968533a5
2 changed files with 17 additions and 2 deletions
|
@ -409,7 +409,7 @@ public class RoundTripInlineSignInlineVerifyCmdTest extends CLITest {
|
||||||
assertEquals("Hello, World!\n", out.toString());
|
assertEquals("Hello, World!\n", out.toString());
|
||||||
String ver = readStringFromFile(verifications);
|
String ver = readStringFromFile(verifications);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"2022-11-18T14:55:33Z 7A073EDF273C902796D259528FBDD36D01831673 AEA0FD2C899D3FC077815F0026560D2AE53DB86F\n", ver);
|
"2022-11-18T14:55:33Z 7A073EDF273C902796D259528FBDD36D01831673 AEA0FD2C899D3FC077815F0026560D2AE53DB86F mode:binary\n", ver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -13,6 +13,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.bouncycastle.openpgp.PGPException;
|
import org.bouncycastle.openpgp.PGPException;
|
||||||
import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
|
import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
|
||||||
|
import org.bouncycastle.openpgp.PGPSignature;
|
||||||
import org.bouncycastle.util.io.Streams;
|
import org.bouncycastle.util.io.Streams;
|
||||||
import org.pgpainless.PGPainless;
|
import org.pgpainless.PGPainless;
|
||||||
import org.pgpainless.decryption_verification.ConsumerOptions;
|
import org.pgpainless.decryption_verification.ConsumerOptions;
|
||||||
|
@ -23,6 +24,7 @@ import org.pgpainless.exception.MalformedOpenPgpMessageException;
|
||||||
import org.pgpainless.exception.MissingDecryptionMethodException;
|
import org.pgpainless.exception.MissingDecryptionMethodException;
|
||||||
import sop.ReadyWithResult;
|
import sop.ReadyWithResult;
|
||||||
import sop.Verification;
|
import sop.Verification;
|
||||||
|
import sop.enums.SignatureMode;
|
||||||
import sop.exception.SOPGPException;
|
import sop.exception.SOPGPException;
|
||||||
import sop.operation.InlineVerify;
|
import sop.operation.InlineVerify;
|
||||||
|
|
||||||
|
@ -96,6 +98,19 @@ public class InlineVerifyImpl implements InlineVerify {
|
||||||
private Verification map(SignatureVerification sigVerification) {
|
private Verification map(SignatureVerification sigVerification) {
|
||||||
return new Verification(sigVerification.getSignature().getCreationTime(),
|
return new Verification(sigVerification.getSignature().getCreationTime(),
|
||||||
sigVerification.getSigningKey().getSubkeyFingerprint().toString(),
|
sigVerification.getSigningKey().getSubkeyFingerprint().toString(),
|
||||||
sigVerification.getSigningKey().getPrimaryKeyFingerprint().toString());
|
sigVerification.getSigningKey().getPrimaryKeyFingerprint().toString(),
|
||||||
|
getMode(sigVerification.getSignature()),
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SignatureMode getMode(PGPSignature signature) {
|
||||||
|
if (signature.getSignatureType() == PGPSignature.BINARY_DOCUMENT) {
|
||||||
|
return SignatureMode.binary;
|
||||||
|
}
|
||||||
|
if (signature.getSignatureType() == PGPSignature.CANONICAL_TEXT_DOCUMENT) {
|
||||||
|
return SignatureMode.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue