+
+ // IllegalArgumentException if key is bad
+ private Object sendCmd(ConnectActionClientObject action, Object[] params)
+ throws IOException, NoSuchFieldException, NoSuchMethodException,
+ ClassNotFoundException {
+ Object rep = action.send(params);
+
+ String hash = hashKey(key, "" + rep);
+ return action.send(hash);
+ }
+
+ /**
+ * Return a hash that corresponds to the given key and the given random
+ * value.
+ *
+ * @param key
+ * the key (the secret)
+ *
+ * @param random
+ * the random value
+ *
+ * @return a hash that was computed using both
+ */
+ static String hashKey(String key, String random) {
+ return StringUtils.getMd5Hash(key + " <==> " + random);
+ }