/*
*/
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
*
* 3. The end-user documentation included with the redistribution, if any, must
* include the following acknowledgment:
*
* "This product includes software developed by IAIK of Graz University of
* Technology."
*
* Alternately, this acknowledgment may appear in the software itself, if
* and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Graz University of Technology" and "IAIK of Graz University of
* Technology" must not be used to endorse or promote products derived from
* this software without prior written permission.
*
* 5. Products derived from this software may not be called
* "IAIK PKCS Wrapper", nor may "IAIK" appear in their name, without prior
* written permission of Graz University of Technology.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* 18.05.2001
*
* This is the implementation of the native functions of the Java to PKCS#11 interface.
* All function use some helper functions to convert the JNI types to PKCS#11 types.
*
* @author Karl Scheibelhofer <Karl.Scheibelhofer@iaik.at>
* @author Martin Schlaeffer <schlaeff@sbox.tugraz.at>
*/
#include "pkcs11wrapper.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "sun_security_pkcs11_wrapper_PKCS11.h"
/* declare file private functions */
void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam, CK_VOID_PTR *ckpParamPtr, CK_ULONG *ckpLength);
/*
* converts a pointer to a CK_DATE structure into a Java CK_DATE Object.
*
* @param env - used to call JNI funktions to create the new Java object
* @param ckpValue - the pointer to the CK_DATE structure
* @return - the new Java CK_DATE object
*/
{
/* load CK_DATE class */
/* load CK_DATE constructor */
/* prep all fields */
/* create new CK_DATE object */
/* free local references */
return jDateObject ;
}
/*
* converts a pointer to a CK_VERSION structure into a Java CK_VERSION Object.
*
* @param env - used to call JNI funktions to create the new Java object
* @param ckpVersion - the pointer to the CK_VERSION structure
* @return - the new Java CK_VERSION object
*/
{
/* load CK_VERSION class */
/* load CK_VERSION constructor */
/* prep both fields */
/* create new CK_VERSION object */
/* free local references */
return jVersionObject ;
}
/*
* converts a pointer to a CK_SESSION_INFO structure into a Java CK_SESSION_INFO Object.
*
* @param env - used to call JNI funktions to create the new Java object
* @param ckpSessionInfo - the pointer to the CK_SESSION_INFO structure
* @return - the new Java CK_SESSION_INFO object
*/
{
/* load CK_SESSION_INFO class */
/* load CK_SESSION_INFO constructor */
/* prep all fields */
/* create new CK_SESSION_INFO object */
/* free local references */
return jSessionInfoObject ;
}
/*
* converts a pointer to a CK_ATTRIBUTE structure into a Java CK_ATTRIBUTE Object.
*
* @param env - used to call JNI funktions to create the new Java object
* @param ckpAttribute - the pointer to the CK_ATTRIBUTE structure
* @return - the new Java CK_ATTRIBUTE object
*/
{
/* load CK_INFO constructor */
/* prep both fields */
/* create new CK_ATTRIBUTE object */
/* free local references */
return jAttributeObject;
}
/*
* converts a Java CK_VERSION object into a pointer to a CK_VERSION structure
*
* @param env - used to call JNI funktions to get the values out of the Java object
* @param jVersion - the Java CK_VERSION object to convert
* @return - the pointer to the new CK_VERSION structure
*/
{
return NULL;
}
/* get CK_VERSION class */
/* get Major */
/* get Minor */
/* allocate memory for CK_VERSION pointer */
if (ckpVersion == NULL) {
return NULL;
}
return ckpVersion ;
}
/*
* converts a Java CK_DATE object into a pointer to a CK_DATE structure
*
* @param env - used to call JNI funktions to get the values out of the Java object
* @param jVersion - the Java CK_DATE object to convert
* @return - the pointer to the new CK_DATE structure
*/
{
CK_ULONG i;
return NULL;
}
/* get CK_DATE class */
/* get Year */
/* get Month */
/* get Day */
/* allocate memory for CK_DATE pointer */
return NULL;
}
} else {
if (jTempChars == NULL) {
return NULL;
}
return NULL;
}
for (i = 0; (i < ckLength) && (i < 4) ; i++) {
}
}
} else {
if (jTempChars == NULL) {
return NULL;
}
return NULL;
}
for (i = 0; (i < ckLength) && (i < 4) ; i++) {
}
}
} else {
if (jTempChars == NULL) {
return NULL;
}
return NULL;
}
for (i = 0; (i < ckLength) && (i < 4) ; i++) {
}
}
return ckpDate ;
}
/*
* converts a Java CK_ATTRIBUTE object into a CK_ATTRIBUTE structure
*
* @param env - used to call JNI funktions to get the values out of the Java object
* @param jAttribute - the Java CK_ATTRIBUTE object to convert
* @return - the new CK_ATTRIBUTE structure
*/
{
// TBD: what if jAttribute == NULL?!
TRACE0("\nDEBUG: jAttributeToCKAttribute");
/* get CK_ATTRIBUTE class */
TRACE0(", getting attribute object class");
/* get type */
TRACE0(", getting type field");
/* get pValue */
TRACE0(", getting pValue field");
TRACE0(", converting pValue to primitive object");
/* convert the Java pValue object to a CK-type pValue pointer */
TRACE0("\nFINISHED\n");
return ckAttribute ;
}
/*
* converts the Java CK_SSL3_MASTER_KEY_DERIVE_PARAMS object to a
* CK_SSL3_MASTER_KEY_DERIVE_PARAMS structure
*
* @param env - used to call JNI funktions to get the Java classes and objects
* @param jParam - the Java CK_SSL3_MASTER_KEY_DERIVE_PARAMS object to convert
* @return - the new CK_SSL3_MASTER_KEY_DERIVE_PARAMS structure
*/
CK_SSL3_MASTER_KEY_DERIVE_PARAMS jSsl3MasterKeyDeriveParamToCKSsl3MasterKeyDeriveParam(JNIEnv *env, jobject jParam)
{
// XXX don't return structs
// XXX prefetch class and field ids
/* get RandomInfo */
fieldID = (*env)->GetFieldID(env, jSsl3MasterKeyDeriveParamsClass, "RandomInfo", "Lsun/security/pkcs11/wrapper/CK_SSL3_RANDOM_DATA;");
/* get pClientRandom and ulClientRandomLength out of RandomInfo */
/* get pServerRandom and ulServerRandomLength out of RandomInfo */
/* get pVersion */
fieldID = (*env)->GetFieldID(env, jSsl3MasterKeyDeriveParamsClass, "pVersion", "Lsun/security/pkcs11/wrapper/CK_VERSION;");
/* populate java values */
jByteArrayToCKByteArray(env, jRIClientRandom, &(ckParam.RandomInfo.pClientRandom), &(ckParam.RandomInfo.ulClientRandomLen));
return ckParam;
}
jByteArrayToCKByteArray(env, jRIServerRandom, &(ckParam.RandomInfo.pServerRandom), &(ckParam.RandomInfo.ulServerRandomLen));
return ckParam;
}
return ckParam ;
}
/*
* converts the Java CK_TLS_PRF_PARAMS object to a CK_TLS_PRF_PARAMS structure
*/
{
// TBD: what if jParam == NULL?!
/* get pSeed */
/* get pLabel */
/* get pOutput */
/* populate java values */
return ckParam;
}
return ckParam;
}
return ckParam;
}
return ckParam ;
}
/*
* converts the Java CK_SSL3_KEY_MAT_PARAMS object to a CK_SSL3_KEY_MAT_PARAMS structure
*
* @param env - used to call JNI funktions to get the Java classes and objects
* @param jParam - the Java CK_SSL3_KEY_MAT_PARAMS object to convert
* @return - the new CK_SSL3_KEY_MAT_PARAMS structure
*/
{
// XXX don't return structs
// XXX prefetch class and field ids
/* get ulMacSizeInBits */
/* get ulKeySizeInBits */
/* get ulIVSizeInBits */
/* get bIsExport */
/* get RandomInfo */
fieldID = (*env)->GetFieldID(env, jSsl3KeyMatParamsClass, "RandomInfo", "Lsun/security/pkcs11/wrapper/CK_SSL3_RANDOM_DATA;");
/* get pClientRandom and ulClientRandomLength out of RandomInfo */
/* get pServerRandom and ulServerRandomLength out of RandomInfo */
/* get pReturnedKeyMaterial */
fieldID = (*env)->GetFieldID(env, jSsl3KeyMatParamsClass, "pReturnedKeyMaterial", "Lsun/security/pkcs11/wrapper/CK_SSL3_KEY_MAT_OUT;");
/* get pIVClient out of pReturnedKeyMaterial */
/* get pIVServer out of pReturnedKeyMaterial */
/* populate java values */
jByteArrayToCKByteArray(env, jRIClientRandom, &(ckParam.RandomInfo.pClientRandom), &(ckParam.RandomInfo.ulClientRandomLen));
jByteArrayToCKByteArray(env, jRIServerRandom, &(ckParam.RandomInfo.pServerRandom), &(ckParam.RandomInfo.ulServerRandomLen));
return ckParam;
}
/* allocate memory for pRetrunedKeyMaterial */
return ckParam;
}
// the handles are output params only, no need to fetch them from Java
return ckParam;
}
return ckParam;
}
return ckParam ;
}
/*
* converts the Java CK_AES_CTR_PARAMS object to a CK_AES_CTR_PARAMS structure
*
* @param env - used to call JNI funktions to get the Java classes and objects
* @param jParam - the Java CK_AES_CTR_PARAMS object to convert
* @param ckpParam - pointer to the new CK_AES_CTR_PARAMS structure
*/
/* get ulCounterBits */
if (jAesCtrParamsClass == NULL) { return; }
/* get cb */
/* populate java values */
if (ckTemp != 16) {
} else {
}
}
/*
* converts a Java CK_MECHANISM object into a CK_MECHANISM structure
*
* @param env - used to call JNI funktions to get the values out of the Java object
* @param jMechanism - the Java CK_MECHANISM object to convert
* @return - the new CK_MECHANISM structure
*/
{
/* convert the specific Java mechanism parameter object to a pointer to a CK-type mechanism
* structure
*/
if (jParameter == NULL) {
(*ckMechanismPtr).ulParameterLen = 0;
} else {
jMechanismParameterToCKMechanismParameter(env, jParameter, &(*ckMechanismPtr).pParameter, &(*ckMechanismPtr).ulParameterLen);
}
}
/*
* the following functions convert Attribute and Mechanism value pointers
*
* jobject ckAttributeValueToJObject(JNIEnv *env,
* const CK_ATTRIBUTE_PTR ckpAttribute);
*
* void jObjectToPrimitiveCKObjectPtrPtr(JNIEnv *env,
* jobject jObject,
* CK_VOID_PTR *ckpObjectPtr,
* CK_ULONG *pLength);
*
* void jMechanismParameterToCKMechanismParameter(JNIEnv *env,
* jobject jParam,
* CK_VOID_PTR *ckpParamPtr,
* CK_ULONG *ckpLength);
*
* These functions are used if a PKCS#11 mechanism or attribute structure gets
* convertet to a Java attribute or mechanism object or vice versa.
*
* ckAttributeValueToJObject converts a PKCS#11 attribute value pointer to a Java
* object depending on the type of the Attribute. A PKCS#11 attribute value can
* be a CK_ULONG, CK_BYTE[], CK_CHAR[], big integer, CK_BBOOL, CK_UTF8CHAR[],
* CK_DATE or CK_FLAGS that gets converted to a corresponding Java object.
*
* jObjectToPrimitiveCKObjectPtrPtr is used by jAttributeToCKAttributePtr for
* converting the Java attribute value to a PKCS#11 attribute value pointer.
* For now only primitive datatypes and arrays of primitive datatypes can get
* converted. Otherwise this function throws a PKCS#11Exception with the
* errorcode CKR_VENDOR_DEFINED.
*
* jMechanismParameterToCKMechanismParameter converts a Java mechanism parameter
* to a PKCS#11 mechanism parameter. First this function determines what mechanism
* parameter the Java object is, then it allocates the memory for the new PKCS#11
* structure and calls the corresponding function to convert the Java object to
* a PKCS#11 mechanism parameter structure.
*/
/*
* converts the pValue of a CK_ATTRIBUTE structure into a Java Object by checking the type
* of the attribute.
*
* @param env - used to call JNI funktions to create the new Java object
* @param ckpAttribute - the pointer to the CK_ATTRIBUTE structure that contains the type
* and the pValue to convert
* @return - the new Java object of the CK-type pValue
*/
{
return NULL ;
}
switch(ckpAttribute->type) {
case CKA_CLASS:
/* value CK_OBJECT_CLASS, defacto a CK_ULONG */
case CKA_KEY_TYPE:
/* value CK_KEY_TYPE, defacto a CK_ULONG */
case CKA_CERTIFICATE_TYPE:
/* value CK_CERTIFICATE_TYPE, defacto a CK_ULONG */
case CKA_HW_FEATURE_TYPE:
/* value CK_HW_FEATURE_TYPE, defacto a CK_ULONG */
case CKA_MODULUS_BITS:
case CKA_VALUE_BITS:
case CKA_VALUE_LEN:
case CKA_KEY_GEN_MECHANISM:
case CKA_PRIME_BITS:
case CKA_SUB_PRIME_BITS:
/* value CK_ULONG */
break;
/* can be CK_BYTE[],CK_CHAR[] or big integer; defacto always CK_BYTE[] */
case CKA_VALUE:
case CKA_OBJECT_ID:
case CKA_SUBJECT:
case CKA_ID:
case CKA_ISSUER:
case CKA_SERIAL_NUMBER:
case CKA_OWNER:
case CKA_AC_ISSUER:
case CKA_ATTR_TYPES:
case CKA_ECDSA_PARAMS:
/* CKA_EC_PARAMS is the same, these two are equivalent */
case CKA_EC_POINT:
case CKA_PRIVATE_EXPONENT:
case CKA_PRIME_1:
case CKA_PRIME_2:
case CKA_EXPONENT_1:
case CKA_EXPONENT_2:
case CKA_COEFFICIENT:
/* value CK_BYTE[] */
break;
case CKA_RESET_ON_INIT:
case CKA_HAS_RESET:
case CKA_TOKEN:
case CKA_PRIVATE:
case CKA_MODIFIABLE:
case CKA_DERIVE:
case CKA_LOCAL:
case CKA_ENCRYPT:
case CKA_VERIFY:
case CKA_VERIFY_RECOVER:
case CKA_WRAP:
case CKA_SENSITIVE:
case CKA_SECONDARY_AUTH:
case CKA_DECRYPT:
case CKA_SIGN:
case CKA_SIGN_RECOVER:
case CKA_UNWRAP:
case CKA_EXTRACTABLE:
case CKA_ALWAYS_SENSITIVE:
case CKA_NEVER_EXTRACTABLE:
case CKA_TRUSTED:
/* value CK_BBOOL */
break;
case CKA_LABEL:
case CKA_APPLICATION:
/* value RFC 2279 (UTF-8) string */
break;
case CKA_START_DATE:
case CKA_END_DATE:
/* value CK_DATE */
break;
case CKA_MODULUS:
case CKA_PUBLIC_EXPONENT:
case CKA_PRIME:
case CKA_SUBPRIME:
case CKA_BASE:
/* value big integer, i.e. CK_BYTE[] */
break;
case CKA_AUTH_PIN_FLAGS:
/* value FLAGS, defacto a CK_ULONG */
break;
case CKA_VENDOR_DEFINED:
/* we make a CK_BYTE[] out of this */
break;
// Netscape trust attributes
/* value CK_ULONG */
break;
default:
/* we make a CK_BYTE[] out of this */
break;
}
return jValueObject ;
}
/*
* the following functions convert a Java mechanism parameter object to a PKCS#11
* mechanism parameter structure
*
* CK_<Param>_PARAMS j<Param>ParamToCK<Param>Param(JNIEnv *env,
* jobject jParam);
*
* These functions get a Java object, that must be the right Java mechanism
* object and they return the new PKCS#11 mechanism parameter structure.
* Every field of the Java object is retrieved, gets converted to a corresponding
* PKCS#11 type and is set in the new PKCS#11 structure.
*/
/*
* converts the given Java mechanism parameter to a CK mechanism parameter structure
* and store the length in bytes in the length variable.
* The memory of *ckpParamPtr has to be freed after use!
*
* @param env - used to call JNI funktions to get the Java classes and objects
* @param jParam - the Java mechanism parameter object to convert
* @param ckpParamPtr - the reference of the new pointer to the new CK mechanism parameter
* structure
* @param ckpLength - the reference of the length in bytes of the new CK mechanism parameter
* structure
*/
void jMechanismParameterToCKMechanismParameter(JNIEnv *env, jobject jParam, CK_VOID_PTR *ckpParamPtr, CK_ULONG *ckpLength)
{
*ckpParamPtr = NULL;
*ckpLength = 0;
} else {
TRACE0("\nSLOW PATH jMechanismParameterToCKMechanismParameter\n");
}
}
void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam, CK_VOID_PTR *ckpParamPtr, CK_ULONG *ckpLength)
{
/* get all Java mechanism parameter classes */
TRACE0("\nDEBUG: jMechanismParameterToCKMechanismParameter");
* jMechanismParameterToCKMechanismParameter before calling this method.
*/
if (jVersionClass == NULL) { return; }
/*
* CK_VERSION used by CKM_SSL3_PRE_MASTER_KEY_GEN
*/
/* convert jParameter to CKParameter */
/* get length and pointer of parameter */
*ckpLength = sizeof(CK_VERSION);
*ckpParamPtr = ckpParam;
return;
}
if (jSsl3MasterKeyDeriveParamsClass == NULL) { return; }
/*
* CK_SSL3_MASTER_KEY_DERIVE_PARAMS
*/
return;
}
/* convert jParameter to CKParameter */
return;
}
/* get length and pointer of parameter */
*ckpLength = sizeof(CK_SSL3_MASTER_KEY_DERIVE_PARAMS);
*ckpParamPtr = ckpParam;
return;
}
if (jSsl3KeyMatParamsClass == NULL) { return; }
/*
* CK_SSL3_KEY_MAT_PARAMS
*/
return;
}
/* convert jParameter to CKParameter */
return;
}
/* get length and pointer of parameter */
*ckpLength = sizeof(CK_SSL3_KEY_MAT_PARAMS);
*ckpParamPtr = ckpParam;
return;
}
if (jTlsPrfParamsClass == NULL) { return; }
/*
* CK_TLS_PRF_PARAMS
*/
return;
}
/* convert jParameter to CKParameter */
return;
}
/* get length and pointer of parameter */
*ckpLength = sizeof(CK_TLS_PRF_PARAMS);
*ckpParamPtr = ckpParam;
return;
}
if (jAesCtrParamsClass == NULL) { return; }
/*
* CK_AES_CTR_PARAMS
*/
return;
}
/* convert jParameter to CKParameter */
return;
}
/* get length and pointer of parameter */
*ckpLength = sizeof(CK_AES_CTR_PARAMS);
*ckpParamPtr = ckpParam;
return;
}
if (jRsaPkcsOaepParamsClass == NULL) { return; }
/*
* CK_RSA_PKCS_OAEP_PARAMS
*/
return;
}
/* convert jParameter to CKParameter */
return;
}
/* get length and pointer of parameter */
*ckpLength = sizeof(CK_RSA_PKCS_OAEP_PARAMS);
*ckpParamPtr = ckpParam;
return;
}
if (jPbeParamsClass == NULL) { return; }
/*
* CK_PBE_PARAMS
*/
return;
}
/* convert jParameter to CKParameter */
return;
}
/* get length and pointer of parameter */
*ckpLength = sizeof(CK_PBE_PARAMS);
*ckpParamPtr = ckpParam;
return;
}
if (jPkcs5Pbkd2ParamsClass == NULL) { return; }
/*
* CK_PKCS5_PBKD2_PARAMS
*/
return;
}
/* convert jParameter to CKParameter */
return;
}
/* get length and pointer of parameter */
*ckpLength = sizeof(CK_PKCS5_PBKD2_PARAMS);
*ckpParamPtr = ckpParam;
return;
}
if (jRsaPkcsPssParamsClass == NULL) { return; }
/*
* CK_RSA_PKCS_PSS_PARAMS
*/
return;
}
/* convert jParameter to CKParameter */
return;
}
/* get length and pointer of parameter */
*ckpLength = sizeof(CK_RSA_PKCS_PSS_PARAMS);
*ckpParamPtr = ckpParam;
return;
}
if (jEcdh1DeriveParamsClass == NULL) { return; }
/*
* CK_ECDH1_DERIVE_PARAMS
*/
return;
}
/* convert jParameter to CKParameter */
return;
}
/* get length and pointer of parameter */
*ckpLength = sizeof(CK_ECDH1_DERIVE_PARAMS);
*ckpParamPtr = ckpParam;
return;
}
if (jEcdh2DeriveParamsClass == NULL) { return; }
/*
* CK_ECDH2_DERIVE_PARAMS
*/
return;
}
/* convert jParameter to CKParameter */
return;
}
/* get length and pointer of parameter */
*ckpLength = sizeof(CK_ECDH2_DERIVE_PARAMS);
*ckpParamPtr = ckpParam;
return;
}
if (jX942Dh1DeriveParamsClass == NULL) { return; }
/*
* CK_X9_42_DH1_DERIVE_PARAMS
*/
return;
}
/* convert jParameter to CKParameter */
return;
}
/* get length and pointer of parameter */
*ckpLength = sizeof(CK_X9_42_DH1_DERIVE_PARAMS);
*ckpParamPtr = ckpParam;
return;
}
if (jX942Dh2DeriveParamsClass == NULL) { return; }
/*
* CK_X9_42_DH2_DERIVE_PARAMS
*/
return;
}
/* convert jParameter to CKParameter */
return;
}
/* get length and pointer of parameter */
*ckpLength = sizeof(CK_X9_42_DH2_DERIVE_PARAMS);
*ckpParamPtr = ckpParam;
return;
}
/* if everything faild up to here */
/* try if the parameter is a primitive Java type */
/* *ckpParamPtr = jObjectToCKVoidPtr(jParam); */
/* *ckpLength = 1; */
TRACE0("FINISHED\n");
}
/* the mechanism parameter convertion functions: */
/*
* converts the Java CK_RSA_PKCS_OAEP_PARAMS object to a CK_RSA_PKCS_OAEP_PARAMS structure
*
* @param env - used to call JNI funktions to get the Java classes and objects
* @param jParam - the Java CK_RSA_PKCS_OAEP_PARAMS object to convert
* @return - the new CK_RSA_PKCS_OAEP_PARAMS structure
*/
{
/* get hashAlg */
/* get mgf */
/* get source */
/* get sourceData and sourceDataLength */
/* populate java values */
return ckParam ;
}
/*
* converts the Java CK_PBE_PARAMS object to a CK_PBE_PARAMS structure
*
* @param env - used to call JNI funktions to get the Java classes and objects
* @param jParam - the Java CK_PBE_PARAMS object to convert
* @return - the new CK_PBE_PARAMS structure
*/
{
/* get pInitVector */
/* get pPassword and ulPasswordLength */
/* get pSalt and ulSaltLength */
/* get ulIteration */
/* populate java values */
return ckParam;
}
return ckParam;
}
return ckParam ;
}
/*
* Copy back the initialization vector from the native structure to the
* Java object. This is only used for CKM_PBE_* mechanisms and their
* CK_PBE_PARAMS parameters.
*
*/
{
int i;
/* get mechanism */
if (jMechanismClass == NULL) { return; }
/* we do not have maching types, this should not occur */
return;
}
if (jPbeParamsClass == NULL) { return; }
if (initVector != NULL_PTR) {
/* get pParameter */
if (jInitVector != NULL) {
if (jInitVectorChars == NULL) { return; }
/* copy the chars to the Java buffer */
for (i=0; i < jInitVectorLength; i++) {
}
/* copy back the Java buffer to the object */
}
}
}
}
/*
* converts the Java CK_PKCS5_PBKD2_PARAMS object to a CK_PKCS5_PBKD2_PARAMS structure
*
* @param env - used to call JNI funktions to get the Java classes and objects
* @param jParam - the Java CK_PKCS5_PBKD2_PARAMS object to convert
* @return - the new CK_PKCS5_PBKD2_PARAMS structure
*/
{
/* get saltSource */
/* get pSaltSourceData */
/* get iterations */
/* get prf */
/* get pPrfData and ulPrfDataLength in byte */
/* populate java values */
jByteArrayToCKByteArray(env, jSaltSourceData, (CK_BYTE_PTR *) &(ckParam.pSaltSourceData), &(ckParam.ulSaltSourceDataLen));
jByteArrayToCKByteArray(env, jPrfData, (CK_BYTE_PTR *) &(ckParam.pPrfData), &(ckParam.ulPrfDataLen));
return ckParam;
}
return ckParam ;
}
/*
* converts the Java CK_RSA_PKCS_PSS_PARAMS object to a CK_RSA_PKCS_PSS_PARAMS structure
*
* @param env - used to call JNI funktions to get the Java classes and objects
* @param jParam - the Java CK_RSA_PKCS_PSS_PARAMS object to convert
* @return - the new CK_RSA_PKCS_PSS_PARAMS structure
*/
{
/* get hashAlg */
/* get mgf */
/* get sLen */
/* populate java values */
return ckParam ;
}
/*
* converts the Java CK_ECDH1_DERIVE_PARAMS object to a CK_ECDH1_DERIVE_PARAMS structure
*
* @param env - used to call JNI funktions to get the Java classes and objects
* @param jParam - the Java CK_ECDH1_DERIVE_PARAMS object to convert
* @return - the new CK_ECDH1_DERIVE_PARAMS structure
*/
{
/* get kdf */
/* get pSharedData and ulSharedDataLen */
/* get pPublicData and ulPublicDataLen */
/* populate java values */
return ckParam;
}
return ckParam ;
}
/*
* converts the Java CK_ECDH2_DERIVE_PARAMS object to a CK_ECDH2_DERIVE_PARAMS structure
*
* @param env - used to call JNI funktions to get the Java classes and objects
* @param jParam - the Java CK_ECDH2_DERIVE_PARAMS object to convert
* @return - the new CK_ECDH2_DERIVE_PARAMS structure
*/
{
/* get kdf */
/* get pSharedData and ulSharedDataLen */
/* get pPublicData and ulPublicDataLen */
/* get ulPrivateDataLen */
/* get hPrivateData */
/* get pPublicData2 and ulPublicDataLen2 */
/* populate java values */
return ckParam;
}
return ckParam;
}
return ckParam ;
}
/*
* converts the Java CK_X9_42_DH1_DERIVE_PARAMS object to a CK_X9_42_DH1_DERIVE_PARAMS structure
*
* @param env - used to call JNI funktions to get the Java classes and objects
* @param jParam - the Java CK_X9_42_DH1_DERIVE_PARAMS object to convert
* @return - the new CK_X9_42_DH1_DERIVE_PARAMS structure
*/
{
/* get kdf */
/* get pOtherInfo and ulOtherInfoLen */
/* get pPublicData and ulPublicDataLen */
/* populate java values */
return ckParam;
}
return ckParam ;
}
/*
* converts the Java CK_X9_42_DH2_DERIVE_PARAMS object to a CK_X9_42_DH2_DERIVE_PARAMS structure
*
* @param env - used to call JNI funktions to get the Java classes and objects
* @param jParam - the Java CK_X9_42_DH2_DERIVE_PARAMS object to convert
* @return - the new CK_X9_42_DH2_DERIVE_PARAMS structure
*/
{
/* get kdf */
/* get pOtherInfo and ulOtherInfoLen */
/* get pPublicData and ulPublicDataLen */
/* get ulPrivateDataLen */
/* get hPrivateData */
/* get pPublicData2 and ulPublicDataLen2 */
/* populate java values */
return ckParam;
}
return ckParam;
}
return ckParam ;
}