* FYI: Update to TestOfCipherEngineInit
@ 2006-07-14 14:17 Matthew Wringe
0 siblings, 0 replies; only message in thread
From: Matthew Wringe @ 2006-07-14 14:17 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1: Type: text/plain, Size: 415 bytes --]
Hi,
I have updated the TestOfCipherEngineInit.testInitWithIvParameterSpec to
properly fail when expected exceptions do not occur.
The following patch has already been commited.
Thanks,
Matt Wringe
Changelog:
2006-07-14 Matt Wringe <mwringe@redhat.com>
* gnu/testlet/gnu/javax/crypto/jce/TestOfCipherEngineInit.java
(testInitWithIVParameterSpec): Properly fail when expected
exception does not occur.
[-- Attachment #2: Mauve-TestOfCipherEngineInit.patch --]
[-- Type: text/x-patch, Size: 3128 bytes --]
Index: TestOfCipherEngineInit.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/gnu/javax/crypto/jce/TestOfCipherEngineInit.java,v
retrieving revision 1.5
diff -u -r1.5 TestOfCipherEngineInit.java
--- TestOfCipherEngineInit.java 11 Jul 2006 15:46:17 -0000 1.5
+++ TestOfCipherEngineInit.java 14 Jul 2006 14:07:56 -0000
@@ -285,38 +285,44 @@
IvParameterSpec IVSpec = new IvParameterSpec(new byte[blocksize -1]);
// check if short IV are properly throwing exceptions
+ String msg = "(CBC Encrypt + short IV) MUST throw InvalidAlgorithmParameterException";
try{
cipher.init(Cipher.ENCRYPT_MODE, key, IVSpec);
+ harness.fail(msg);
} catch (Exception e) {
String type = e.getClass().getName();
- harness.check(type.equals(InvalidAlgorithmParameterException.class.getName()),
- "(CBC Encrypt + short IV) MUST throw InvalidAlgorithmParameterException");
+ harness.debug(e);
+ harness.check(type.equals(InvalidAlgorithmParameterException.class.getName()),msg);
}
+
+ msg = "(CBC Decrypt + short IV) MUST throw InvalidAlgorithmParameterException";
try {
cipher.init(Cipher.DECRYPT_MODE, key, IVSpec);
+ harness.fail(msg);
} catch (Exception e) {
String type = e.getClass().getName();
- harness.check(type.equals(InvalidAlgorithmParameterException.class.getName()),
- "(CBC Decrypt + short IV) MUST throw InvalidAlgorithmParameterException");
+ harness.check(type.equals(InvalidAlgorithmParameterException.class.getName()),msg);
}
IVSpec = new IvParameterSpec(new byte[blocksize +1]);
// check if long IV are properly throwing exceptions
+ msg = "(CBC Encrypt + long IV) MUST throw InvalidAlgorithmParameterException";
try{
cipher.init(Cipher.ENCRYPT_MODE, key, IVSpec);
+ harness.fail(msg);
} catch (Exception e) {
String type = e.getClass().getName();
- harness.check(type.equals(InvalidAlgorithmParameterException.class.getName()),
- "(CBC Encrypt + long IV) MUST throw InvalidAlgorithmParameterException");
+ harness.check(type.equals(InvalidAlgorithmParameterException.class.getName()), msg);
}
-
+
+ msg = "(CBC Decrypt + long IV) MUST throw InvalidAlgorithmParameterException";
try {
cipher.init(Cipher.DECRYPT_MODE, key, IVSpec);
+ harness.fail(msg);
} catch (Exception e) {
String type = e.getClass().getName();
- harness.check(type.equals(InvalidAlgorithmParameterException.class.getName()),
- "(CBC Decrypt + long IV) MUST throw InvalidAlgorithmParameterException");
+ harness.check(type.equals(InvalidAlgorithmParameterException.class.getName()), msg);
}
byte[] iv = new byte[] { '0', '1', '1', '2', '3', '5', '8', '9'};
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-07-14 14:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-14 14:17 FYI: Update to TestOfCipherEngineInit Matthew Wringe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).