8278560: X509KeyManagerImpl::getAliases might return a good key with others

Reviewed-by: xuelei
This commit is contained in:
Weijun Wang 2021-12-17 12:14:17 +00:00
parent 247ea71d24
commit 6412d57a0a
2 changed files with 101 additions and 8 deletions

View file

@ -382,15 +382,13 @@ final class X509KeyManagerImpl extends X509ExtendedKeyManager
issuerSet, false, checkType, constraints,
requestedServerNames, idAlgorithm);
if (results != null) {
// the results will either be a single perfect match
// or 1 or more imperfect matches
// if it's a perfect match, return immediately
EntryStatus status = results.get(0);
if (status.checkResult == CheckResult.OK) {
if (SSLLogger.isOn && SSLLogger.isOn("keymanager")) {
SSLLogger.fine("KeyMgr: choosing key: " + status);
for (EntryStatus status : results) {
if (status.checkResult == CheckResult.OK) {
if (SSLLogger.isOn && SSLLogger.isOn("keymanager")) {
SSLLogger.fine("KeyMgr: choosing key: " + status);
}
return makeAlias(status);
}
return makeAlias(status);
}
if (allResults == null) {
allResults = new ArrayList<EntryStatus>();