mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
Compare commits
4 Commits
release-1.
...
alpha-1.5.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d761710e6 | ||
|
|
7461d3c943 | ||
|
|
9291613175 | ||
|
|
ce6739a9fd |
@@ -13,8 +13,8 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 31
|
||||
versionCode 10503
|
||||
versionName "1.5.3"
|
||||
versionCode 10504
|
||||
versionName "1.5.4"
|
||||
consumerProguardFiles 'proguard-rules.txt'
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -51,7 +52,7 @@ public class PrivacyUtils {
|
||||
}
|
||||
|
||||
private static String scrubIpv6Address(byte[] ipv6) {
|
||||
String hex = toHexString(ipv6).toLowerCase();
|
||||
String hex = toHexString(ipv6).toLowerCase(Locale.US);
|
||||
return hex.substring(0, 2) + "[scrubbed]" + hex.substring(30);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.security.Provider;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.Security;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -500,7 +501,7 @@ class CryptoComponentImpl implements CryptoComponent {
|
||||
arraycopy(publicKey, 0, address, 0, publicKey.length);
|
||||
arraycopy(checksum, 0, address, publicKey.length, ONION_CHECKSUM_BYTES);
|
||||
address[address.length - 1] = ONION_HS_PROTOCOL_VERSION;
|
||||
return Base32.encode(address).toLowerCase();
|
||||
return Base32.encode(address).toLowerCase(Locale.US);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.jmock.Expectations;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.Locale;
|
||||
|
||||
import static java.lang.System.arraycopy;
|
||||
import static org.briarproject.bramble.api.contact.HandshakeLinkConstants.BASE32_LINK_BYTES;
|
||||
@@ -174,7 +175,7 @@ public class PendingContactFactoryImplTest extends BrambleMockTestCase {
|
||||
rawLink[0] = (byte) formatVersion;
|
||||
byte[] publicKeyBytes = publicKey.getEncoded();
|
||||
arraycopy(publicKeyBytes, 0, rawLink, 1, publicKeyBytes.length);
|
||||
String base32 = Base32.encode(rawLink).toLowerCase();
|
||||
String base32 = Base32.encode(rawLink).toLowerCase(Locale.US);
|
||||
assertEquals(BASE32_LINK_BYTES, base32.length());
|
||||
return base32;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.briarproject.bramble.crypto;
|
||||
|
||||
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
||||
import org.briarproject.bramble.test.BrambleTestCase;
|
||||
import org.briarproject.bramble.test.TestSecureRandomProvider;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class OnionEncodingTest extends BrambleTestCase {
|
||||
|
||||
private static final Pattern ONION_V3 = Pattern.compile("[a-z2-7]{56}");
|
||||
|
||||
private final CryptoComponent crypto =
|
||||
new CryptoComponentImpl(new TestSecureRandomProvider(), null);
|
||||
private final SecureRandom secureRandom = new SecureRandom();
|
||||
|
||||
@Test
|
||||
public void testHostnameIsValid() {
|
||||
byte[] publicKey = new byte[32];
|
||||
for (int i = 0; i < 100; i++) {
|
||||
secureRandom.nextBytes(publicKey);
|
||||
String onion = crypto.encodeOnion(publicKey);
|
||||
assertTrue(onion, ONION_V3.matcher(onion).matches());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,8 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 31
|
||||
versionCode 10503
|
||||
versionName "1.5.3"
|
||||
versionCode 10504
|
||||
versionName "1.5.4"
|
||||
applicationId "org.briarproject.briar.android"
|
||||
buildConfigField "String", "TorVersion", "\"$tor_version\""
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ import org.briarproject.bramble.util.Base32;
|
||||
import org.briarproject.briar.api.client.MessageTracker;
|
||||
import org.briarproject.briar.api.client.MessageTracker.GroupCount;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import static java.lang.System.arraycopy;
|
||||
import static org.briarproject.bramble.api.contact.HandshakeLinkConstants.FORMAT_VERSION;
|
||||
import static org.briarproject.bramble.api.contact.HandshakeLinkConstants.RAW_LINK_BYTES;
|
||||
@@ -52,7 +54,7 @@ public class BriarTestUtils {
|
||||
byte[] publicKey = keyPair.getPublic().getEncoded();
|
||||
linkBytes[0] = FORMAT_VERSION;
|
||||
arraycopy(publicKey, 0, linkBytes, 1, RAW_LINK_BYTES - 1);
|
||||
return ("briar://" + Base32.encode(linkBytes)).toLowerCase();
|
||||
return ("briar://" + Base32.encode(linkBytes)).toLowerCase(Locale.US);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.briarproject.bramble.identity
|
||||
import org.briarproject.bramble.api.identity.Author
|
||||
import org.briarproject.briar.api.identity.AuthorInfo
|
||||
import org.briarproject.briar.headless.json.JsonDict
|
||||
import java.util.Locale
|
||||
|
||||
fun Author.output() = JsonDict(
|
||||
"formatVersion" to formatVersion,
|
||||
@@ -11,4 +12,4 @@ fun Author.output() = JsonDict(
|
||||
"publicKey" to publicKey.encoded
|
||||
)
|
||||
|
||||
fun AuthorInfo.Status.output() = name.toLowerCase()
|
||||
fun AuthorInfo.Status.output() = name.lowercase(Locale.US)
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.briarproject.bramble.identity.output
|
||||
import org.briarproject.briar.api.blog.BlogPostHeader
|
||||
import org.briarproject.briar.api.blog.MessageType
|
||||
import org.briarproject.briar.headless.json.JsonDict
|
||||
import java.util.Locale
|
||||
|
||||
internal fun BlogPostHeader.output(text: String) = JsonDict(
|
||||
"text" to text,
|
||||
@@ -18,4 +19,4 @@ internal fun BlogPostHeader.output(text: String) = JsonDict(
|
||||
"timestampReceived" to timeReceived
|
||||
)
|
||||
|
||||
internal fun MessageType.output() = name.toLowerCase()
|
||||
internal fun MessageType.output() = name.lowercase(Locale.US)
|
||||
|
||||
Reference in New Issue
Block a user