KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > crypto > dsig > spec > HMACParameterSpec


1 /*
2  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
3  */

4 /*
5  * $Id: HMACParameterSpec.java,v 1.4 2005/05/10 16:40:17 mullan Exp $
6  */

7 package javax.xml.crypto.dsig.spec;
8
9 import javax.xml.crypto.dsig.SignatureMethod;
10
11 /**
12  * Parameters for the <a HREF="http://www.w3.org/TR/xmldsig-core/#sec-MACs">
13  * XML Signature HMAC Algorithm</a>. The parameters include an optional output
14  * length which specifies the MAC truncation length in bits. The resulting
15  * HMAC will be truncated to the specified number of bits. If the parameter is
16  * not specified, then this implies that all the bits of the hash are to be
17  * output. The XML Schema Definition of the <code>HMACOutputLength</code>
18  * element is defined as:
19  * <pre><code>
20  * &lt;element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/&gt;
21  * &lt;simpleType name="HMACOutputLengthType"&gt;
22  * &lt;restriction base="integer"/&gt;
23  * &lt;/simpleType&gt;
24  * </code></pre>
25  *
26  * @author Sean Mullan
27  * @author JSR 105 Expert Group
28  * @since 1.6
29  * @see SignatureMethod
30  * @see <a HREF="http://www.ietf.org/rfc/rfc2104.txt">RFC 2104</a>
31  */

32 public final class HMACParameterSpec implements SignatureMethodParameterSpec {
33
34     private int outputLength;
35
36     /**
37      * Creates an <code>HMACParameterSpec</code> with the specified truncation
38      * length.
39      *
40      * @param outputLength the truncation length in number of bits
41      */

42     public HMACParameterSpec(int outputLength) {
43     this.outputLength = outputLength;
44     }
45
46     /**
47      * Returns the truncation length.
48      *
49      * @return the truncation length in number of bits
50      */

51     public int getOutputLength() {
52     return outputLength;
53     }
54 }
55
Popular Tags