1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-15 13:19:38 +02:00

fix formating issues in Testcase.

This commit is contained in:
feri 2022-02-23 22:30:17 +01:00
parent 151b765302
commit aa14d1fe3b

View file

@ -129,13 +129,14 @@ public class Encrypt {
assertEquals(message, plaintext.toString());
}
/**
* In this example, Alice is sending a signed and encrypted message to Bob.
* She signs the message using her key and then encrypts the message to both bobs certificate and her own.
*
* Bob subsequently decrypts the message using his key and verifies that the message was signed by Alice using
* her certificate.
* She encrypts the message to both bobs certificate and her own.
* A comment header with the text "This comment was added using options." is added
* using the fluent ProducerOption syntax.
*
* Bob subsequently decrypts the message using his key.
*/
@Test
public void encryptWithCommentHeader() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
@ -170,11 +171,11 @@ public class Encrypt {
encryptor.close();
String encryptedMessage = ciphertext.toString();
// comment should be third line after "BEGIN PGP" and "Version:"
assertEquals(encryptedMessage.split("\n")[2].trim(), "Comment: "+comment);
// check that comment header was added after "BEGIN PGP" and "Version:"
assertEquals(encryptedMessage.split("\n")[2].trim(), "Comment: " + comment);
// also test, that decryption still works...
// Decrypt and verify signatures
DecryptionStream decryptor = PGPainless.decryptAndOrVerify()
.onInputStream(new ByteArrayInputStream(encryptedMessage.getBytes(StandardCharsets.UTF_8)))
@ -194,5 +195,5 @@ public class Encrypt {
assertEquals(message, plaintext.toString());
}
}