Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public int getAeadAlgorithm()
public static MessageEncryptionMechanism unencrypted()
{
int none = 0;
return new MessageEncryptionMechanism(EncryptedDataPacketType.SEIPDv1,
return new MessageEncryptionMechanism(null,
SymmetricKeyAlgorithmTags.NULL, none);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ protected void performTestWith(OpenPGPApi api)

verifyMessageByRevokedKey(api);
incompleteMessageProcessing(api);
processUnencryptedMessage(api);
}

private void roundtripUnarmoredPlaintextMessage(OpenPGPApi api)
Expand Down Expand Up @@ -712,6 +713,26 @@ private void incompleteMessageProcessing(OpenPGPApi api)
isFalse(sig.isValid());
}

private void processUnencryptedMessage(OpenPGPApi api)
throws PGPException, IOException
{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
OpenPGPMessageOutputStream mOut = api.signAndOrEncryptMessage()
.open(bOut);
mOut.write(PLAINTEXT);
mOut.close();

ByteArrayInputStream bIn = new ByteArrayInputStream(bOut.toByteArray());
OpenPGPMessageInputStream mIn = api.decryptAndOrVerifyMessage().process(bIn);
byte[] plain = Streams.readAll(mIn);
mIn.close();
isEncodingEqual(PLAINTEXT, plain);

OpenPGPMessageInputStream.Result result = mIn.getResult();
isTrue(result.getEncryptionMethod().equals(MessageEncryptionMechanism.unencrypted()));
isNull(result.getEncryptionMethod().getMode());
}

private void testVerificationOfSEIPD1MessageWithTamperedCiphertext(OpenPGPApi api)
throws IOException, PGPException
{
Expand Down
Loading