mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8181670: Improve implementation of keystores
Reviewed-by: mullan
This commit is contained in:
parent
de7e845521
commit
143cb6a2d2
1 changed files with 18 additions and 2 deletions
|
@ -439,6 +439,11 @@ JNIEXPORT jbyteArray JNICALL Java_apple_security_KeychainStore__1getEncodedKeyDa
|
|||
goto errOut;
|
||||
}
|
||||
passwordStrRef = CFStringCreateWithCharacters(kCFAllocatorDefault, passwordChars, passwordLen);
|
||||
|
||||
// clear the password and release
|
||||
memset(passwordChars, 0, passwordLen);
|
||||
(*env)->ReleaseCharArrayElements(env, passwordObj, passwordChars,
|
||||
JNI_ABORT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -527,8 +532,19 @@ JNF_COCOA_ENTER(env);
|
|||
|
||||
if (passwordObj) {
|
||||
passwordLen = (*env)->GetArrayLength(env, passwordObj);
|
||||
passwordChars = (*env)->GetCharArrayElements(env, passwordObj, NULL);
|
||||
passwordStrRef = CFStringCreateWithCharacters(kCFAllocatorDefault, passwordChars, passwordLen);
|
||||
|
||||
if (passwordLen > 0) {
|
||||
passwordChars = (*env)->GetCharArrayElements(env, passwordObj, NULL);
|
||||
if (passwordChars == NULL) {
|
||||
goto errOut;
|
||||
}
|
||||
passwordStrRef = CFStringCreateWithCharacters(kCFAllocatorDefault, passwordChars, passwordLen);
|
||||
|
||||
// clear the password and release
|
||||
memset(passwordChars, 0, passwordLen);
|
||||
(*env)->ReleaseCharArrayElements(env, passwordObj, passwordChars,
|
||||
JNI_ABORT);
|
||||
}
|
||||
}
|
||||
|
||||
paramBlock.version = SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue