private boolean checkServerVerifyMessage(SSL2ServerVerifyMessage message, TlsContext context) {
byte[] md5Output = getMD5Output(context);
RC4Engine rc4 = new RC4Engine();
rc4.init(false, new KeyParameter(md5Output));
byte[] encrypted = message.getEncryptedPart().getValue();
int len = encrypted.length;
if (len < 16) {
return false;
}
byte[] decrypted = new byte[len];
rc4.processBytes(encrypted, 0, len, decrypted, 0);
return Arrays.equals(Arrays.copyOfRange(decrypted, len - 16, len), context.getClientRandom());
}