@Override public synchronized String digestParams(RestInvocation restInvocation) { String postBody = restInvocation.getRequestBody(); return Base64.getEncoder().encodeToString(postBody.getBytes()); } }
@Override public String digestParams(RestInvocation restInvocation) { String postBody = restInvocation.getRequestBody(); String payload = Base64.getEncoder().encodeToString(postBody.getBytes()); return payload; } }
@Override public synchronized String digestParams(RestInvocation restInvocation) { String postBody = restInvocation.getRequestBody(); return Base64.getEncoder().encodeToString(postBody.getBytes()); } }
@Override public String digestParams(RestInvocation restInvocation) { try { String postBody = restInvocation.getRequestBody(); Mac mac = getMac(); mac.update(postBody.getBytes("UTF-8")); return Base64.getEncoder().encodeToString(mac.doFinal()); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Illegal encoding, check the code.", e); } } }
@Override public String digestParams(RestInvocation restInvocation) { String postBody = restInvocation.getRequestBody(); Mac mac = getMac(); mac.update(Base64.getEncoder().encodeToString(postBody.getBytes()).getBytes()); return String.format("%096x", new BigInteger(1, mac.doFinal())); } }
@Override public String digestParams(RestInvocation restInvocation) { String postBody = restInvocation.getRequestBody(); Mac mac = getMac(); mac.update(postBody.getBytes()); return String.format("%0128x", new BigInteger(1, mac.doFinal())); } }
@Override public String digestParams(RestInvocation restInvocation) { try { String postBody = restInvocation.getRequestBody(); Mac mac = getMac(); 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); } } }
@Override public String digestParams(RestInvocation restInvocation) { Mac mac = getMac(); String requestBody = restInvocation.getRequestBody(); if (requestBody != null && !requestBody.isEmpty()) { mac.update(requestBody.getBytes()); } return String.format("%0128x", new BigInteger(1, mac.doFinal())); } }
@Override public String digestParams(RestInvocation restInvocation) { try { String postBody = restInvocation.getRequestBody(); Mac mac = getMac(); 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); } } }
@Override public String digestParams(RestInvocation restInvocation) { String postBody = restInvocation.getRequestBody(); String payload = Base64.getEncoder().encodeToString(postBody.getBytes()); mac.update(payload.getBytes()); String rtn = DigestUtils.bytesToHex(mac.doFinal()).toLowerCase(); return rtn; } }
@Override public String digestParams(RestInvocation restInvocation) { String postBody = restInvocation.getRequestBody(); Mac mac = getMac(); mac.update(Base64.getEncoder().encodeToString(postBody.getBytes()).getBytes()); return String.format("%096x", new BigInteger(1, mac.doFinal())); } }
@Override public String digestParams(RestInvocation restInvocation) { try { String postBody = restInvocation.getRequestBody(); Mac mac = getMac(); 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) { Mac mac = getMac(); mac.update(restInvocation.getMethodPath().getBytes()); mac.update(new byte[] {0}); mac.update(restInvocation.getRequestBody().getBytes()); return Base64.getEncoder().encodeToString(mac.doFinal()).trim(); } }
@Override public String digestParams(RestInvocation restInvocation) { String path = restInvocation.getMethodPath().replaceFirst("/", ""); String requestBody = restInvocation.getRequestBody(); String stringToSign = (path + "\0" + requestBody); Mac mac = getMac(); mac.update(stringToSign.getBytes()); byte[] rawSignature = mac.doFinal(); byte[] base64encoded = encoder.encode(rawSignature); return new String(base64encoded); } }
@Override public String digestParams(final RestInvocation restInvocation) { final Mac mac512 = getMac(); mac512.update(restInvocation.getRequestBody().getBytes(StandardCharsets.UTF_8)); return DigestUtils.bytesToHex(mac512.doFinal()).toLowerCase(); } }
@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(); if (postBody == null) { postBody = ""; } String uri = restInvocation.getPath() + "?" + restInvocation.getQueryString(); String message = uri + postBody; mac.update(message.getBytes()); return DigestUtils.bytesToHex(mac.doFinal()).toLowerCase(); } }
@Override public String digestParams(RestInvocation restInvocation) { final String path = restInvocation.getPath(); final Map<String, String> httpHeadersFromParams = restInvocation.getHttpHeadersFromParams(); final String requestBody = restInvocation.getRequestBody(); final String input = String.join(";", path, requestBody, httpHeadersFromParams.get("Api-Nonce")); final Mac mac = getMac(); try { mac.update(input.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } final String printBase64Binary = bytesToHex(mac.doFinal()); return Base64.getEncoder().encodeToString(printBase64Binary.getBytes()); } }
@Override public String digestParams(RestInvocation inv) { final String nonce = inv.getParamValue(HeaderParam.class, "timestamp").toString(); return digest(inv.getMethodPath(), nonce, inv.getRequestBody()); }
@Override public String digestParams(RestInvocation restInvocation) { String nonce = restInvocation.getParamValue(HeaderParam.class, "api-expires").toString(); String path = restInvocation.getInvocationUrl().split(restInvocation.getBaseUrl())[1]; String payload = restInvocation.getHttpMethod() + "/" + path + nonce + restInvocation.getRequestBody(); return digestString(payload); }