X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=android%2Fandroid_api%2Fbase%2Fjni%2FJniOcSecureResource.cpp;h=b01059e8e559660d28f7a746527ec96042019270;hb=40c004d56af1a0c6f4b25fd0417a89c6708c9dc2;hp=4c81fc5009cc04f88750896ee2c434b87222ae3e;hpb=cd1381c1a448dc5dbc7e0e30e3f7e50e31d2aa2a;p=platform%2Fupstream%2Fiotivity.git diff --git a/android/android_api/base/jni/JniOcSecureResource.cpp b/android/android_api/base/jni/JniOcSecureResource.cpp index 4c81fc5..b01059e 100644 --- a/android/android_api/base/jni/JniOcSecureResource.cpp +++ b/android/android_api/base/jni/JniOcSecureResource.cpp @@ -209,6 +209,22 @@ OCStackResult JniOcSecureResource::provisionCredentials(JNIEnv* env, jint type, resultCallback); } +#if defined(__WITH_TLS__) +OCStackResult JniOcSecureResource::provisionTrustCertChain(JNIEnv* env, jint type, jint credId, + jobject jListener) +{ + JniProvisionResultListner *resultListener = AddProvisionResultListener(env, jListener); + + ResultCallBack resultCallback = [resultListener](PMResultList_t *result, int hasError) + { + resultListener->ProvisionResultCallback(result, hasError, ListenerFunc::PROVISIONTRUSTCERTCHAIN); + }; + + return m_sharedSecureResource->provisionTrustCertChain((OicSecCredType_t)type, credId, + resultCallback); +} +#endif + OCStackResult JniOcSecureResource::provisionACL(JNIEnv* env, jobject _acl, jobject jListener) { OCStackResult ret; @@ -524,7 +540,7 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_unlinkDevices * Method: provisionCredentials1 * Signature: (Lorg/iotivity/base/OcSecureResource/provisionCredentials;)V */ -JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionCredentials1 + JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionCredentials1 (JNIEnv *env, jobject thiz, jint type, jint keySize, jobject device2, jobject jListener) { LOGD("OcSecureResource_provisionCredentials"); @@ -565,6 +581,49 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionCredenti /* * Class: org_iotivity_base_OcSecureResource + * Method: provisionTrustCertChain1 + * Signature: (Lorg/iotivity/base/OcSecureResource/provisionTrustCertChain1;)V + */ + JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionTrustCertChain1 +(JNIEnv *env, jobject thiz, jint type, jint credId, jobject jListener) +{ + LOGD("OcSecureResource_provisionTrustCertChain1"); +#if defined(__WITH_X509__) || defined(__WITH_TLS__) + if (!jListener) + { + ThrowOcException(OC_STACK_INVALID_PARAM, "provisionTrustCertChainListener cannot be null"); + return; + } + + JniOcSecureResource *secureResource = JniOcSecureResource::getJniOcSecureResourcePtr(env, thiz); + if (!secureResource) + { + return; + } + + try + { + OCStackResult result = secureResource->provisionTrustCertChain(env, type, credId, + jListener); + if (OC_STACK_OK != result) + { + ThrowOcException(result, "OcSecureResource_provisionTrustCertChain1"); + return; + } + } + catch (OCException& e) + { + LOGE("%s", e.reason().c_str()); + ThrowOcException(e.code(), e.reason().c_str()); + } +#else + ThrowOcException(OC_STACK_INVALID_PARAM, "WITH_TLS not enabled"); + return; +#endif // __WITH_X509__ || __WITH_TLS__ +} + +/* + * Class: org_iotivity_base_OcSecureResource * Method: provisionACL * Signature: (Lorg/iotivity/base/OcSecureResource/provisionACL;)V */