You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by pa...@apache.org on 2019/08/06 11:05:15 UTC
[wicket] 02/02: WICKET-6559: Decrypting with the wrong key can
succeed, but with a different result (incorrect stream)
This is an automated email from the ASF dual-hosted git repository.
papegaaij pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
commit ce6a6870ed61a7a39b917c329104e08a81052514
Author: Emond Papegaaij <em...@topicus.nl>
AuthorDate: Tue Aug 6 11:58:23 2019 +0200
WICKET-6559: Decrypting with the wrong key can succeed, but with a different result (incorrect stream)
---
.../org/apache/wicket/pageStore/CryptingPageStoreTest.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/wicket-core/src/test/java/org/apache/wicket/pageStore/CryptingPageStoreTest.java b/wicket-core/src/test/java/org/apache/wicket/pageStore/CryptingPageStoreTest.java
index 3f12483..755a000 100644
--- a/wicket-core/src/test/java/org/apache/wicket/pageStore/CryptingPageStoreTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/pageStore/CryptingPageStoreTest.java
@@ -19,6 +19,7 @@ package org.apache.wicket.pageStore;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import java.io.StreamCorruptedException;
import java.security.GeneralSecurityException;
import org.apache.wicket.MockPage;
@@ -75,14 +76,17 @@ public class CryptingPageStoreTest
try
{
- SerializedPage serializedGot = (SerializedPage)store.getPage(context, p);
+ SerializedPage serializedGot = (SerializedPage) store.getPage(context, p);
- MockPage got = (MockPage)serializer.deserialize(serializedGot.getData());
+ MockPage got = (MockPage) serializer.deserialize(serializedGot.getData());
assertEquals(p, got.getPageId());
}
- catch (WicketRuntimeException ex)
+ catch (RuntimeException ex)
{
- assertTrue(ex.getCause() instanceof GeneralSecurityException, "unable to decrypt with new key");
+ assertTrue(
+ ex.getCause() instanceof GeneralSecurityException
+ || ex.getCause() instanceof StreamCorruptedException,
+ "unable to decrypt with new key");
}
}
}