@Test(expected = IllegalStateException.class) public void testSign_noIdentification() throws Exception { new SignableObject(null, SOME_VALUE).sign(SECRET, translator); }
@SuppressWarnings({ "rawtypes", "unchecked" }) public void sign(byte[] sharedSecret, AbstractJsonTranslator translator) throws IOException { clearToken(); StringBuilder signableStr = new StringBuilder("{").append(translator.toJSON(this)) .append(",\"sharedSecret\":") .append(Hex.encodeHex(sharedSecret)) .append("}"); String token = DigestUtils.md5Hex(signableStr.toString()); setToken(token); }
Signable { @SuppressWarnings({ "rawtypes", "unchecked" }) public void sign(byte[] sharedSecret, AbstractJsonTranslator translator) throws IOException { clearToken(); StringBuilder signableStr = new StringBuilder("{").append(translator.toJSON(this)) .append(",\"sharedSecret\":") .append(Hex.encodeHex(sharedSecret)) .append("}"); String token = DigestUtils.md5Hex(signableStr.toString()); setToken(token); } }
Signable { @SuppressWarnings({ "rawtypes", "unchecked" }) public void sign(byte[] sharedSecret, AbstractJsonTranslator translator) throws IOException { clearToken(); StringBuilder signableStr = new StringBuilder("{").append(translator.toJSON(this)) .append(",\"sharedSecret\":") .append(Hex.encodeHex(sharedSecret)) .append("}"); String token = DigestUtils.md5Hex(signableStr.toString()); setToken(token); }  }
Signable { @SuppressWarnings({ "rawtypes", "unchecked" }) public void sign(byte[] sharedSecret, AbstractJsonTranslator translator) throws IOException { clearToken(); StringBuilder signableStr = new StringBuilder("{").append(translator.toJSON(this)) .append(",\"sharedSecret\":") .append(Hex.encodeHex(sharedSecret)) .append("}"); String token = DigestUtils.md5Hex(signableStr.toString()); setToken(token); }  @SuppressWarnings({ "rawtypes", "unchecked" }) void sign(byte[] sharedSecret, AbstractJsonTranslator translator); @SuppressWarnings({ "rawtypes", "unchecked" }) boolean verify(byte[] sharedSecret, AbstractJsonTranslator translator); String clearToken(); void setToken(String token); }
Signable { @SuppressWarnings({ "rawtypes", "unchecked" }) public void sign(byte[] sharedSecret, AbstractJsonTranslator translator) throws IOException { clearToken(); StringBuilder signableStr = new StringBuilder("{").append(translator.toJSON(this)) .append(",\"sharedSecret\":") .append(Hex.encodeHex(sharedSecret)) .append("}"); String token = DigestUtils.md5Hex(signableStr.toString()); setToken(token); }  @SuppressWarnings({ "rawtypes", "unchecked" }) void sign(byte[] sharedSecret, AbstractJsonTranslator translator); @SuppressWarnings({ "rawtypes", "unchecked" }) boolean verify(byte[] sharedSecret, AbstractJsonTranslator translator); String clearToken(); void setToken(String token);  }