1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-22 19:08:00 +01:00

Bump sop-java to 4.0.5 and adopt changes (--as=clearsigned)

This commit is contained in:
Paul Schaub 2022-11-11 13:46:05 +01:00
parent 86b06ee5e3
commit 243d64fcb4
5 changed files with 10 additions and 10 deletions

View file

@ -134,7 +134,7 @@ public class RoundTripInlineSignInlineVerifyCmdTest extends CLITest {
pipeStringToStdin(MESSAGE); pipeStringToStdin(MESSAGE);
ByteArrayOutputStream ciphertextOut = pipeStdoutToStream(); ByteArrayOutputStream ciphertextOut = pipeStdoutToStream();
assertSuccess(executeCommand("inline-sign", assertSuccess(executeCommand("inline-sign",
"--as", "cleartextsigned", "--as", "clearsigned",
key.getAbsolutePath(), key.getAbsolutePath(),
"--with-key-password", password.getAbsolutePath())); "--with-key-password", password.getAbsolutePath()));
@ -154,7 +154,7 @@ public class RoundTripInlineSignInlineVerifyCmdTest extends CLITest {
pipeStringToStdin(MESSAGE); pipeStringToStdin(MESSAGE);
ByteArrayOutputStream ciphertextOut = pipeStdoutToStream(); ByteArrayOutputStream ciphertextOut = pipeStdoutToStream();
assertSuccess(executeCommand("inline-sign", assertSuccess(executeCommand("inline-sign",
"--as", "cleartextsigned", "--as", "clearsigned",
key.getAbsolutePath(), key.getAbsolutePath(),
"--with-key-password", password.getAbsolutePath())); "--with-key-password", password.getAbsolutePath()));
@ -212,7 +212,7 @@ public class RoundTripInlineSignInlineVerifyCmdTest extends CLITest {
pipeStringToStdin(MESSAGE); pipeStringToStdin(MESSAGE);
ByteArrayOutputStream ciphertextOut = pipeStdoutToStream(); ByteArrayOutputStream ciphertextOut = pipeStdoutToStream();
assertSuccess(executeCommand("inline-sign", assertSuccess(executeCommand("inline-sign",
"--as", "cleartextsigned", "--as", "clearsigned",
key.getAbsolutePath(), key.getAbsolutePath(),
"--with-key-password", password.getAbsolutePath())); "--with-key-password", password.getAbsolutePath()));

View file

@ -32,7 +32,7 @@ import sop.operation.InlineSign;
public class InlineSignImpl implements InlineSign { public class InlineSignImpl implements InlineSign {
private boolean armor = true; private boolean armor = true;
private InlineSignAs mode = InlineSignAs.Binary; private InlineSignAs mode = InlineSignAs.binary;
private final SigningOptions signingOptions = new SigningOptions(); private final SigningOptions signingOptions = new SigningOptions();
private final MatchMakingSecretKeyRingProtector protector = new MatchMakingSecretKeyRingProtector(); private final MatchMakingSecretKeyRingProtector protector = new MatchMakingSecretKeyRingProtector();
private final List<PGPSecretKeyRing> signingKeys = new ArrayList<>(); private final List<PGPSecretKeyRing> signingKeys = new ArrayList<>();
@ -74,7 +74,7 @@ public class InlineSignImpl implements InlineSign {
public Ready data(InputStream data) throws SOPGPException.KeyIsProtected, IOException, SOPGPException.ExpectedText { public Ready data(InputStream data) throws SOPGPException.KeyIsProtected, IOException, SOPGPException.ExpectedText {
for (PGPSecretKeyRing key : signingKeys) { for (PGPSecretKeyRing key : signingKeys) {
try { try {
if (mode == InlineSignAs.CleartextSigned) { if (mode == InlineSignAs.clearsigned) {
signingOptions.addDetachedSignature(protector, key); signingOptions.addDetachedSignature(protector, key);
} else { } else {
signingOptions.addInlineSignature(protector, key, modeToSigType(mode)); signingOptions.addInlineSignature(protector, key, modeToSigType(mode));
@ -87,7 +87,7 @@ public class InlineSignImpl implements InlineSign {
} }
ProducerOptions producerOptions = ProducerOptions.sign(signingOptions); ProducerOptions producerOptions = ProducerOptions.sign(signingOptions);
if (mode == InlineSignAs.CleartextSigned) { if (mode == InlineSignAs.clearsigned) {
producerOptions.setCleartextSigned(); producerOptions.setCleartextSigned();
producerOptions.setAsciiArmor(true); producerOptions.setAsciiArmor(true);
} else { } else {
@ -119,7 +119,7 @@ public class InlineSignImpl implements InlineSign {
} }
private static DocumentSignatureType modeToSigType(InlineSignAs mode) { private static DocumentSignatureType modeToSigType(InlineSignAs mode) {
return mode == InlineSignAs.Binary ? DocumentSignatureType.BINARY_DOCUMENT return mode == InlineSignAs.binary ? DocumentSignatureType.BINARY_DOCUMENT
: DocumentSignatureType.CANONICAL_TEXT_DOCUMENT; : DocumentSignatureType.CANONICAL_TEXT_DOCUMENT;
} }
} }

View file

@ -63,7 +63,7 @@ public class InlineDetachTest {
byte[] cleartextSigned = sop.inlineSign() byte[] cleartextSigned = sop.inlineSign()
.key(key) .key(key)
.withKeyPassword("sw0rdf1sh") .withKeyPassword("sw0rdf1sh")
.mode(InlineSignAs.CleartextSigned) .mode(InlineSignAs.clearsigned)
.data(data).getBytes(); .data(data).getBytes();
// actually detach the message // actually detach the message

View file

@ -36,7 +36,7 @@ public class InlineSignVerifyRoundtripTest {
byte[] inlineSigned = sop.inlineSign() byte[] inlineSigned = sop.inlineSign()
.key(key) .key(key)
.withKeyPassword("sw0rdf1sh") .withKeyPassword("sw0rdf1sh")
.mode(InlineSignAs.CleartextSigned) .mode(InlineSignAs.clearsigned)
.data(message).getBytes(); .data(message).getBytes();
ByteArrayAndResult<List<Verification>> result = sop.inlineVerify() ByteArrayAndResult<List<Verification>> result = sop.inlineVerify()

View file

@ -16,6 +16,6 @@ allprojects {
logbackVersion = '1.2.11' logbackVersion = '1.2.11'
mockitoVersion = '4.5.1' mockitoVersion = '4.5.1'
slf4jVersion = '1.7.36' slf4jVersion = '1.7.36'
sopJavaVersion = '4.0.3' sopJavaVersion = '4.0.5'
} }
} }