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_PBE_PARAMS provides all of the necessary information required byte
  54  * the CKM_PBE mechanisms and the CKM_PBA_SHA1_WITH_SHA1_HMAC mechanism.<p>
  55  * <B>PKCS#11 structure:</B>
  56  * <PRE>
  57  * typedef struct CK_PBE_PARAMS {
  58  *   CK_CHAR_PTR pInitVector;
  59  *   CK_CHAR_PTR pPassword;
  60  *   CK_ULONG ulPasswordLen;
  61  *   CK_CHAR_PTR pSalt;
  62  *   CK_ULONG ulSaltLen;
  63  *   CK_ULONG ulIteration;
  64  * } CK_PBE_PARAMS;
  65  * </PRE>
  66  *
  67  * @author Karl Scheibelhofer <Karl.Scheibelhofer@iaik.at>
  68  * @author Martin Schlaeffer <schlaeff@sbox.tugraz.at>
  69  */
  70 public class CK_PBE_PARAMS {
  71 
  72     /**
  73      * <B>PKCS#11:</B>
  74      * <PRE>
  75      *   CK_CHAR_PTR pInitVector;
  76      * </PRE>
  77      */
  78     public char[] pInitVector;
  79 
  80     /**
  81      * <B>PKCS#11:</B>
  82      * <PRE>
  83      *   CK_CHAR_PTR pPassword;
  84      *   CK_ULONG ulPasswordLen;
  85      * </PRE>
  86      */
  87     public char[] pPassword;
  88 
  89     /**
  90      * <B>PKCS#11:</B>
  91      * <PRE>
  92      *   CK_CHAR_PTR pSalt
  93      *   CK_ULONG ulSaltLen;
  94      * </PRE>
  95      */
  96     public char[] pSalt;
  97 
  98     /**
  99      * <B>PKCS#11:</B>
 100      * <PRE>
 101      *   CK_ULONG ulIteration;
 102      * </PRE>
 103      */
 104     public long ulIteration;
 105 
 106     /**
 107      * Returns the string representation of CK_PBE_PARAMS.
 108      *
 109      * @return the string representation of CK_PBE_PARAMS
 110      */
 111     public String toString() {
 112         StringBuilder sb = new StringBuilder();
 113 
 114         sb.append(Constants.INDENT);
 115         sb.append("pInitVector: ");
 116         sb.append(pInitVector);
 117         sb.append(Constants.NEWLINE);
 118 
 119         sb.append(Constants.INDENT);
 120         sb.append("ulPasswordLen: ");
 121         sb.append(pPassword.length);
 122         sb.append(Constants.NEWLINE);
 123 
 124         sb.append(Constants.INDENT);
 125         sb.append("pPassword: ");
 126         sb.append(pPassword);
 127         sb.append(Constants.NEWLINE);
 128 
 129         sb.append(Constants.INDENT);
 130         sb.append("ulSaltLen: ");
 131         sb.append(pSalt.length);
 132         sb.append(Constants.NEWLINE);
 133 
 134         sb.append(Constants.INDENT);
 135         sb.append("pSalt: ");
 136         sb.append(pSalt);
 137         sb.append(Constants.NEWLINE);
 138 
 139         sb.append(Constants.INDENT);
 140         sb.append("ulIteration: ");
 141         sb.append(ulIteration);
 142         //buffer.append(Constants.NEWLINE);
 143 
 144         return sb.toString();
 145     }
 146 
 147 }