Skip to content

Commit a227d55

Browse files
committed
added match check and remove on failure - relates to github #1789
1 parent 181c70e commit a227d55

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

prov/src/main/java/org/bouncycastle/jce/provider/OcspCache.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@ static OCSPResponse getOcspResponse(
7373
ResponseData responseData = ResponseData.getInstance(basicResp.getTbsResponseData());
7474

7575
ASN1Sequence s = responseData.getResponses();
76+
boolean matchFound = false;
7677

7778
for (int i = 0; i != s.size(); i++)
7879
{
7980
SingleResponse resp = SingleResponse.getInstance(s.getObjectAt(i));
8081

8182
if (certID.equals(resp.getCertID()))
8283
{
84+
matchFound = true;
8385
ASN1GeneralizedTime nextUp = resp.getNextUpdate();
8486
try
8587
{
@@ -97,9 +99,18 @@ static OCSPResponse getOcspResponse(
9799
}
98100
}
99101
}
100-
if (response != null)
102+
103+
if (matchFound)
104+
{
105+
if (response != null)
106+
{
107+
return response;
108+
}
109+
}
110+
else
101111
{
102-
return response;
112+
// this should also never happen, however...
113+
responseMap.remove(certID);
103114
}
104115
}
105116
}

0 commit comments

Comments
 (0)