blob: d5901e3473a31d675776f1e6b6d024be7b0f803f [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25/*
26 * $Id: HMACParameterSpec.java,v 1.4 2005/05/10 16:40:17 mullan Exp $
27 */
28package javax.xml.crypto.dsig.spec;
29
30import javax.xml.crypto.dsig.SignatureMethod;
31
32/**
33 * Parameters for the <a href="http://www.w3.org/TR/xmldsig-core/#sec-MACs">
34 * XML Signature HMAC Algorithm</a>. The parameters include an optional output
35 * length which specifies the MAC truncation length in bits. The resulting
36 * HMAC will be truncated to the specified number of bits. If the parameter is
37 * not specified, then this implies that all the bits of the hash are to be
38 * output. The XML Schema Definition of the <code>HMACOutputLength</code>
39 * element is defined as:
40 * <pre><code>
41 * &lt;element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/&gt;
42 * &lt;simpleType name="HMACOutputLengthType"&gt;
43 * &lt;restriction base="integer"/&gt;
44 * &lt;/simpleType&gt;
45 * </code></pre>
46 *
47 * @author Sean Mullan
48 * @author JSR 105 Expert Group
49 * @since 1.6
50 * @see SignatureMethod
51 * @see <a href="http://www.ietf.org/rfc/rfc2104.txt">RFC 2104</a>
52 */
53public final class HMACParameterSpec implements SignatureMethodParameterSpec {
54
55 private int outputLength;
56
57 /**
58 * Creates an <code>HMACParameterSpec</code> with the specified truncation
59 * length.
60 *
61 * @param outputLength the truncation length in number of bits
62 */
63 public HMACParameterSpec(int outputLength) {
64 this.outputLength = outputLength;
65 }
66
67 /**
68 * Returns the truncation length.
69 *
70 * @return the truncation length in number of bits
71 */
72 public int getOutputLength() {
73 return outputLength;
74 }
75}