View Javadoc
1   /*
2    * reserved comment block
3    * DO NOT REMOVE OR ALTER!
4    */
5   /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
6    *
7    * Redistribution and use in  source and binary forms, with or without
8    * modification, are permitted  provided that the following conditions are met:
9    *
10   * 1. Redistributions of  source code must retain the above copyright notice,
11   *    this list of conditions and the following disclaimer.
12   *
13   * 2. Redistributions in  binary form must reproduce the above copyright notice,
14   *    this list of conditions and the following disclaimer in the documentation
15   *    and/or other materials provided with the distribution.
16   *
17   * 3. The end-user documentation included with the redistribution, if any, must
18   *    include the following acknowledgment:
19   *
20   *    "This product includes software developed by IAIK of Graz University of
21   *     Technology."
22   *
23   *    Alternately, this acknowledgment may appear in the software itself, if
24   *    and wherever such third-party acknowledgments normally appear.
25   *
26   * 4. The names "Graz University of Technology" and "IAIK of Graz University of
27   *    Technology" must not be used to endorse or promote products derived from
28   *    this software without prior written permission.
29   *
30   * 5. Products derived from this software may not be called
31   *    "IAIK PKCS Wrapper", nor may "IAIK" appear in their name, without prior
32   *    written permission of Graz University of Technology.
33   *
34   *  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
35   *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
36   *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
37   *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE
38   *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
39   *  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
40   *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
41   *  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
42   *  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
43   *  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
44   *  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
45   *  POSSIBILITY  OF SUCH DAMAGE.
46   */
47  
48  package sun.security.pkcs11.wrapper;
49  
50  
51  
52  /**
53   * class CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the
54   * CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE mechanisms.<p>
55   * <B>PKCS#11 structure:</B>
56   * <PRE>
57   * typedef struct CK_X9_42_DH2_DERIVE_PARAMS {
58   *   CK_X9_42_DH_KDF_TYPE kdf;
59   *   CK_ULONG ulOtherInfoLen;
60   *   CK_BYTE_PTR pOtherInfo;
61   *   CK_ULONG ulPublicDataLen;
62   *   CK_BYTE_PTR pPublicData;
63   *   CK_ULONG ulPrivateDataLen;
64   *   CK_OBJECT_HANDLE hPrivateData;
65   *   CK_ULONG ulPublicDataLen2;
66   *   CK_BYTE_PTR pPublicData2;
67   * } CK_X9_42_DH2_DERIVE_PARAMS;
68   * </PRE>
69   *
70   * @author Karl Scheibelhofer <Karl.Scheibelhofer@iaik.at>
71   */
72  public class CK_X9_42_DH2_DERIVE_PARAMS {
73  
74      /**
75       * <B>PKCS#11:</B>
76       * <PRE>
77       *   CK_X9_42_DH_KDF_TYPE kdf;
78       * </PRE>
79       */
80      public long kdf;
81  
82      /**
83       * <B>PKCS#11:</B>
84       * <PRE>
85       *   CK_ULONG ulOtherInfoLen;
86       *   CK_BYTE_PTR pOtherInfo;
87       * </PRE>
88       */
89      public byte[] pOtherInfo;
90  
91      /**
92       * <B>PKCS#11:</B>
93       * <PRE>
94       *   CK_ULONG ulPublicDataLen;
95       *   CK_BYTE_PTR pPublicData;
96       * </PRE>
97       */
98      public byte[] pPublicData;
99  
100     /**
101      * <B>PKCS#11:</B>
102      * <PRE>
103      *   CK_ULONG ulPrivateDataLen;
104      * </PRE>
105      */
106     public long ulPrivateDataLen;
107 
108     /**
109      * <B>PKCS#11:</B>
110      * <PRE>
111      *   CK_OBJECT_HANDLE hPrivateData;
112      * </PRE>
113      */
114     public long hPrivateData;
115 
116     /**
117      * <B>PKCS#11:</B>
118      * <PRE>
119      *   CK_ULONG ulPublicDataLen2;
120      *   CK_BYTE_PTR pPublicData2;
121      * </PRE>
122      */
123     public byte[] pPublicData2;
124 
125     /**
126      * Returns the string representation of CK_PKCS5_PBKD2_PARAMS.
127      *
128      * @return the string representation of CK_PKCS5_PBKD2_PARAMS
129      */
130     public String toString() {
131         StringBuffer buffer = new StringBuffer();
132 
133         buffer.append(Constants.INDENT);
134         buffer.append("kdf: 0x");
135         buffer.append(Functions.toFullHexString(kdf));
136         buffer.append(Constants.NEWLINE);
137 
138         buffer.append(Constants.INDENT);
139         buffer.append("pOtherInfoLen: ");
140         buffer.append(pOtherInfo.length);
141         buffer.append(Constants.NEWLINE);
142 
143         buffer.append(Constants.INDENT);
144         buffer.append("pOtherInfo: ");
145         buffer.append(Functions.toHexString(pOtherInfo));
146         buffer.append(Constants.NEWLINE);
147 
148         buffer.append(Constants.INDENT);
149         buffer.append("pPublicDataLen: ");
150         buffer.append(pPublicData.length);
151         buffer.append(Constants.NEWLINE);
152 
153         buffer.append(Constants.INDENT);
154         buffer.append("pPublicData: ");
155         buffer.append(Functions.toHexString(pPublicData));
156         buffer.append(Constants.NEWLINE);
157 
158         buffer.append(Constants.INDENT);
159         buffer.append("ulPrivateDataLen: ");
160         buffer.append(ulPrivateDataLen);
161         buffer.append(Constants.NEWLINE);
162 
163         buffer.append(Constants.INDENT);
164         buffer.append("hPrivateData: ");
165         buffer.append(hPrivateData);
166         buffer.append(Constants.NEWLINE);
167 
168         buffer.append(Constants.INDENT);
169         buffer.append("pPublicDataLen2: ");
170         buffer.append(pPublicData2.length);
171         buffer.append(Constants.NEWLINE);
172 
173         buffer.append(Constants.INDENT);
174         buffer.append("pPublicData2: ");
175         buffer.append(Functions.toHexString(pPublicData2));
176         //buffer.append(Constants.NEWLINE);
177 
178         return buffer.toString();
179     }
180 
181 }