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/* declare file private functions */ 0N/A/* define variables */ 0N/A/* ************************************************************************** */ 0N/A/* The native implementation of the methods of the PKCS11Implementation class */ 0N/A/* ************************************************************************** */ 0N/A * This method is used to do static initialization. This method is static and 0N/A * synchronized. Summary: use this method like a static initialization block. 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: initializeLibrary 0N/A/* This method is designed to do a clean-up. It releases all global resources 0N/A * of this library. By now, this function is not called. Calling from 0N/A * JNI_OnUnload would be an option, but some VMs do not support JNI_OnUnload. 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: finalizeLibrary 0N/A * remove all left lists and release the resources and the lock 0N/A * objects that synchroniz access to these lists. 0N/A removeAllModuleEntries(env); 0N/A if (moduleListHead == NULL) { * check, if we removed the last active module * 0N/A * remove also the moduleListLock, it is no longer used * 0N/A if (moduleListLock != NULL) { 0N/A destroyLockObject(env, moduleListLock); 0N/A moduleListLock = NULL; 0N/A * remove all left notify callback entries * 0N/A while (removeFirstNotifyEntry(env)); 0N/A * remove also the notifyListLock, it is no longer used * 0N/A if (notifyListLock != NULL) { 0N/A destroyLockObject(env, notifyListLock); 0N/A notifyListLock = NULL; 0N/A if (jInitArgsObject != NULL) { 0N/A (*env)->DeleteGlobalRef(env, jInitArgsObject); 0N/A if (ckpGlobalInitArgs != NULL_PTR) { 0N/A free(ckpGlobalInitArgs); 0N/A#endif * NO_CALLBACKS * 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_Initialize 0N/A * Parametermapping: *PKCS11* 0N/A * @param jobject jInitArgs CK_VOID_PTR pInitArgs 0N/A * Initalize Cryptoki 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_Finalize 0N/A * Parametermapping: *PKCS11* 0N/A * @param jobject jReserved CK_VOID_PTR pReserved 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Parametermapping: *PKCS11* 0N/A * @return jobject jInfoObject CK_INFO_PTR pInfo 0N/A * converts a pointer to a CK_INFO structure into a Java CK_INFO Object. 0N/A * @param env - used to call JNI funktions to create the new Java object 0N/A * @param ckpInfo - the pointer to the CK_INFO structure 0N/A * @return - the new Java CK_INFO object 0N/A /* load CK_INFO class */ 0N/A /* load CK_INFO constructor */ 0N/A /* prep all fields */ 0N/A /* create new CK_INFO object */ 0N/A /* free local references */ 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_GetSlotList 0N/A * Parametermapping: *PKCS11* 0N/A * @param jboolean jTokenPresent CK_BBOOL tokenPresent 0N/A * @return jlongArray jSlotList CK_SLOT_ID_PTR pSlotList 0N/A * CK_ULONG_PTR pulCount 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_GetSlotInfo 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSlotID CK_SLOT_ID slotID 0N/A * @return jobject jSlotInfoObject CK_SLOT_INFO_PTR pInfo 0N/A * converts a pointer to a CK_SLOT_INFO structure into a Java CK_SLOT_INFO 0N/A * @param env - used to call JNI funktions to create the new Java object 0N/A * @param ckpSlotInfo - the pointer to the CK_SLOT_INFO structure 0N/A * @return - the new Java CK_SLOT_INFO object 0N/A /* load CK_SLOT_INFO class */ 0N/A /* load CK_SLOT_INFO constructor */ 0N/A /* prep all fields */ 0N/A /* create new CK_SLOT_INFO object */ 0N/A /* free local references */ 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_GetTokenInfo 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSlotID CK_SLOT_ID slotID 0N/A * @return jobject jInfoTokenObject CK_TOKEN_INFO_PTR pInfo 0N/A * converts a pointer to a CK_TOKEN_INFO structure into a Java CK_TOKEN_INFO 0N/A * @param env - used to call JNI funktions to create the new Java object 0N/A * @param ckpTokenInfo - the pointer to the CK_TOKEN_INFO structure 0N/A * @return - the new Java CK_TOKEN_INFO object 0N/A /* load CK_TOKEN_INFO class */ 0N/A /* load CK_TOKEN_INFO constructor */ 0N/A /* prep all fields */ 0N/A /* create new CK_TOKEN_INFO object */ 0N/A /* free local references */ 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_WaitForSlotEvent 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jFlags CK_FLAGS flags 0N/A * @param jobject jReserved CK_VOID_PTR pReserved 0N/A * @return jlong jSlotID CK_SLOT_ID_PTR pSlot 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_GetMechanismList 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSlotID CK_SLOT_ID slotID 0N/A * @return jlongArray jMechanismList CK_MECHANISM_TYPE_PTR pMechanismList 0N/A * CK_ULONG_PTR pulCount 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_GetMechanismInfo 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSlotID CK_SLOT_ID slotID 0N/A * @param jlong jType CK_MECHANISM_TYPE type 0N/A * @return jobject jMechanismInfo CK_MECHANISM_INFO_PTR pInfo 0N/A * converts a pointer to a CK_MECHANISM_INFO structure into a Java 0N/A * CK_MECHANISM_INFO Object. 0N/A * @param env - used to call JNI funktions to create the new Java object 0N/A * @param ckpMechanismInfo - the pointer to the CK_MECHANISM_INFO structure 0N/A * @return - the new Java CK_MECHANISM_INFO object 0N/A /* load CK_MECHANISM_INFO class */ 0N/A /* load CK_MECHANISM_INFO constructor */ 0N/A /* prep all fields */ 0N/A /* create new CK_MECHANISM_INFO object */ 0N/A /* free local references */ 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Method: C_InitToken 0N/A * Signature: (J[C[C)V 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSlotID CK_SLOT_ID slotID 0N/A * @param jcharArray jPin CK_CHAR_PTR pPin 0N/A * @param jcharArray jLabel CK_UTF8CHAR_PTR pLabel 936N/A /* ckLabelLength <= 32 !!! */ 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSessionHandle CK_SESSION_HANDLE 0N/A * @param jcharArray jPin CK_CHAR_PTR pPin 0N/A * Class: sun_security_pkcs11_wrapper_PKCS11 0N/A * Signature: (J[C[C)V 0N/A * Parametermapping: *PKCS11* 0N/A * @param jlong jSessionHandle CK_SESSION_HANDLE hSession 0N/A * @param jcharArray jOldPin CK_CHAR_PTR pOldPin 0N/A * @param jcharArray jNewPin CK_CHAR_PTR pNewPin