2362N/A * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved. 0N/A/* Copyright (c) 2002 Graz University of Technology. All rights reserved. 0N/A * Redistribution and use in source and binary forms, with or without 0N/A * modification, are permitted provided that the following conditions are met: 0N/A * 1. Redistributions of source code must retain the above copyright notice, 0N/A * this list of conditions and the following disclaimer. 0N/A * 2. Redistributions in binary form must reproduce the above copyright notice, 0N/A * this list of conditions and the following disclaimer in the documentation 0N/A * and/or other materials provided with the distribution. 0N/A * 3. The end-user documentation included with the redistribution, if any, must 0N/A * include the following acknowledgment: 0N/A * "This product includes software developed by IAIK of Graz University of 0N/A * Alternately, this acknowledgment may appear in the software itself, if 0N/A * and wherever such third-party acknowledgments normally appear. 0N/A * 4. The names "Graz University of Technology" and "IAIK of Graz University of 0N/A * Technology" must not be used to endorse or promote products derived from 0N/A * this software without prior written permission. 0N/A * 5. Products derived from this software may not be called 0N/A * "IAIK PKCS Wrapper", nor may "IAIK" appear in their name, without prior 0N/A * written permission of Graz University of Technology. 0N/A * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 0N/A * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 0N/A * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 0N/A * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE 0N/A * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 0N/A * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 0N/A * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 0N/A * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 0N/A * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 0N/A * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 0N/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 0N/A * POSSIBILITY OF SUCH DAMAGE. 0N/A/* The list of notify callback handles that are currently active and waiting 0N/A * for callbacks from their sessions. 0N/A#
endif /* NO_CALLBACKS */ 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_OpenSession 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSlotID CK_SLOT_ID slotID 0N/A * @param jlong jFlags CK_FLAGS flags 0N/A * @param jobject jApplication CK_VOID_PTR pApplication 0N/A * @param jobject jNotify CK_NOTIFY Notify 0N/A * @return jlong jSessionHandle CK_SESSION_HANDLE_PTR phSession 0N/A#
endif /* NO_CALLBACKS */ 0N/A#
endif /* NO_CALLBACKS */ 936N/A#
endif /* NO_CALLBACKS */ 0N/A /* store the notifyEncapsulation to enable later cleanup */ 0N/A#
endif /* NO_CALLBACKS */ 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_CloseSession 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSessionHandle CK_SESSION_HANDLE hSession 0N/A#
endif /* NO_CALLBACKS */ 0N/A /* there was a notify object used with this session, now dump the 0N/A * encapsulation object 0N/A#
endif /* NO_CALLBACKS */ 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_CloseAllSessions 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSlotID CK_SLOT_ID slotID 0N/A#
endif /* NO_CALLBACKS */ 0N/A /* Remove all notify callback helper objects. */ 0N/A /* there was a notify object used with this session, now dump the 0N/A * encapsulation object 0N/A#
endif /* NO_CALLBACKS */ 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_GetSessionInfo 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSessionHandle CK_SESSION_HANDLE hSession 0N/A * @return jobject jSessionInfo CK_SESSION_INFO_PTR pInfo 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_GetOperationState 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSessionHandle CK_SESSION_HANDLE hSession 0N/A * @return jbyteArray jState CK_BYTE_PTR pOperationState 0N/A * CK_ULONG_PTR pulOperationStateLen 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_SetOperationState 0N/A * Signature: (J[BJJ)V 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSessionHandle CK_SESSION_HANDLE hSession 0N/A * @param jbyteArray jOperationState CK_BYTE_PTR pOperationState 0N/A * CK_ULONG ulOperationStateLen 0N/A * @param jlong jEncryptionKeyHandle CK_OBJECT_HANDLE hEncryptionKey 0N/A * @param jlong jAuthenticationKeyHandle CK_OBJECT_HANDLE hAuthenticationKey 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Signature: (JJ[C)V 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSessionHandle CK_SESSION_HANDLE hSession 0N/A * @param jlong jUserType CK_USER_TYPE userType 0N/A * @param jcharArray jPin CK_CHAR_PTR pPin 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSessionHandle CK_SESSION_HANDLE hSession 0N/A/* ************************************************************************** */ 0N/A/* Functions for keeping track of notify callbacks */ 0N/A/* ************************************************************************** */ 0N/A * Add the given notify encapsulation object to the list of active notify 0N/A * If notifyEncapsulation is NULL, this function does nothing. 0N/A /* this is the first entry */ 0N/A /* go to the last entry; i.e. the first node which's 'next' is NULL. 0N/A * Removes the active notifyEncapsulation object used with the given session and 0N/A * returns it. If there is no notifyEncapsulation active for this session, this 0N/A * function returns NULL. 0N/A /* this is the first entry */ 0N/A /* Find the node with the wanted session handle. Also stop, when we reach 0N/A * the last entry; i.e. the first node which's 'next' is NULL. 0N/A /* We found a entry for the wanted session, now remove it. */ 0N/A /* it's the first node */ 0N/A /* We did not find a entry for this session */ 0N/A * Removes the first notifyEncapsulation object. If there is no notifyEncapsulation, 0N/A * this function returns NULL. 0N/A /* this is the first entry */ 0N/A /* Remove the first entry. */ 0N/A#
endif /* NO_CALLBACKS */ 0N/A * The function handling notify callbacks. It casts the pApplication paramter 0N/A * back to a NotifyEncapsulation structure and retrieves the Notify object and 0N/A * the application data from it. 0N/A * @param hSession The session, this callback is comming from. 0N/A * @param event The type of event that occurred. 0N/A * @param pApplication The application data as passed in upon OpenSession. In 0N/A this wrapper we always pass in a NotifyEncapsulation 0N/A object, which holds necessary information for delegating 0N/A the callback to the Java VM. 0N/A /* Get the currently running Java VM */ 0N/A /* Determine, if current thread is already attached */ 0N/A /* thread detached, so attach it */ 0N/A /* this version of JNI is not supported, so just try to attach */ 0N/A /* we assume it was attached to ensure that this thread is not detached 0N/A * afterwards even though it should not 0N/A /* check, if callback threw an exception */ 936N/A /* TBD: clear the pending exception with ExceptionClear? */ 0N/A /* The was an exception thrown, now we get the error-code from it */ 0N/A /* if we attached this thread to the VM just for callback, we detach it now */ 0N/A#
endif /* NO_CALLBACKS */