Closed GoogleCodeExporter closed 8 years ago
This can be fixed easily with the following code substituted for
Association.verifySignature():
public boolean verifySignature(String text, String signature) throws AssociationException
{
if (DEBUG) _log.debug("Verifying signature: " + signature);
return constantTimeEquals(signature, sign(text));
}
private boolean constantTimeEquals(String objA, String objB) {
if (objA == objB) {
return true;
}
int n = objA.length();
if (n == objB.length()) {
char v1[] = new char[n];
objA.getChars(0, n, v1, 0);
char v2[] = new char[n];
objB.getChars(0, n, v2, 0);
int i = 0;
int j = 0;
boolean isEqual = true;
while (n-- != 0) {
if (v1[i++] != v2[j++])
isEqual = false;
}
return isEqual;
}
return false;
}
Original comment by Dan.Troe...@gmail.com
on 10 Dec 2010 at 4:24
The problem has been fixed in r641, so close this issue.
Original comment by zhoushu...@gmail.com
on 9 Jan 2011 at 8:22
Original issue reported on code.google.com by
stevew...@gmail.com
on 19 Jul 2010 at 11:52