421 all_auth_credentials[i]->signing_cert->fingerprint = NULL; |
421 all_auth_credentials[i]->signing_cert->fingerprint = NULL; |
422 delete all_auth_credentials[i]->signing_cert; |
422 delete all_auth_credentials[i]->signing_cert; |
423 all_auth_credentials[i]->signing_cert = NULL; |
423 all_auth_credentials[i]->signing_cert = NULL; |
424 jstring j_jar_hash_value = |
424 jstring j_jar_hash_value = |
425 env->NewStringUTF(all_auth_credentials[i]->jar_hash); |
425 env->NewStringUTF(all_auth_credentials[i]->jar_hash); |
426 jstring j_root_hash_value = |
426 jstring j_root_hash_value; |
427 env->NewStringUTF(all_auth_credentials[i]->root_hash); |
427 if (all_auth_credentials[i]->root_id != NULL) |
|
428 { |
|
429 j_root_hash_value = |
|
430 env->NewStringUTF(all_auth_credentials[i]->root_id); |
|
431 } |
|
432 else |
|
433 { |
|
434 j_root_hash_value = |
|
435 env->NewStringUTF(all_auth_credentials[i]->root_hash); |
|
436 } |
428 jstring j_protection_domain_name = NULL; |
437 jstring j_protection_domain_name = NULL; |
429 if (all_auth_credentials[i]->domain_name != NULL) |
438 if (all_auth_credentials[i]->domain_name != NULL) |
430 { |
439 { |
431 j_protection_domain_name = |
440 j_protection_domain_name = |
432 env->NewStringUTF(all_auth_credentials[i]->domain_name); |
441 env->NewStringUTF(all_auth_credentials[i]->domain_name); |
453 all_auth_credentials[i]->domain_category = NULL; |
462 all_auth_credentials[i]->domain_category = NULL; |
454 delete[] all_auth_credentials[i]->jar_hash; |
463 delete[] all_auth_credentials[i]->jar_hash; |
455 all_auth_credentials[i]->jar_hash = NULL; |
464 all_auth_credentials[i]->jar_hash = NULL; |
456 delete[] all_auth_credentials[i]->root_hash; |
465 delete[] all_auth_credentials[i]->root_hash; |
457 all_auth_credentials[i]->root_hash = NULL; |
466 all_auth_credentials[i]->root_hash = NULL; |
|
467 if (all_auth_credentials[i]->root_id != NULL) |
|
468 { |
|
469 delete[] all_auth_credentials[i]->root_id; |
|
470 all_auth_credentials[i]->root_id = NULL; |
|
471 } |
458 delete all_auth_credentials[i]; |
472 delete all_auth_credentials[i]; |
459 all_auth_credentials[i] = NULL; |
473 all_auth_credentials[i] = NULL; |
460 env->SetObjectArrayElement(result, i, auth_credentials); |
474 env->SetObjectArrayElement(result, i, auth_credentials); |
461 } |
475 } |
462 } |
476 } |
463 all_auth_credentials.clear(); |
477 all_auth_credentials.clear(); |
464 return result; |
478 return result; |
|
479 } |
|
480 |
|
481 void SecurityUtils::computePublicKeyHash(X509 * x, char * pkey_hash) |
|
482 { |
|
483 unsigned char tmp[SHA_1_DIGEST_LEN]; |
|
484 EVP_Digest(x->cert_info->key->public_key->data, |
|
485 x->cert_info->key->public_key->length, tmp, NULL, EVP_sha1(), NULL); |
|
486 char * tmp_pkey_hash = NULL; |
|
487 tmp_pkey_hash = pkey_hash; |
|
488 for (int i=0; i<SHA_1_DIGEST_LEN; i++) |
|
489 { |
|
490 sprintf(tmp_pkey_hash, "%02X", tmp[i]); |
|
491 tmp_pkey_hash = tmp_pkey_hash + 2; |
|
492 } |
|
493 pkey_hash[2*SHA_1_DIGEST_LEN] = '\0'; |
|
494 tmp_pkey_hash = NULL; |
465 } |
495 } |
466 |
496 |
467 void SecurityUtils::getAuthInfo(JNIEnv* env, jobjectArray authInfos, int authInfoIndex, AUTH_INFO * authInfo) |
497 void SecurityUtils::getAuthInfo(JNIEnv* env, jobjectArray authInfos, int authInfoIndex, AUTH_INFO * authInfo) |
468 { |
498 { |
469 jboolean isCopy; |
499 jboolean isCopy; |