Frames | No Frames |
1: /* TMMHParameterSpec.java -- 2: Copyright (C) 2002, 2006 Free Software Foundation, Inc. 3: 4: This file is a part of GNU Classpath. 5: 6: GNU Classpath is free software; you can redistribute it and/or modify 7: it under the terms of the GNU General Public License as published by 8: the Free Software Foundation; either version 2 of the License, or (at 9: your option) any later version. 10: 11: GNU Classpath is distributed in the hope that it will be useful, but 12: WITHOUT ANY WARRANTY; without even the implied warranty of 13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14: General Public License for more details. 15: 16: You should have received a copy of the GNU General Public License 17: along with GNU Classpath; if not, write to the Free Software 18: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 19: USA 20: 21: Linking this library statically or dynamically with other modules is 22: making a combined work based on this library. Thus, the terms and 23: conditions of the GNU General Public License cover the whole 24: combination. 25: 26: As a special exception, the copyright holders of this library give you 27: permission to link this library with independent modules to produce an 28: executable, regardless of the license terms of these independent 29: modules, and to copy and distribute the resulting executable under 30: terms of your choice, provided that you also meet, for each linked 31: independent module, the terms and conditions of the license of that 32: module. An independent module is a module which is not derived from 33: or based on this library. If you modify this library, you may extend 34: this exception to your version of the library, but you are not 35: obligated to do so. If you do not wish to do so, delete this 36: exception statement from your version. */ 37: 38: 39: package gnu.javax.crypto.jce.spec; 40: 41: import gnu.java.security.prng.IRandom; 42: 43: import java.security.spec.AlgorithmParameterSpec; 44: 45: /** 46: * This class represents the algorithm parameters for the Truncated 47: * Multi-Modular Hash function for use with JCE-derived instances of 48: * {@link gnu.javax.crypto.mac.TMMH16}. 49: * <p> 50: * This class is little more than a container for the key stream, tag length, 51: * and prefix parameters for the TMMH algorithm. 52: */ 53: public class TMMHParameterSpec 54: implements AlgorithmParameterSpec 55: { 56: /** The keystream. */ 57: protected IRandom keystream; 58: /** The tag length. */ 59: protected Integer tagLength; 60: /** The prefix. */ 61: protected byte[] prefix; 62: 63: /** 64: * Create a new parameter specification. 65: * 66: * @param keystream The (PRNG) key stream. 67: * @param tagLength The tag length. 68: * @param prefix The prefix. 69: */ 70: public TMMHParameterSpec(IRandom keystream, Integer tagLength, byte[] prefix) 71: { 72: this.keystream = keystream; 73: this.tagLength = tagLength; 74: this.prefix = prefix; 75: } 76: 77: /** 78: * Create a new parameter specification with no prefix. 79: * 80: * @param keystream The (PRNG) key stream. 81: * @param tagLength The tag length. 82: */ 83: public TMMHParameterSpec(IRandom keystream, Integer tagLength) 84: { 85: this(keystream, tagLength, null); 86: } 87: 88: /** 89: * Return the key stream this specification was initialized with. 90: * 91: * @return The key stream. 92: */ 93: public IRandom getKeystream() 94: { 95: return keystream; 96: } 97: 98: /** 99: * Return the tag length this specification was initialized with. 100: * 101: * @return The tag length. 102: */ 103: public Integer getTagLength() 104: { 105: return tagLength; 106: } 107: 108: /** 109: * Return the prefix, or <code>null</code> if no prefix was specified. 110: * 111: * @return The prefix. 112: */ 113: public byte[] getPrefix() 114: { 115: return prefix; 116: } 117: }