@Override
  public String digestParams(RestInvocation restInvocation) {

    mac.update(restInvocation.getMethodPath().getBytes());
    mac.update(new byte[] {0});
    mac.update(restInvocation.getRequestBody().getBytes());

    return Base64.encodeBytes(mac.doFinal()).trim();
  }
Exemple #2
0
  @Override
  public String digestParams(RestInvocation restInvocation) {

    final String message =
        restInvocation.getParamValue(HeaderParam.class, "ACCESS_NONCE").toString()
            + restInvocation.getInvocationUrl()
            + restInvocation.getRequestBody();

    Mac mac256 = getMac();
    mac256.update(message.getBytes());

    return String.format("%064x", new BigInteger(1, mac256.doFinal()));
  }
  @Override
  public String digestParams(RestInvocation restInvocation) {

    String postBody = restInvocation.getRequestBody();
    mac.update(Base64.encodeBytes(postBody.getBytes()).getBytes());

    return String.format("%096x", new BigInteger(1, mac.doFinal()));
  }
  @Override
  public String digestParams(RestInvocation RestInvocation) {

    try {
      String postBody = RestInvocation.getRequestBody();
      mac.update(postBody.getBytes("UTF-8"));
      return String.format("%0128x", new BigInteger(1, mac.doFinal()));
    } catch (UnsupportedEncodingException e) {
      throw new RuntimeException("Illegal encoding, check the code.", e);
    }
    // return Base64.encodeBytes(mac.doFinal()).trim();
  }
  @Override
  public String digestParams(RestInvocation restInvocation) {

    String postBody = restInvocation.getRequestBody();
    return Base64.encodeBytes(postBody.getBytes());
  }