public static String hex(byte[] bytes) { return StringUtils.encodeHex(bytes(bytes)); }
public static byte[] bytes(String string) { return bytes(StringUtils.toUtf8Bytes(string)); }
private String calcResponse(DigestType digestType) { StringBuilder a2 = new StringBuilder(); if (digestType == DigestType.ClientResponse) { a2.append("AUTHENTICATE"); } a2.append(':'); a2.append(digestUri); String hex_hashed_a2 = StringUtils.encodeHex(MD5.bytes(a2.toString())); StringBuilder kd_argument = new StringBuilder(); kd_argument.append(hex_hashed_a1); kd_argument.append(':'); kd_argument.append(nonce); kd_argument.append(':'); kd_argument.append(INITAL_NONCE); kd_argument.append(':'); kd_argument.append(cnonce); kd_argument.append(':'); kd_argument.append(QOP_VALUE); kd_argument.append(':'); kd_argument.append(hex_hashed_a2); byte[] kd = MD5.bytes(kd_argument.toString()); String responseValue = StringUtils.encodeHex(kd); return responseValue; }
byte[] a1FirstPart = MD5.bytes(authenticationId + ':' + serviceName + ':' + password); cnonce = StringUtils.randomString(32); byte[] a1 = ByteUtils.concat(a1FirstPart, toBytes(':' + nonce + ':' + cnonce)); digestUri = "xmpp/" + serviceName; hex_hashed_a1 = StringUtils.encodeHex(MD5.bytes(a1)); String responseValue = calcResponse(DigestType.ClientResponse);
public static byte[] bytes(String string) { return bytes(StringUtils.toUtf8Bytes(string)); }
public static String hex(byte[] bytes) { return StringUtils.encodeHex(bytes(bytes)); }
private String calcResponse(DigestType digestType) { StringBuilder a2 = new StringBuilder(); if (digestType == DigestType.ClientResponse) { a2.append("AUTHENTICATE"); } a2.append(':'); a2.append(digestUri); String hex_hashed_a2 = StringUtils.encodeHex(MD5.bytes(a2.toString())); StringBuilder kd_argument = new StringBuilder(); kd_argument.append(hex_hashed_a1); kd_argument.append(':'); kd_argument.append(nonce); kd_argument.append(':'); kd_argument.append(INITAL_NONCE); kd_argument.append(':'); kd_argument.append(cnonce); kd_argument.append(':'); kd_argument.append(QOP_VALUE); kd_argument.append(':'); kd_argument.append(hex_hashed_a2); byte[] kd = MD5.bytes(kd_argument.toString()); String responseValue = StringUtils.encodeHex(kd); return responseValue; }
byte[] a1FirstPart = MD5.bytes(authenticationId + ':' + serviceName + ':' + password); cnonce = StringUtils.randomString(32); byte[] a1 = ByteUtils.concat(a1FirstPart, toBytes(':' + nonce + ':' + cnonce)); digestUri = "xmpp/" + serviceName; hex_hashed_a1 = StringUtils.encodeHex(MD5.bytes(a1)); String responseValue = calcResponse(DigestType.ClientResponse);