/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test %I% %E%
* @bug 6824440 6858484
* @summary Check that Apache XMLSec APIs will not accept HMAC truncation
* lengths less than minimum bound
* @compile -XDignore.symbol.file TruncateHMAC.java
* @run main TruncateHMAC
*/
public class TruncateHMAC {
private static boolean atLeastOneFailed = false;
dbf.setNamespaceAware(true);
dbf.setValidating(false);
// this one should pass
validate("signature-enveloping-hmac-sha1.xml", true);
if (atLeastOneFailed) {
throw new Exception
("At least one signature did not validate as expected");
}
}
throw new Exception("Couldn't find signature Element");
}
try {
if (!pass) {
atLeastOneFailed = true;
} else {
}
} catch (XMLSignatureException xse) {
if (!pass) {
} else {
atLeastOneFailed = true;
}
}
}
try {
atLeastOneFailed = true;
} catch (XMLSignatureException xse) {
}
}
return new SecretKey() {
public byte[] getEncoded() { return secret; }
};
}
}