mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-25 22:02:05 +01:00
Add test for inline-sign --as=text
This commit is contained in:
parent
ce929fd055
commit
508864c4ff
1 changed files with 25 additions and 0 deletions
|
@ -172,6 +172,31 @@ public class RoundTripInlineSignInlineVerifyCmdTest extends CLITest {
|
|||
assertTrue(verificationString.contains(CERT_1_SIGNING_KEY));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createAndVerifyTextSignedMessage() throws IOException {
|
||||
File key = writeFile("key.asc", KEY_1);
|
||||
File password = writeFile("password", KEY_1_PASSWORD);
|
||||
|
||||
pipeStringToStdin(MESSAGE);
|
||||
ByteArrayOutputStream ciphertextOut = pipeStdoutToStream();
|
||||
assertSuccess(executeCommand("inline-sign",
|
||||
"--as", "text",
|
||||
key.getAbsolutePath(),
|
||||
"--with-key-password", password.getAbsolutePath()));
|
||||
|
||||
File cert = writeFile("cert.asc", CERT_1);
|
||||
File verifications = nonExistentFile("verifications");
|
||||
pipeStringToStdin(ciphertextOut.toString());
|
||||
ByteArrayOutputStream plaintextOut = pipeStdoutToStream();
|
||||
assertSuccess(executeCommand("inline-verify",
|
||||
"--verifications-out", verifications.getAbsolutePath(),
|
||||
cert.getAbsolutePath()));
|
||||
|
||||
assertEquals(MESSAGE, plaintextOut.toString());
|
||||
String verificationString = readStringFromFile(verifications);
|
||||
assertTrue(verificationString.contains(CERT_1_SIGNING_KEY));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createSignedMessageWithKeyAAndVerifyWithKeyBFails() throws IOException {
|
||||
File key = writeFile("key.asc", KEY_1);
|
||||
|
|
Loading…
Reference in a new issue