001: /*
002: * Portions Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
003: */
004:
005: /* Copyright (c) 2002 Graz University of Technology. All rights reserved.
006: *
007: * Redistribution and use in source and binary forms, with or without
008: * modification, are permitted provided that the following conditions are met:
009: *
010: * 1. Redistributions of source code must retain the above copyright notice,
011: * this list of conditions and the following disclaimer.
012: *
013: * 2. Redistributions in binary form must reproduce the above copyright notice,
014: * this list of conditions and the following disclaimer in the documentation
015: * and/or other materials provided with the distribution.
016: *
017: * 3. The end-user documentation included with the redistribution, if any, must
018: * include the following acknowledgment:
019: *
020: * "This product includes software developed by IAIK of Graz University of
021: * Technology."
022: *
023: * Alternately, this acknowledgment may appear in the software itself, if
024: * and wherever such third-party acknowledgments normally appear.
025: *
026: * 4. The names "Graz University of Technology" and "IAIK of Graz University of
027: * Technology" must not be used to endorse or promote products derived from
028: * this software without prior written permission.
029: *
030: * 5. Products derived from this software may not be called
031: * "IAIK PKCS Wrapper", nor may "IAIK" appear in their name, without prior
032: * written permission of Graz University of Technology.
033: *
034: * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
035: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
036: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
037: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE
038: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
039: * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
040: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
041: * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
042: * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
043: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
044: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
045: * POSSIBILITY OF SUCH DAMAGE.
046: */
047:
048: package sun.security.pkcs11.wrapper;
049:
050: /**
051: * class CK_SSL3_KEY_MAT_PARAMS provides the parameters to the
052: * CKM_SSL3_KEY_AND_MAC_DERIVE mechanism.<p>
053: * <B>PKCS#11 structure:</B>
054: * <PRE>
055: * typedef struct CK_SSL3_KEY_MAT_PARAMS {
056: * CK_ULONG ulMacSizeInBits;
057: * CK_ULONG ulKeySizeInBits;
058: * CK_ULONG ulIVSizeInBits;
059: * CK_BBOOL bIsExport;
060: * CK_SSL3_RANDOM_DATA RandomInfo;
061: * CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial;
062: * } CK_SSL3_KEY_MAT_PARAMS;
063: * </PRE>
064: *
065: * @author Karl Scheibelhofer <Karl.Scheibelhofer@iaik.at>
066: * @author Martin Schlaeffer <schlaeff@sbox.tugraz.at>
067: */
068: public class CK_SSL3_KEY_MAT_PARAMS {
069:
070: /**
071: * <B>PKCS#11:</B>
072: * <PRE>
073: * CK_ULONG ulMacSizeInBits;
074: * </PRE>
075: */
076: public long ulMacSizeInBits;
077:
078: /**
079: * <B>PKCS#11:</B>
080: * <PRE>
081: * CK_ULONG ulKeySizeInBits;
082: * </PRE>
083: */
084: public long ulKeySizeInBits;
085:
086: /**
087: * <B>PKCS#11:</B>
088: * <PRE>
089: * CK_ULONG ulIVSizeInBits;
090: * </PRE>
091: */
092: public long ulIVSizeInBits;
093:
094: /**
095: * <B>PKCS#11:</B>
096: * <PRE>
097: * CK_BBOOL bIsExport;
098: * </PRE>
099: */
100: public boolean bIsExport;
101:
102: /**
103: * <B>PKCS#11:</B>
104: * <PRE>
105: * CK_SSL3_RANDOM_DATA RandomInfo;
106: * </PRE>
107: */
108: public CK_SSL3_RANDOM_DATA RandomInfo;
109:
110: /**
111: * <B>PKCS#11:</B>
112: * <PRE>
113: * CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial;
114: * </PRE>
115: */
116: public CK_SSL3_KEY_MAT_OUT pReturnedKeyMaterial;
117:
118: public CK_SSL3_KEY_MAT_PARAMS(int macSize, int keySize, int ivSize,
119: boolean export, CK_SSL3_RANDOM_DATA random) {
120: ulMacSizeInBits = macSize;
121: ulKeySizeInBits = keySize;
122: ulIVSizeInBits = ivSize;
123: bIsExport = export;
124: RandomInfo = random;
125: pReturnedKeyMaterial = new CK_SSL3_KEY_MAT_OUT();
126: if (ivSize != 0) {
127: int n = ivSize >> 3;
128: pReturnedKeyMaterial.pIVClient = new byte[n];
129: pReturnedKeyMaterial.pIVServer = new byte[n];
130: }
131: }
132:
133: /**
134: * Returns the string representation of CK_SSL3_KEY_MAT_PARAMS.
135: *
136: * @return the string representation of CK_SSL3_KEY_MAT_PARAMS
137: */
138: public String toString() {
139: StringBuilder buffer = new StringBuilder();
140:
141: buffer.append(Constants.INDENT);
142: buffer.append("ulMacSizeInBits: ");
143: buffer.append(ulMacSizeInBits);
144: buffer.append(Constants.NEWLINE);
145:
146: buffer.append(Constants.INDENT);
147: buffer.append("ulKeySizeInBits: ");
148: buffer.append(ulKeySizeInBits);
149: buffer.append(Constants.NEWLINE);
150:
151: buffer.append(Constants.INDENT);
152: buffer.append("ulIVSizeInBits: ");
153: buffer.append(ulIVSizeInBits);
154: buffer.append(Constants.NEWLINE);
155:
156: buffer.append(Constants.INDENT);
157: buffer.append("bIsExport: ");
158: buffer.append(bIsExport);
159: buffer.append(Constants.NEWLINE);
160:
161: buffer.append(Constants.INDENT);
162: buffer.append("RandomInfo: ");
163: buffer.append(RandomInfo);
164: buffer.append(Constants.NEWLINE);
165:
166: buffer.append(Constants.INDENT);
167: buffer.append("pReturnedKeyMaterial: ");
168: buffer.append(pReturnedKeyMaterial);
169: //buffer.append(Constants.NEWLINE);
170:
171: return buffer.toString();
172: }
173:
174: }
|