Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
5e6194b6
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5e6194b6
编写于
11月 14, 2014
作者:
V
vinnie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8034031: [parfait] JNI exception pending in jdk/src/macosx/native/apple/security/KeystoreImpl.m
Reviewed-by: alanb, weijun
上级
87f14a54
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
36 addition
and
0 deletion
+36
-0
src/macosx/native/apple/security/KeystoreImpl.m
src/macosx/native/apple/security/KeystoreImpl.m
+36
-0
未找到文件。
src/macosx/native/apple/security/KeystoreImpl.m
浏览文件 @
5e6194b6
...
...
@@ -299,11 +299,21 @@ static void addIdentitiesToKeystore(JNIEnv *env, jobject keyStore)
//
Make
a
java
array
of
certificate
data
from
the
chain
.
jclass
byteArrayClass
=
(*env)->FindClass(env, "[B");
if (byteArrayClass == NULL) {
goto errOut;
}
jobjectArray javaCertArray = (*env)->NewObjectArray(env, certCount, byteArrayClass, NULL);
// Cleanup first then check for a NULL return code
(*env)->DeleteLocalRef(env, byteArrayClass);
if (javaCertArray == NULL) {
goto errOut;
}
// And, make an array of the certificate refs.
jlongArray certRefArray = (*env)->NewLongArray(env, certCount);
if (certRefArray == NULL) {
goto errOut;
}
SecCertificateRef currCertRef = NULL;
...
...
@@ -318,6 +328,9 @@ static void addIdentitiesToKeystore(JNIEnv *env, jobject keyStore)
bzero(&currCertData, sizeof(CSSM_DATA));
err = SecCertificateGetData(currCertRef, &currCertData);
jbyteArray encodedCertData = (*env)->NewByteArray(env, currCertData.Length);
if (encodedCertData == NULL) {
goto errOut;
}
(*env)->SetByteArrayRegion(env, encodedCertData, 0, currCertData.Length, (jbyte *)currCertData.Data);
(*env)->SetObjectArrayElement(env, javaCertArray, i, encodedCertData);
jlong certRefElement = ptr_to_jlong(currCertRef);
...
...
@@ -330,6 +343,9 @@ static void addIdentitiesToKeystore(JNIEnv *env, jobject keyStore)
// Find the label. It's a 'blob', but we interpret as characters.
jstring alias = getLabelFromItem(env, (SecKeychainItemRef)certificate);
if (alias == NULL) {
goto errOut;
}
// Find the creation date.
jlong creationDate = getModDateFromItem(env, (SecKeychainItemRef)certificate);
...
...
@@ -340,6 +356,7 @@ static void addIdentitiesToKeystore(JNIEnv *env, jobject keyStore)
}
} while (searchResult == noErr);
errOut:
if (identitySearch != NULL) {
CFRelease(identitySearch);
}
...
...
@@ -362,10 +379,16 @@ static void addCertificatesToKeystore(JNIEnv *env, jobject keyStore)
CSSM_DATA currCertificate;
err = SecCertificateGetData(certRef, &currCertificate);
jbyteArray certData = (*env)->NewByteArray(env, currCertificate.Length);
if (certData == NULL) {
goto errOut;
}
(*env)->SetByteArrayRegion(env, certData, 0, currCertificate.Length, (jbyte *)currCertificate.Data);
// Find the label. It's a 'blob', but we interpret as characters.
jstring alias = getLabelFromItem(env, theItem);
if (alias == NULL) {
goto errOut;
}
// Find the creation date.
jlong creationDate = getModDateFromItem(env, theItem);
...
...
@@ -376,6 +399,7 @@ static void addCertificatesToKeystore(JNIEnv *env, jobject keyStore)
}
} while (searchResult == noErr);
errOut:
if (keychainItemSearch != NULL) {
CFRelease(keychainItemSearch);
}
...
...
@@ -404,6 +428,9 @@ JNIEXPORT jbyteArray JNICALL Java_apple_security_KeychainStore__1getEncodedKeyDa
if (passwordLen > 0) {
passwordChars = (*env)->GetCharArrayElements(env, passwordObj, NULL);
if (passwordChars == NULL) {
goto errOut;
}
passwordStrRef = CFStringCreateWithCharacters(kCFAllocatorDefault, passwordChars, passwordLen);
}
}
...
...
@@ -423,9 +450,13 @@ JNIEXPORT jbyteArray JNICALL Java_apple_security_KeychainStore__1getEncodedKeyDa
if (err == noErr) {
CFIndex size = CFDataGetLength(exportedData);
returnValue = (*env)->NewByteArray(env, size);
if (returnValue == NULL) {
goto errOut;
}
(*env)->SetByteArrayRegion(env, returnValue, 0, size, (jbyte *)CFDataGetBytePtr(exportedData));
}
errOut:
if (exportedData) CFRelease(exportedData);
if (passwordStrRef) CFRelease(passwordStrRef);
...
...
@@ -466,6 +497,9 @@ JNF_COCOA_ENTER(env);
jsize dataSize = (*env)->GetArrayLength(env, rawDataObj);
jbyte *rawData = (*env)->GetByteArrayElements(env, rawDataObj, NULL);
if (rawData == NULL) {
goto errOut;
}
CFDataRef cfDataToImport = CFDataCreate(kCFAllocatorDefault, (UInt8 *)rawData, dataSize);
CFArrayRef createdItems = NULL;
...
...
@@ -522,6 +556,8 @@ JNF_COCOA_ENTER(env);
CFRelease(createdItems);
}
errOut: ;
JNF_COCOA_EXIT(env);
return returnValue;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录