mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-12-16 17:21:08 +01:00
fix formating issues in Testcase.
This commit is contained in:
parent
151b765302
commit
aa14d1fe3b
1 changed files with 10 additions and 9 deletions
|
|
@ -129,13 +129,14 @@ public class Encrypt {
|
||||||
|
|
||||||
assertEquals(message, plaintext.toString());
|
assertEquals(message, plaintext.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In this example, Alice is sending a signed and encrypted message to Bob.
|
* 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.
|
* 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
|
||||||
* Bob subsequently decrypts the message using his key and verifies that the message was signed by Alice using
|
* using the fluent ProducerOption syntax.
|
||||||
* her certificate.
|
*
|
||||||
|
* Bob subsequently decrypts the message using his key.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void encryptWithCommentHeader() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
public void encryptWithCommentHeader() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
|
||||||
|
|
@ -170,11 +171,11 @@ public class Encrypt {
|
||||||
encryptor.close();
|
encryptor.close();
|
||||||
String encryptedMessage = ciphertext.toString();
|
String encryptedMessage = ciphertext.toString();
|
||||||
|
|
||||||
// comment should be third line after "BEGIN PGP" and "Version:"
|
// check that comment header was added after "BEGIN PGP" and "Version:"
|
||||||
assertEquals(encryptedMessage.split("\n")[2].trim(), "Comment: "+comment);
|
assertEquals(encryptedMessage.split("\n")[2].trim(), "Comment: " + comment);
|
||||||
|
|
||||||
// also test, that decryption still works...
|
// also test, that decryption still works...
|
||||||
|
|
||||||
// Decrypt and verify signatures
|
// Decrypt and verify signatures
|
||||||
DecryptionStream decryptor = PGPainless.decryptAndOrVerify()
|
DecryptionStream decryptor = PGPainless.decryptAndOrVerify()
|
||||||
.onInputStream(new ByteArrayInputStream(encryptedMessage.getBytes(StandardCharsets.UTF_8)))
|
.onInputStream(new ByteArrayInputStream(encryptedMessage.getBytes(StandardCharsets.UTF_8)))
|
||||||
|
|
@ -194,5 +195,5 @@ public class Encrypt {
|
||||||
assertEquals(message, plaintext.toString());
|
assertEquals(message, plaintext.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue