CK_SESSION_INFO.java revision 0
2976N/A/*
2976N/A * reserved comment block
2976N/A * DO NOT REMOVE OR ALTER!
2976N/A */
2976N/A/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
2976N/A *
2976N/A * Redistribution and use in source and binary forms, with or without
2976N/A * modification, are permitted provided that the following conditions are met:
2976N/A *
2976N/A * 1. Redistributions of source code must retain the above copyright notice,
2976N/A * this list of conditions and the following disclaimer.
2976N/A *
2976N/A * 2. Redistributions in binary form must reproduce the above copyright notice,
2976N/A * this list of conditions and the following disclaimer in the documentation
2976N/A * and/or other materials provided with the distribution.
2976N/A *
2976N/A * 3. The end-user documentation included with the redistribution, if any, must
2976N/A * include the following acknowledgment:
2976N/A *
2976N/A * "This product includes software developed by IAIK of Graz University of
2976N/A * Technology."
2976N/A *
2976N/A * Alternately, this acknowledgment may appear in the software itself, if
2976N/A * and wherever such third-party acknowledgments normally appear.
2976N/A *
3233N/A * 4. The names "Graz University of Technology" and "IAIK of Graz University of
2976N/A * Technology" must not be used to endorse or promote products derived from
2976N/A * this software without prior written permission.
2976N/A *
2976N/A * 5. Products derived from this software may not be called
2976N/A * "IAIK PKCS Wrapper", nor may "IAIK" appear in their name, without prior
2976N/A * written permission of Graz University of Technology.
3824N/A *
3824N/A * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
3824N/A * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3824N/A * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
3824N/A * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE
3824N/A * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
3824N/A * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
3842N/A * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
3842N/A * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
3824N/A * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
3842N/A * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2976N/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2976N/A * POSSIBILITY OF SUCH DAMAGE.
2976N/A */
2976N/A
2976N/Apackage sun.security.pkcs11.wrapper;
2976N/A
3262N/A
3262N/A
3262N/A/**
3262N/A * class CK_SESSION_INFO provides information about a session.<p>
3262N/A * <B>PKCS#11 structure:</B>
2976N/A * <PRE>
3824N/A * typedef struct CK_SESSION_INFO {&nbsp;&nbsp;
2976N/A * CK_SLOT_ID slotID;&nbsp;&nbsp;
2976N/A * CK_STATE state;&nbsp;&nbsp;
2976N/A * CK_FLAGS flags;&nbsp;&nbsp;
2976N/A * CK_ULONG ulDeviceError;&nbsp;&nbsp;
2976N/A * } CK_SESSION_INFO;
3824N/A * </PRE>
2976N/A *
2976N/A * @author Karl Scheibelhofer <Karl.Scheibelhofer@iaik.at>
2976N/A * @author Martin Schlaeffer <schlaeff@sbox.tugraz.at>
2976N/A */
2976N/Apublic class CK_SESSION_INFO {
2976N/A
2976N/A /**
2976N/A * <B>PKCS#11:</B>
2976N/A * <PRE>
2976N/A * CK_SLOT_ID slotID;
2976N/A * </PRE>
3824N/A */
2976N/A public long slotID;
2976N/A
2976N/A /**
2976N/A * <B>PKCS#11:</B>
2976N/A * <PRE>
2976N/A * CK_STATE state;
3262N/A * </PRE>
3262N/A */
3262N/A public long state;
3262N/A
3262N/A /**
3262N/A * <B>PKCS#11:</B>
3262N/A * <PRE>
2976N/A * CK_FLAGS flags;
3824N/A * </PRE>
2976N/A */
2976N/A public long flags; /* see below */
2976N/A
3824N/A /* ulDeviceError was changed from CK_USHORT to CK_ULONG for
2976N/A * v2.0 */
2976N/A /**
2976N/A * <B>PKCS#11:</B>
2976N/A * <PRE>
2976N/A * CK_ULONG ulDeviceError;
* </PRE>
*/
public long ulDeviceError; /* device-dependent error code */
public CK_SESSION_INFO(long slotID, long state,
long flags, long ulDeviceError) {
this.slotID = slotID;
this.state = state;
this.flags = flags;
this.ulDeviceError = ulDeviceError;
}
/**
* Returns the string representation of CK_SESSION_INFO.
*
* @return the string representation of CK_SESSION_INFO
*/
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append(Constants.INDENT);
buffer.append("slotID: ");
buffer.append(String.valueOf(slotID));
buffer.append(Constants.NEWLINE);
buffer.append(Constants.INDENT);
buffer.append("state: ");
buffer.append(Functions.sessionStateToString(state));
buffer.append(Constants.NEWLINE);
buffer.append(Constants.INDENT);
buffer.append("flags: ");
buffer.append(Functions.sessionInfoFlagsToString(flags));
buffer.append(Constants.NEWLINE);
buffer.append(Constants.INDENT);
buffer.append("ulDeviceError: ");
buffer.append(Functions.toHexString(ulDeviceError));
//buffer.append(Constants.NEWLINE);
return buffer.toString() ;
}
}