Document doc = dbf.newDocumentBuilder().newDocument();
XMLSignature sig = new XMLSignature
(doc, null, XMLSignature.ALGO_ID_MAC_HMAC_SHA1, 40,
Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
try {
sig.sign(getSecretKey("secret".getBytes("ASCII")));
fail("Expected HMACOutputLength Exception");
} catch (XMLSignatureException xse) {
System.out.println(xse.getMessage());
if (xse.getMsgID().equals("algorithms.HMACOutputLengthMin")) {
// pass