mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 18:59:41 +02:00
Add support for XEP-0418: DNS Queries over XMPP (DoX)
Fixes SMACK-862.
This commit is contained in:
parent
75b1d8ce13
commit
62fd897cf7
20 changed files with 564 additions and 6 deletions
|
@ -43,4 +43,8 @@ public class RandomUtil {
|
|||
public static int nextSecureRandomInt(int bound) {
|
||||
return SECURE_RANDOM.get().nextInt(bound);
|
||||
}
|
||||
|
||||
public static int nextSecureRandomInt() {
|
||||
return SECURE_RANDOM.get().nextInt();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,18 +39,17 @@ public class Base64 {
|
|||
}
|
||||
|
||||
public static final String encodeToString(byte[] input) {
|
||||
byte[] bytes = encode(input);
|
||||
try {
|
||||
return new String(bytes, StringUtils.USASCII);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
return base64encoder.encodeToString(input);
|
||||
}
|
||||
|
||||
public static final String encodeToString(byte[] input, int offset, int len) {
|
||||
return encodeToString(slice(input, offset, len));
|
||||
}
|
||||
|
||||
public static final String encodeToStringWithoutPadding(byte[] input) {
|
||||
return base64encoder.encodeToStringWithoutPadding(input);
|
||||
}
|
||||
|
||||
public static final byte[] encode(byte[] input) {
|
||||
return base64encoder.encode(input);
|
||||
}
|
||||
|
@ -103,6 +102,8 @@ public class Base64 {
|
|||
|
||||
String encodeToString(byte[] input);
|
||||
|
||||
String encodeToStringWithoutPadding(byte[] input);
|
||||
|
||||
byte[] encode(byte[] input);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,11 @@ public class SmackTestSuite {
|
|||
return Base64.getEncoder().encodeToString(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String encodeToStringWithoutPadding(byte[] input) {
|
||||
return Base64.getEncoder().withoutPadding().encodeToString(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encode(byte[] input) {
|
||||
return Base64.getEncoder().encode(input);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue