mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Compare commits
1 Commits
remote-wip
...
limit-in-m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
327e12e9f8 |
@@ -2,7 +2,6 @@ image: briar/ci-image-android:latest
|
|||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- optional_tests
|
|
||||||
- check_reproducibility
|
- check_reproducibility
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@@ -32,33 +31,3 @@ test_reproducible:
|
|||||||
- "curl -X POST -F token=${RELEASE_CHECK_TOKEN} -F ref=master -F variables[RELEASE_TAG]=${CI_COMMIT_REF_NAME} https://code.briarproject.org/api/v4/projects/61/trigger/pipeline"
|
- "curl -X POST -F token=${RELEASE_CHECK_TOKEN} -F ref=master -F variables[RELEASE_TAG]=${CI_COMMIT_REF_NAME} https://code.briarproject.org/api/v4/projects/61/trigger/pipeline"
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
|
|
||||||
.optional_tests:
|
|
||||||
stage: optional_tests
|
|
||||||
before_script:
|
|
||||||
- set -e
|
|
||||||
- export GRADLE_USER_HOME=$PWD/.gradle
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .gradle/wrapper
|
|
||||||
- .gradle/caches
|
|
||||||
|
|
||||||
script:
|
|
||||||
- OPTIONAL_TESTS=org.briarproject.bramble.plugin.tor.BridgeTest ./gradlew --info bramble-java:test --tests BridgeTest
|
|
||||||
|
|
||||||
after_script:
|
|
||||||
# these file change every time but should not be cached
|
|
||||||
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
|
|
||||||
- rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/
|
|
||||||
|
|
||||||
manual_tests:
|
|
||||||
extends: .optional_tests
|
|
||||||
when: manual
|
|
||||||
except:
|
|
||||||
- tags
|
|
||||||
|
|
||||||
pre_release_tests:
|
|
||||||
extends: .optional_tests
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
|
|||||||
5
.idea/codeStyles/Project.xml
generated
5
.idea/codeStyles/Project.xml
generated
@@ -28,11 +28,6 @@
|
|||||||
<option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
|
<option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
|
||||||
</JavaCodeStyleSettings>
|
</JavaCodeStyleSettings>
|
||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
|
||||||
<value />
|
|
||||||
</option>
|
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
|
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="2147483647" />
|
|
||||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
<XML>
|
<XML>
|
||||||
|
|||||||
14
.idea/dictionaries/briar.xml
generated
14
.idea/dictionaries/briar.xml
generated
@@ -1,14 +0,0 @@
|
|||||||
<component name="ProjectDictionaryState">
|
|
||||||
<dictionary name="briar">
|
|
||||||
<words>
|
|
||||||
<w>briar</w>
|
|
||||||
<w>briarproject</w>
|
|
||||||
<w>emoji</w>
|
|
||||||
<w>encrypter</w>
|
|
||||||
<w>identicon</w>
|
|
||||||
<w>introducee</w>
|
|
||||||
<w>introducer</w>
|
|
||||||
<w>onboarding</w>
|
|
||||||
</words>
|
|
||||||
</dictionary>
|
|
||||||
</component>
|
|
||||||
3
.idea/runConfigurations/All_tests.xml
generated
3
.idea/runConfigurations/All_tests.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="All tests" type="AndroidJUnit" factoryName="Android JUnit">
|
<configuration default="false" name="All tests" type="AndroidJUnit" factoryName="Android JUnit">
|
||||||
<module name="briar.briar-android" />
|
<module name="briar-android" />
|
||||||
<option name="PACKAGE_NAME" value="" />
|
<option name="PACKAGE_NAME" value="" />
|
||||||
<option name="MAIN_CLASS_NAME" value="" />
|
<option name="MAIN_CLASS_NAME" value="" />
|
||||||
<option name="METHOD_NAME" value="" />
|
<option name="METHOD_NAME" value="" />
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="All tests in bramble-core" run_configuration_type="AndroidJUnit" />
|
<option name="RunConfigurationTask" enabled="true" run_configuration_name="All tests in bramble-core" run_configuration_type="AndroidJUnit" />
|
||||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="All tests in bramble-android" run_configuration_type="AndroidJUnit" />
|
<option name="RunConfigurationTask" enabled="true" run_configuration_name="All tests in bramble-android" run_configuration_type="AndroidJUnit" />
|
||||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="All tests in bramble-java" run_configuration_type="AndroidJUnit" />
|
<option name="RunConfigurationTask" enabled="true" run_configuration_name="All tests in bramble-java" run_configuration_type="AndroidJUnit" />
|
||||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="All tests in briar-api" run_configuration_type="AndroidJUnit" />
|
|
||||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="All tests in briar-core" run_configuration_type="AndroidJUnit" />
|
<option name="RunConfigurationTask" enabled="true" run_configuration_name="All tests in briar-core" run_configuration_type="AndroidJUnit" />
|
||||||
<option name="RunConfigurationTask" enabled="true" run_configuration_name="All tests in briar-headless" run_configuration_type="AndroidJUnit" />
|
<option name="RunConfigurationTask" enabled="true" run_configuration_name="All tests in briar-headless" run_configuration_type="AndroidJUnit" />
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="All tests in bramble-android" type="AndroidJUnit" factoryName="Android JUnit">
|
<configuration default="false" name="All tests in bramble-android" type="AndroidJUnit" factoryName="Android JUnit">
|
||||||
<module name="briar.bramble-android" />
|
<module name="bramble-android" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
<option name="PACKAGE_NAME" value="" />
|
<option name="PACKAGE_NAME" value="" />
|
||||||
<option name="MAIN_CLASS_NAME" value="" />
|
<option name="MAIN_CLASS_NAME" value="" />
|
||||||
<option name="METHOD_NAME" value="" />
|
<option name="METHOD_NAME" value="" />
|
||||||
<option name="TEST_OBJECT" value="package" />
|
<option name="TEST_OBJECT" value="package" />
|
||||||
|
<option name="VM_PARAMETERS" value="-ea" />
|
||||||
<option name="PARAMETERS" value="" />
|
<option name="PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/bramble-android" />
|
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/bramble-android" />
|
||||||
<method v="2">
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
<option name="TEST_SEARCH_SCOPE">
|
||||||
</method>
|
<value defaultName="singleModule" />
|
||||||
|
</option>
|
||||||
|
<patterns />
|
||||||
|
<method />
|
||||||
</configuration>
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
14
.idea/runConfigurations/All_tests_in_bramble_api.xml
generated
14
.idea/runConfigurations/All_tests_in_bramble_api.xml
generated
@@ -1,14 +1,20 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="All tests in bramble-api" type="AndroidJUnit" factoryName="Android JUnit">
|
<configuration default="false" name="All tests in bramble-api" type="AndroidJUnit" factoryName="Android JUnit">
|
||||||
<module name="briar.bramble-api" />
|
<module name="bramble-api" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
<option name="PACKAGE_NAME" value="" />
|
<option name="PACKAGE_NAME" value="" />
|
||||||
<option name="MAIN_CLASS_NAME" value="" />
|
<option name="MAIN_CLASS_NAME" value="" />
|
||||||
<option name="METHOD_NAME" value="" />
|
<option name="METHOD_NAME" value="" />
|
||||||
<option name="TEST_OBJECT" value="package" />
|
<option name="TEST_OBJECT" value="package" />
|
||||||
|
<option name="VM_PARAMETERS" value="-ea" />
|
||||||
<option name="PARAMETERS" value="" />
|
<option name="PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/bramble-api" />
|
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/bramble-api" />
|
||||||
<method v="2">
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
<option name="TEST_SEARCH_SCOPE">
|
||||||
</method>
|
<value defaultName="singleModule" />
|
||||||
|
</option>
|
||||||
|
<patterns />
|
||||||
|
<method />
|
||||||
</configuration>
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
@@ -1,14 +1,20 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="All tests in bramble-core" type="AndroidJUnit" factoryName="Android JUnit">
|
<configuration default="false" name="All tests in bramble-core" type="AndroidJUnit" factoryName="Android JUnit">
|
||||||
<module name="briar.bramble-core" />
|
<module name="bramble-core" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
<option name="PACKAGE_NAME" value="" />
|
<option name="PACKAGE_NAME" value="" />
|
||||||
<option name="MAIN_CLASS_NAME" value="" />
|
<option name="MAIN_CLASS_NAME" value="" />
|
||||||
<option name="METHOD_NAME" value="" />
|
<option name="METHOD_NAME" value="" />
|
||||||
<option name="TEST_OBJECT" value="package" />
|
<option name="TEST_OBJECT" value="package" />
|
||||||
|
<option name="VM_PARAMETERS" value="-ea" />
|
||||||
<option name="PARAMETERS" value="" />
|
<option name="PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/bramble-core" />
|
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/bramble-core" />
|
||||||
<method v="2">
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
<option name="TEST_SEARCH_SCOPE">
|
||||||
</method>
|
<value defaultName="singleModule" />
|
||||||
|
</option>
|
||||||
|
<patterns />
|
||||||
|
<method />
|
||||||
</configuration>
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="All tests in bramble-java" type="AndroidJUnit" factoryName="Android JUnit">
|
<configuration default="false" name="All tests in bramble-java" type="AndroidJUnit" factoryName="Android JUnit">
|
||||||
<module name="briar.bramble-java" />
|
<module name="bramble-java" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
<option name="PACKAGE_NAME" value="" />
|
<option name="PACKAGE_NAME" value="" />
|
||||||
<option name="MAIN_CLASS_NAME" value="" />
|
<option name="MAIN_CLASS_NAME" value="" />
|
||||||
<option name="METHOD_NAME" value="" />
|
<option name="METHOD_NAME" value="" />
|
||||||
@@ -8,8 +10,11 @@
|
|||||||
<option name="VM_PARAMETERS" value="-ea -Djava.library.path=libs" />
|
<option name="VM_PARAMETERS" value="-ea -Djava.library.path=libs" />
|
||||||
<option name="PARAMETERS" value="" />
|
<option name="PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/bramble-java" />
|
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/bramble-java" />
|
||||||
<method v="2">
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
<option name="TEST_SEARCH_SCOPE">
|
||||||
</method>
|
<value defaultName="singleModule" />
|
||||||
|
</option>
|
||||||
|
<patterns />
|
||||||
|
<method />
|
||||||
</configuration>
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
@@ -1,14 +1,20 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="All tests in briar-android" type="AndroidJUnit" factoryName="Android JUnit">
|
<configuration default="false" name="All tests in briar-android" type="AndroidJUnit" factoryName="Android JUnit">
|
||||||
<module name="briar.briar-android" />
|
<module name="briar-android" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
<option name="PACKAGE_NAME" value="" />
|
<option name="PACKAGE_NAME" value="" />
|
||||||
<option name="MAIN_CLASS_NAME" value="" />
|
<option name="MAIN_CLASS_NAME" value="" />
|
||||||
<option name="METHOD_NAME" value="" />
|
<option name="METHOD_NAME" value="" />
|
||||||
<option name="TEST_OBJECT" value="package" />
|
<option name="TEST_OBJECT" value="package" />
|
||||||
|
<option name="VM_PARAMETERS" value="-ea" />
|
||||||
<option name="PARAMETERS" value="" />
|
<option name="PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/briar-android" />
|
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/briar-android" />
|
||||||
<method v="2">
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
<option name="TEST_SEARCH_SCOPE">
|
||||||
</method>
|
<value defaultName="singleModule" />
|
||||||
|
</option>
|
||||||
|
<patterns />
|
||||||
|
<method />
|
||||||
</configuration>
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
14
.idea/runConfigurations/All_tests_in_briar_api.xml
generated
14
.idea/runConfigurations/All_tests_in_briar_api.xml
generated
@@ -1,14 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="All tests in briar-api" type="AndroidJUnit" factoryName="Android JUnit">
|
|
||||||
<module name="briar.briar-api" />
|
|
||||||
<option name="PACKAGE_NAME" value="" />
|
|
||||||
<option name="MAIN_CLASS_NAME" value="" />
|
|
||||||
<option name="METHOD_NAME" value="" />
|
|
||||||
<option name="TEST_OBJECT" value="package" />
|
|
||||||
<option name="PARAMETERS" value="" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/briar-api" />
|
|
||||||
<method v="2">
|
|
||||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
||||||
14
.idea/runConfigurations/All_tests_in_briar_core.xml
generated
14
.idea/runConfigurations/All_tests_in_briar_core.xml
generated
@@ -1,14 +1,20 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="All tests in briar-core" type="AndroidJUnit" factoryName="Android JUnit">
|
<configuration default="false" name="All tests in briar-core" type="AndroidJUnit" factoryName="Android JUnit">
|
||||||
<module name="briar.briar-core" />
|
<module name="briar-core" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
<option name="PACKAGE_NAME" value="" />
|
<option name="PACKAGE_NAME" value="" />
|
||||||
<option name="MAIN_CLASS_NAME" value="" />
|
<option name="MAIN_CLASS_NAME" value="" />
|
||||||
<option name="METHOD_NAME" value="" />
|
<option name="METHOD_NAME" value="" />
|
||||||
<option name="TEST_OBJECT" value="package" />
|
<option name="TEST_OBJECT" value="package" />
|
||||||
|
<option name="VM_PARAMETERS" value="-ea" />
|
||||||
<option name="PARAMETERS" value="" />
|
<option name="PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/briar-core" />
|
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/briar-core" />
|
||||||
<method v="2">
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
<option name="TEST_SEARCH_SCOPE">
|
||||||
</method>
|
<value defaultName="singleModule" />
|
||||||
|
</option>
|
||||||
|
<patterns />
|
||||||
|
<method />
|
||||||
</configuration>
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="All tests in briar-headless" type="AndroidJUnit" factoryName="Android JUnit">
|
<configuration default="false" name="All tests in briar-headless" type="AndroidJUnit" factoryName="Android JUnit">
|
||||||
<module name="briar.briar-headless" />
|
<module name="briar-headless" />
|
||||||
<option name="PACKAGE_NAME" value="org.briarproject.briar.headless" />
|
<option name="PACKAGE_NAME" value="org.briarproject.briar.headless" />
|
||||||
<option name="MAIN_CLASS_NAME" value="" />
|
<option name="MAIN_CLASS_NAME" value="" />
|
||||||
<option name="METHOD_NAME" value="" />
|
<option name="METHOD_NAME" value="" />
|
||||||
|
|||||||
24
.idea/runConfigurations/BridgeTest.xml
generated
24
.idea/runConfigurations/BridgeTest.xml
generated
@@ -1,24 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="false" name="BridgeTest" type="AndroidJUnit" factoryName="Android JUnit" nameIsGenerated="true">
|
|
||||||
<module name="briar.bramble-java" />
|
|
||||||
<useClassPathOnly />
|
|
||||||
<extension name="coverage">
|
|
||||||
<pattern>
|
|
||||||
<option name="PATTERN" value="org.briarproject.bramble.plugin.tor.*" />
|
|
||||||
<option name="ENABLED" value="true" />
|
|
||||||
</pattern>
|
|
||||||
</extension>
|
|
||||||
<option name="PACKAGE_NAME" value="org.briarproject.bramble.plugin.tor" />
|
|
||||||
<option name="MAIN_CLASS_NAME" value="org.briarproject.bramble.plugin.tor.BridgeTest" />
|
|
||||||
<option name="METHOD_NAME" value="" />
|
|
||||||
<option name="TEST_OBJECT" value="class" />
|
|
||||||
<option name="PARAMETERS" value="" />
|
|
||||||
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
|
|
||||||
<envs>
|
|
||||||
<env name="OPTIONAL_TESTS" value="org.briarproject.bramble.plugin.tor.BridgeTest" />
|
|
||||||
</envs>
|
|
||||||
<method v="2">
|
|
||||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
||||||
14
.idea/runConfigurations/H2_Performance_Test.xml
generated
14
.idea/runConfigurations/H2_Performance_Test.xml
generated
@@ -1,14 +1,20 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="H2 Performance Test" type="AndroidJUnit" factoryName="Android JUnit">
|
<configuration default="false" name="H2 Performance Test" type="AndroidJUnit" factoryName="Android JUnit">
|
||||||
<module name="briar.bramble-core" />
|
<module name="bramble-core" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
<option name="PACKAGE_NAME" value="org.briarproject.bramble.db" />
|
<option name="PACKAGE_NAME" value="org.briarproject.bramble.db" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.briarproject.bramble.db.H2DatabasePerformanceTest" />
|
<option name="MAIN_CLASS_NAME" value="org.briarproject.bramble.db.H2DatabasePerformanceTest" />
|
||||||
<option name="METHOD_NAME" value="" />
|
<option name="METHOD_NAME" value="" />
|
||||||
<option name="TEST_OBJECT" value="class" />
|
<option name="TEST_OBJECT" value="class" />
|
||||||
|
<option name="VM_PARAMETERS" value="-ea" />
|
||||||
<option name="PARAMETERS" value="" />
|
<option name="PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="" />
|
<option name="WORKING_DIRECTORY" value="" />
|
||||||
<method v="2">
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
<option name="TEST_SEARCH_SCOPE">
|
||||||
</method>
|
<value defaultName="singleModule" />
|
||||||
|
</option>
|
||||||
|
<patterns />
|
||||||
|
<method />
|
||||||
</configuration>
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
@@ -1,14 +1,20 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="HyperSQL Performance Test" type="AndroidJUnit" factoryName="Android JUnit">
|
<configuration default="false" name="HyperSQL Performance Test" type="AndroidJUnit" factoryName="Android JUnit">
|
||||||
<module name="briar.bramble-core" />
|
<module name="bramble-core" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" />
|
||||||
<option name="PACKAGE_NAME" value="org.briarproject.bramble.db" />
|
<option name="PACKAGE_NAME" value="org.briarproject.bramble.db" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.briarproject.bramble.db.HyperSqlDatabasePerformanceTest" />
|
<option name="MAIN_CLASS_NAME" value="org.briarproject.bramble.db.HyperSqlDatabasePerformanceTest" />
|
||||||
<option name="METHOD_NAME" value="" />
|
<option name="METHOD_NAME" value="" />
|
||||||
<option name="TEST_OBJECT" value="class" />
|
<option name="TEST_OBJECT" value="class" />
|
||||||
|
<option name="VM_PARAMETERS" value="-ea" />
|
||||||
<option name="PARAMETERS" value="" />
|
<option name="PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="" />
|
<option name="WORKING_DIRECTORY" value="" />
|
||||||
<method v="2">
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
<option name="TEST_SEARCH_SCOPE">
|
||||||
</method>
|
<value defaultName="singleModule" />
|
||||||
|
</option>
|
||||||
|
<patterns />
|
||||||
|
<method />
|
||||||
</configuration>
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
9
.idea/runConfigurations/briar_headless.xml
generated
9
.idea/runConfigurations/briar_headless.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="briar-headless" type="JetRunConfigurationType" singleton="true">
|
<configuration default="false" name="briar-headless" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
||||||
<module name="briar.briar-headless" />
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||||
<option name="VM_PARAMETERS" value="" />
|
<option name="VM_PARAMETERS" value="" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="-v" />
|
<option name="PROGRAM_PARAMETERS" value="-v" />
|
||||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
@@ -8,8 +8,9 @@
|
|||||||
<option name="PASS_PARENT_ENVS" value="true" />
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
<option name="MAIN_CLASS_NAME" value="org.briarproject.briar.headless.MainKt" />
|
<option name="MAIN_CLASS_NAME" value="org.briarproject.briar.headless.MainKt" />
|
||||||
<option name="WORKING_DIRECTORY" value="" />
|
<option name="WORKING_DIRECTORY" value="" />
|
||||||
<method v="2">
|
<module name="briar-headless" />
|
||||||
<option name="Make" enabled="true" />
|
<envs />
|
||||||
|
<method>
|
||||||
<option name="Gradle.BeforeRunTask" enabled="true" tasks="jar" externalProjectPath="$PROJECT_DIR$/briar-headless" vmOptions="" scriptParameters="" />
|
<option name="Gradle.BeforeRunTask" enabled="true" tasks="jar" externalProjectPath="$PROJECT_DIR$/briar-headless" vmOptions="" scriptParameters="" />
|
||||||
</method>
|
</method>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
1
bramble-android/.gitignore
vendored
1
bramble-android/.gitignore
vendored
@@ -3,4 +3,3 @@ gen
|
|||||||
build
|
build
|
||||||
.settings
|
.settings
|
||||||
src/main/res/raw/*.zip
|
src/main/res/raw/*.zip
|
||||||
src/main/jniLibs
|
|
||||||
@@ -5,18 +5,14 @@ apply plugin: 'witness'
|
|||||||
apply from: 'witness.gradle'
|
apply from: 'witness.gradle'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 29
|
||||||
buildToolsVersion '30.0.2'
|
buildToolsVersion '29.0.2'
|
||||||
|
|
||||||
packagingOptions {
|
|
||||||
doNotStrip '**/*.so'
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 29
|
targetSdkVersion 28
|
||||||
versionCode 10218
|
versionCode 10209
|
||||||
versionName "1.2.18"
|
versionName "1.2.9"
|
||||||
consumerProguardFiles 'proguard-rules.txt'
|
consumerProguardFiles 'proguard-rules.txt'
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
@@ -42,27 +38,25 @@ configurations {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(path: ':bramble-core', configuration: 'default')
|
implementation project(path: ':bramble-core', configuration: 'default')
|
||||||
tor 'org.briarproject:tor-android:0.3.5.13@zip'
|
tor 'org.briarproject:tor-android:0.3.5.10@zip'
|
||||||
tor 'org.briarproject:obfs4proxy-android:0.0.12-dev-40245c4a@zip'
|
tor 'org.briarproject:obfs4proxy-android:0.0.11-2@zip'
|
||||||
|
|
||||||
annotationProcessor 'com.google.dagger:dagger-compiler:2.24'
|
annotationProcessor 'com.google.dagger:dagger-compiler:2.24'
|
||||||
|
|
||||||
compileOnly 'javax.annotation:jsr250-api:1.0'
|
compileOnly 'javax.annotation:jsr250-api:1.0'
|
||||||
|
|
||||||
testImplementation project(path: ':bramble-api', configuration: 'testOutput')
|
testImplementation project(path: ':bramble-api', configuration: 'testOutput')
|
||||||
testImplementation "junit:junit:$junit_version"
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation "org.jmock:jmock:$jmock_version"
|
testImplementation "org.jmock:jmock:2.8.2"
|
||||||
testImplementation "org.jmock:jmock-junit4:$jmock_version"
|
testImplementation "org.jmock:jmock-junit4:2.8.2"
|
||||||
testImplementation "org.jmock:jmock-imposters:$jmock_version"
|
testImplementation "org.jmock:jmock-legacy:2.8.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
def torBinariesDir = 'src/main/res/raw'
|
def torBinariesDir = 'src/main/res/raw'
|
||||||
def torLibsDir = 'src/main/jniLibs'
|
|
||||||
|
|
||||||
task cleanTorBinaries {
|
task cleanTorBinaries {
|
||||||
doLast {
|
doLast {
|
||||||
delete fileTree(torBinariesDir) { include '*.zip' }
|
delete fileTree(torBinariesDir) { include '*.zip' }
|
||||||
delete fileTree(torLibsDir) { include '**/*.so' }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,36 +67,8 @@ task unpackTorBinaries {
|
|||||||
copy {
|
copy {
|
||||||
from configurations.tor.collect { zipTree(it) }
|
from configurations.tor.collect { zipTree(it) }
|
||||||
into torBinariesDir
|
into torBinariesDir
|
||||||
include 'geoip.zip'
|
// TODO: Remove after next Tor upgrade, which won't include non-PIE binaries
|
||||||
}
|
include 'geoip.zip', '*_pie.zip'
|
||||||
configurations.tor.each { outer ->
|
|
||||||
zipTree(outer).each { inner ->
|
|
||||||
if (inner.name.endsWith('_arm_pie.zip')) {
|
|
||||||
copy {
|
|
||||||
from zipTree(inner)
|
|
||||||
into torLibsDir
|
|
||||||
rename '(.*)', 'armeabi-v7a/lib$1.so'
|
|
||||||
}
|
|
||||||
} else if (inner.name.endsWith('_arm64_pie.zip')) {
|
|
||||||
copy {
|
|
||||||
from zipTree(inner)
|
|
||||||
into torLibsDir
|
|
||||||
rename '(.*)', 'arm64-v8a/lib$1.so'
|
|
||||||
}
|
|
||||||
} else if (inner.name.endsWith('_x86_pie.zip')) {
|
|
||||||
copy {
|
|
||||||
from zipTree(inner)
|
|
||||||
into torLibsDir
|
|
||||||
rename '(.*)', 'x86/lib$1.so'
|
|
||||||
}
|
|
||||||
} else if (inner.name.endsWith('_x86_64_pie.zip')) {
|
|
||||||
copy {
|
|
||||||
from zipTree(inner)
|
|
||||||
into torLibsDir
|
|
||||||
rename '(.*)', 'x86_64/lib$1.so'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependsOn cleanTorBinaries
|
dependsOn cleanTorBinaries
|
||||||
@@ -110,6 +76,5 @@ task unpackTorBinaries {
|
|||||||
|
|
||||||
tasks.withType(MergeResources) {
|
tasks.withType(MergeResources) {
|
||||||
inputs.dir torBinariesDir
|
inputs.dir torBinariesDir
|
||||||
inputs.dir torLibsDir
|
|
||||||
dependsOn unpackTorBinaries
|
dependsOn unpackTorBinaries
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
package org.briarproject.bramble.network;
|
package org.briarproject.bramble.network;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.LinkAddress;
|
|
||||||
import android.net.LinkProperties;
|
|
||||||
import android.net.Network;
|
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.event.EventBus;
|
import org.briarproject.bramble.api.event.EventBus;
|
||||||
@@ -23,11 +19,6 @@ import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
|||||||
import org.briarproject.bramble.api.system.TaskScheduler;
|
import org.briarproject.bramble.api.system.TaskScheduler;
|
||||||
import org.briarproject.bramble.api.system.TaskScheduler.Cancellable;
|
import org.briarproject.bramble.api.system.TaskScheduler.Cancellable;
|
||||||
|
|
||||||
import java.net.Inet4Address;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.NetworkInterface;
|
|
||||||
import java.net.SocketException;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
@@ -45,22 +36,16 @@ import static android.net.ConnectivityManager.TYPE_WIFI;
|
|||||||
import static android.net.wifi.p2p.WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION;
|
import static android.net.wifi.p2p.WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION;
|
||||||
import static android.os.Build.VERSION.SDK_INT;
|
import static android.os.Build.VERSION.SDK_INT;
|
||||||
import static android.os.PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED;
|
import static android.os.PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED;
|
||||||
import static java.net.NetworkInterface.getNetworkInterfaces;
|
|
||||||
import static java.util.Collections.list;
|
|
||||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||||
import static java.util.logging.Level.INFO;
|
import static java.util.logging.Level.INFO;
|
||||||
import static java.util.logging.Level.WARNING;
|
|
||||||
import static java.util.logging.Logger.getLogger;
|
|
||||||
import static org.briarproject.bramble.api.nullsafety.NullSafety.requireNonNull;
|
|
||||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
|
||||||
|
|
||||||
@MethodsNotNullByDefault
|
@MethodsNotNullByDefault
|
||||||
@ParametersNotNullByDefault
|
@ParametersNotNullByDefault
|
||||||
class AndroidNetworkManager implements NetworkManager, Service {
|
class AndroidNetworkManager implements NetworkManager, Service {
|
||||||
|
|
||||||
private static final Logger LOG =
|
private static final Logger LOG =
|
||||||
getLogger(AndroidNetworkManager.class.getName());
|
Logger.getLogger(AndroidNetworkManager.class.getName());
|
||||||
|
|
||||||
// See android.net.wifi.WifiManager
|
// See android.net.wifi.WifiManager
|
||||||
private static final String WIFI_AP_STATE_CHANGED_ACTION =
|
private static final String WIFI_AP_STATE_CHANGED_ACTION =
|
||||||
@@ -69,8 +54,7 @@ class AndroidNetworkManager implements NetworkManager, Service {
|
|||||||
private final TaskScheduler scheduler;
|
private final TaskScheduler scheduler;
|
||||||
private final EventBus eventBus;
|
private final EventBus eventBus;
|
||||||
private final Executor eventExecutor;
|
private final Executor eventExecutor;
|
||||||
private final Application app;
|
private final Context appContext;
|
||||||
private final ConnectivityManager connectivityManager;
|
|
||||||
private final AtomicReference<Cancellable> connectivityCheck =
|
private final AtomicReference<Cancellable> connectivityCheck =
|
||||||
new AtomicReference<>();
|
new AtomicReference<>();
|
||||||
private final AtomicBoolean used = new AtomicBoolean(false);
|
private final AtomicBoolean used = new AtomicBoolean(false);
|
||||||
@@ -83,9 +67,7 @@ class AndroidNetworkManager implements NetworkManager, Service {
|
|||||||
this.scheduler = scheduler;
|
this.scheduler = scheduler;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.eventExecutor = eventExecutor;
|
this.eventExecutor = eventExecutor;
|
||||||
this.app = app;
|
this.appContext = app.getApplicationContext();
|
||||||
connectivityManager = (ConnectivityManager)
|
|
||||||
requireNonNull(app.getSystemService(CONNECTIVITY_SERVICE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -100,82 +82,24 @@ class AndroidNetworkManager implements NetworkManager, Service {
|
|||||||
filter.addAction(WIFI_AP_STATE_CHANGED_ACTION);
|
filter.addAction(WIFI_AP_STATE_CHANGED_ACTION);
|
||||||
filter.addAction(WIFI_P2P_THIS_DEVICE_CHANGED_ACTION);
|
filter.addAction(WIFI_P2P_THIS_DEVICE_CHANGED_ACTION);
|
||||||
if (SDK_INT >= 23) filter.addAction(ACTION_DEVICE_IDLE_MODE_CHANGED);
|
if (SDK_INT >= 23) filter.addAction(ACTION_DEVICE_IDLE_MODE_CHANGED);
|
||||||
app.registerReceiver(networkStateReceiver, filter);
|
appContext.registerReceiver(networkStateReceiver, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stopService() {
|
public void stopService() {
|
||||||
if (networkStateReceiver != null)
|
if (networkStateReceiver != null)
|
||||||
app.unregisterReceiver(networkStateReceiver);
|
appContext.unregisterReceiver(networkStateReceiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NetworkStatus getNetworkStatus() {
|
public NetworkStatus getNetworkStatus() {
|
||||||
NetworkInfo net = connectivityManager.getActiveNetworkInfo();
|
ConnectivityManager cm = (ConnectivityManager)
|
||||||
|
appContext.getSystemService(CONNECTIVITY_SERVICE);
|
||||||
|
if (cm == null) throw new AssertionError();
|
||||||
|
NetworkInfo net = cm.getActiveNetworkInfo();
|
||||||
boolean connected = net != null && net.isConnected();
|
boolean connected = net != null && net.isConnected();
|
||||||
boolean wifi = false, ipv6Only = false;
|
boolean wifi = connected && net.getType() == TYPE_WIFI;
|
||||||
if (connected) {
|
return new NetworkStatus(connected, wifi);
|
||||||
wifi = net.getType() == TYPE_WIFI;
|
|
||||||
if (SDK_INT >= 23) ipv6Only = isActiveNetworkIpv6Only();
|
|
||||||
else ipv6Only = areAllAvailableNetworksIpv6Only();
|
|
||||||
}
|
|
||||||
return new NetworkStatus(connected, wifi, ipv6Only);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the
|
|
||||||
* {@link ConnectivityManager#getActiveNetwork() active network} has an
|
|
||||||
* IPv6 unicast address and no IPv4 addresses. The active network is
|
|
||||||
* assumed not to be a loopback interface.
|
|
||||||
*/
|
|
||||||
@TargetApi(23)
|
|
||||||
private boolean isActiveNetworkIpv6Only() {
|
|
||||||
Network net = connectivityManager.getActiveNetwork();
|
|
||||||
if (net == null) {
|
|
||||||
LOG.info("No active network");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
LinkProperties props = connectivityManager.getLinkProperties(net);
|
|
||||||
if (props == null) {
|
|
||||||
LOG.info("No link properties for active network");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
boolean hasIpv6Unicast = false;
|
|
||||||
for (LinkAddress linkAddress : props.getLinkAddresses()) {
|
|
||||||
InetAddress addr = linkAddress.getAddress();
|
|
||||||
if (addr instanceof Inet4Address) return false;
|
|
||||||
if (!addr.isMulticastAddress()) hasIpv6Unicast = true;
|
|
||||||
}
|
|
||||||
return hasIpv6Unicast;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the device has at least one network interface with an
|
|
||||||
* IPv6 unicast address and no interfaces with IPv4 addresses, excluding
|
|
||||||
* loopback interfaces and interfaces that are
|
|
||||||
* {@link NetworkInterface#isUp() down}. If this method returns true and
|
|
||||||
* the device has internet access then it's via IPv6 only.
|
|
||||||
*/
|
|
||||||
private boolean areAllAvailableNetworksIpv6Only() {
|
|
||||||
try {
|
|
||||||
Enumeration<NetworkInterface> interfaces = getNetworkInterfaces();
|
|
||||||
if (interfaces == null) {
|
|
||||||
LOG.info("No network interfaces");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
boolean hasIpv6Unicast = false;
|
|
||||||
for (NetworkInterface i : list(interfaces)) {
|
|
||||||
if (i.isLoopback() || !i.isUp()) continue;
|
|
||||||
for (InetAddress addr : list(i.getInetAddresses())) {
|
|
||||||
if (addr instanceof Inet4Address) return false;
|
|
||||||
if (!addr.isMulticastAddress()) hasIpv6Unicast = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hasIpv6Unicast;
|
|
||||||
} catch (SocketException e) {
|
|
||||||
logException(LOG, WARNING, e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateConnectionStatus() {
|
private void updateConnectionStatus() {
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ class AndroidBluetoothPlugin
|
|||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
String getBluetoothAddress() {
|
String getBluetoothAddress() {
|
||||||
if (adapter == null) return null;
|
|
||||||
String address = AndroidUtils.getBluetoothAddress(app, adapter);
|
String address = AndroidUtils.getBluetoothAddress(app, adapter);
|
||||||
return address.isEmpty() ? null : address;
|
return address.isEmpty() ? null : address;
|
||||||
}
|
}
|
||||||
@@ -175,11 +174,6 @@ class AndroidBluetoothPlugin
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
IoUtils.tryToClose(s, LOG, WARNING);
|
IoUtils.tryToClose(s, LOG, WARNING);
|
||||||
throw e;
|
throw e;
|
||||||
} catch (NullPointerException e) {
|
|
||||||
// BluetoothSocket#connect() may throw an NPE under unknown
|
|
||||||
// circumstances
|
|
||||||
IoUtils.tryToClose(s, LOG, WARNING);
|
|
||||||
throw new IOException(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,42 +16,19 @@ import org.briarproject.bramble.api.system.AndroidWakeLockManager;
|
|||||||
import org.briarproject.bramble.api.system.Clock;
|
import org.briarproject.bramble.api.system.Clock;
|
||||||
import org.briarproject.bramble.api.system.LocationUtils;
|
import org.briarproject.bramble.api.system.LocationUtils;
|
||||||
import org.briarproject.bramble.api.system.ResourceProvider;
|
import org.briarproject.bramble.api.system.ResourceProvider;
|
||||||
import org.briarproject.bramble.util.AndroidUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.logging.Logger;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipInputStream;
|
|
||||||
|
|
||||||
import javax.net.SocketFactory;
|
import javax.net.SocketFactory;
|
||||||
|
|
||||||
import static android.os.Build.VERSION.SDK_INT;
|
|
||||||
import static java.util.Arrays.asList;
|
|
||||||
import static java.util.logging.Level.INFO;
|
|
||||||
import static java.util.logging.Logger.getLogger;
|
|
||||||
|
|
||||||
@MethodsNotNullByDefault
|
@MethodsNotNullByDefault
|
||||||
@ParametersNotNullByDefault
|
@ParametersNotNullByDefault
|
||||||
class AndroidTorPlugin extends TorPlugin {
|
class AndroidTorPlugin extends TorPlugin {
|
||||||
|
|
||||||
private static final List<String> LIBRARY_ARCHITECTURES =
|
|
||||||
asList("armeabi-v7a", "arm64-v8a", "x86", "x86_64");
|
|
||||||
|
|
||||||
private static final String TOR_LIB_NAME = "libtor.so";
|
|
||||||
private static final String OBFS4_LIB_NAME = "libobfs4proxy.so";
|
|
||||||
|
|
||||||
private static final Logger LOG =
|
|
||||||
getLogger(AndroidTorPlugin.class.getName());
|
|
||||||
|
|
||||||
private final Application app;
|
private final Application app;
|
||||||
private final AndroidWakeLock wakeLock;
|
private final AndroidWakeLock wakeLock;
|
||||||
private final File torLib, obfs4Lib;
|
|
||||||
|
|
||||||
AndroidTorPlugin(Executor ioExecutor,
|
AndroidTorPlugin(Executor ioExecutor,
|
||||||
Executor wakefulIoExecutor,
|
Executor wakefulIoExecutor,
|
||||||
@@ -78,9 +55,6 @@ class AndroidTorPlugin extends TorPlugin {
|
|||||||
maxIdleTime, torDirectory);
|
maxIdleTime, torDirectory);
|
||||||
this.app = app;
|
this.app = app;
|
||||||
wakeLock = wakeLockManager.createWakeLock("TorPlugin");
|
wakeLock = wakeLockManager.createWakeLock("TorPlugin");
|
||||||
String nativeLibDir = app.getApplicationInfo().nativeLibraryDir;
|
|
||||||
torLib = new File(nativeLibDir, TOR_LIB_NAME);
|
|
||||||
obfs4Lib = new File(nativeLibDir, OBFS4_LIB_NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -111,112 +85,4 @@ class AndroidTorPlugin extends TorPlugin {
|
|||||||
super.stop();
|
super.stop();
|
||||||
wakeLock.release();
|
wakeLock.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected File getTorExecutableFile() {
|
|
||||||
return torLib.exists() ? torLib : super.getTorExecutableFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected File getObfs4ExecutableFile() {
|
|
||||||
return obfs4Lib.exists() ? obfs4Lib : super.getObfs4ExecutableFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void installTorExecutable() throws IOException {
|
|
||||||
File extracted = super.getTorExecutableFile();
|
|
||||||
if (torLib.exists()) {
|
|
||||||
// If an older version left behind a Tor binary, delete it
|
|
||||||
if (extracted.exists()) {
|
|
||||||
if (extracted.delete()) LOG.info("Deleted Tor binary");
|
|
||||||
else LOG.info("Failed to delete Tor binary");
|
|
||||||
}
|
|
||||||
} else if (SDK_INT < 29) {
|
|
||||||
// The binary wasn't extracted at install time. Try to extract it
|
|
||||||
extractLibraryFromApk(TOR_LIB_NAME, extracted);
|
|
||||||
} else {
|
|
||||||
// No point extracting the binary, we won't be allowed to execute it
|
|
||||||
throw new FileNotFoundException(torLib.getAbsolutePath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void installObfs4Executable() throws IOException {
|
|
||||||
File extracted = super.getObfs4ExecutableFile();
|
|
||||||
if (obfs4Lib.exists()) {
|
|
||||||
// If an older version left behind an obfs4 binary, delete it
|
|
||||||
if (extracted.exists()) {
|
|
||||||
if (extracted.delete()) LOG.info("Deleted obfs4 binary");
|
|
||||||
else LOG.info("Failed to delete obfs4 binary");
|
|
||||||
}
|
|
||||||
} else if (SDK_INT < 29) {
|
|
||||||
// The binary wasn't extracted at install time. Try to extract it
|
|
||||||
extractLibraryFromApk(OBFS4_LIB_NAME, extracted);
|
|
||||||
} else {
|
|
||||||
// No point extracting the binary, we won't be allowed to execute it
|
|
||||||
throw new FileNotFoundException(obfs4Lib.getAbsolutePath());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void extractLibraryFromApk(String libName, File dest)
|
|
||||||
throws IOException {
|
|
||||||
File sourceDir = new File(app.getApplicationInfo().sourceDir);
|
|
||||||
if (sourceDir.isFile()) {
|
|
||||||
// Look for other APK files in the same directory, if we're allowed
|
|
||||||
File parent = sourceDir.getParentFile();
|
|
||||||
if (parent != null) sourceDir = parent;
|
|
||||||
}
|
|
||||||
List<String> libPaths = getSupportedLibraryPaths(libName);
|
|
||||||
for (File apk : findApkFiles(sourceDir)) {
|
|
||||||
ZipInputStream zin = new ZipInputStream(new FileInputStream(apk));
|
|
||||||
for (ZipEntry e = zin.getNextEntry(); e != null;
|
|
||||||
e = zin.getNextEntry()) {
|
|
||||||
if (libPaths.contains(e.getName())) {
|
|
||||||
if (LOG.isLoggable(INFO)) {
|
|
||||||
LOG.info("Extracting " + e.getName()
|
|
||||||
+ " from " + apk.getAbsolutePath());
|
|
||||||
}
|
|
||||||
extract(zin, dest); // Zip input stream will be closed
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
zin.close();
|
|
||||||
}
|
|
||||||
throw new FileNotFoundException(libName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns all files with the extension .apk or .APK under the given root.
|
|
||||||
*/
|
|
||||||
private List<File> findApkFiles(File root) {
|
|
||||||
List<File> files = new ArrayList<>();
|
|
||||||
findApkFiles(root, files);
|
|
||||||
return files;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void findApkFiles(File f, List<File> files) {
|
|
||||||
if (f.isFile() && f.getName().toLowerCase().endsWith(".apk")) {
|
|
||||||
files.add(f);
|
|
||||||
} else if (f.isDirectory()) {
|
|
||||||
File[] children = f.listFiles();
|
|
||||||
if (children != null) {
|
|
||||||
for (File child : children) findApkFiles(child, files);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the paths at which libraries with the given name would be found
|
|
||||||
* inside an APK file, for all architectures supported by the device, in
|
|
||||||
* order of preference.
|
|
||||||
*/
|
|
||||||
private List<String> getSupportedLibraryPaths(String libName) {
|
|
||||||
List<String> architectures = new ArrayList<>();
|
|
||||||
for (String abi : AndroidUtils.getSupportedArchitectures()) {
|
|
||||||
if (LIBRARY_ARCHITECTURES.contains(abi)) {
|
|
||||||
architectures.add("lib/" + abi + "/" + libName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return architectures;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import android.bluetooth.BluetoothAdapter;
|
|||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.net.wifi.WifiConfiguration;
|
||||||
|
import android.net.wifi.WifiManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
@@ -15,10 +17,12 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
|||||||
|
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.concurrent.Immutable;
|
import javax.annotation.concurrent.Immutable;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import static android.content.Context.WIFI_SERVICE;
|
||||||
import static android.os.Build.VERSION.SDK_INT;
|
import static android.os.Build.VERSION.SDK_INT;
|
||||||
import static android.provider.Settings.Secure.ANDROID_ID;
|
import static android.provider.Settings.Secure.ANDROID_ID;
|
||||||
|
|
||||||
@@ -48,6 +52,15 @@ class AndroidSecureRandomProvider extends UnixSecureRandomProvider {
|
|||||||
String id = Settings.Secure.getString(contentResolver, ANDROID_ID);
|
String id = Settings.Secure.getString(contentResolver, ANDROID_ID);
|
||||||
if (id != null) out.writeUTF(id);
|
if (id != null) out.writeUTF(id);
|
||||||
Parcel parcel = Parcel.obtain();
|
Parcel parcel = Parcel.obtain();
|
||||||
|
WifiManager wm = (WifiManager) appContext.getApplicationContext()
|
||||||
|
.getSystemService(WIFI_SERVICE);
|
||||||
|
if (wm != null) {
|
||||||
|
List<WifiConfiguration> configs = wm.getConfiguredNetworks();
|
||||||
|
if (configs != null) {
|
||||||
|
for (WifiConfiguration config : configs)
|
||||||
|
parcel.writeParcelable(config, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
BluetoothAdapter bt = BluetoothAdapter.getDefaultAdapter();
|
BluetoothAdapter bt = BluetoothAdapter.getDefaultAdapter();
|
||||||
if (bt != null) {
|
if (bt != null) {
|
||||||
for (BluetoothDevice device : bt.getBondedDevices())
|
for (BluetoothDevice device : bt.getBondedDevices())
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package org.briarproject.bramble.system;
|
|||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
|
||||||
@@ -105,21 +106,14 @@ class AndroidWakeLockManagerImpl implements AndroidWakeLockManager {
|
|||||||
|
|
||||||
private String getWakeLockTag(Context ctx) {
|
private String getWakeLockTag(Context ctx) {
|
||||||
PackageManager pm = ctx.getPackageManager();
|
PackageManager pm = ctx.getPackageManager();
|
||||||
if (isInstalled(pm, "com.huawei.powergenie")) {
|
for (PackageInfo info : pm.getInstalledPackages(0)) {
|
||||||
return "LocationManagerService";
|
String name = info.packageName.toLowerCase();
|
||||||
} else if (isInstalled(pm, "com.evenwell.PowerMonitor")) {
|
if (name.startsWith("com.huawei.powergenie")) {
|
||||||
return "AudioIn";
|
return "LocationManagerService";
|
||||||
|
} else if (name.startsWith("com.evenwell.powermonitor")) {
|
||||||
|
return "AudioIn";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ctx.getPackageName();
|
return ctx.getPackageName();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInstalled(PackageManager pm, String packageName) {
|
|
||||||
try {
|
|
||||||
pm.getPackageInfo(packageName, 0);
|
|
||||||
return true;
|
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ public class AndroidUtils {
|
|||||||
private static final String FAKE_BLUETOOTH_ADDRESS = "02:00:00:00:00:00";
|
private static final String FAKE_BLUETOOTH_ADDRESS = "02:00:00:00:00:00";
|
||||||
|
|
||||||
private static final String STORED_REPORTS = "dev-reports";
|
private static final String STORED_REPORTS = "dev-reports";
|
||||||
private static final String STORED_LOGCAT = "dev-logcat";
|
|
||||||
|
|
||||||
public static Collection<String> getSupportedArchitectures() {
|
public static Collection<String> getSupportedArchitectures() {
|
||||||
List<String> abis = new ArrayList<>();
|
List<String> abis = new ArrayList<>();
|
||||||
@@ -108,14 +107,14 @@ public class AndroidUtils {
|
|||||||
return ctx.getDir(STORED_REPORTS, MODE_PRIVATE);
|
return ctx.getDir(STORED_REPORTS, MODE_PRIVATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File getLogcatFile(Context ctx) {
|
|
||||||
return new File(ctx.getFilesDir(), STORED_LOGCAT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of supported content types for image attachments.
|
* Returns an array of supported content types for image attachments.
|
||||||
|
* GIFs can't be compressed on API < 24 so they're not supported.
|
||||||
|
* <p>
|
||||||
|
* TODO: Remove this restriction when large message support is added
|
||||||
*/
|
*/
|
||||||
public static String[] getSupportedImageContentTypes() {
|
public static String[] getSupportedImageContentTypes() {
|
||||||
return new String[] {"image/jpeg", "image/png", "image/gif"};
|
if (SDK_INT < 24) return new String[] {"image/jpeg", "image/png"};
|
||||||
|
else return new String[] {"image/jpeg", "image/png", "image/gif"};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import org.briarproject.bramble.api.db.DatabaseConfig;
|
|||||||
import org.briarproject.bramble.api.identity.IdentityManager;
|
import org.briarproject.bramble.api.identity.IdentityManager;
|
||||||
import org.briarproject.bramble.test.BrambleMockTestCase;
|
import org.briarproject.bramble.test.BrambleMockTestCase;
|
||||||
import org.jmock.Expectations;
|
import org.jmock.Expectations;
|
||||||
import org.jmock.imposters.ByteBuddyClassImposteriser;
|
import org.jmock.lib.legacy.ClassImposteriser;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -44,7 +44,7 @@ public class AndroidAccountManagerTest extends BrambleMockTestCase {
|
|||||||
private AndroidAccountManager accountManager;
|
private AndroidAccountManager accountManager;
|
||||||
|
|
||||||
public AndroidAccountManagerTest() {
|
public AndroidAccountManagerTest() {
|
||||||
context.setImposteriser(ByteBuddyClassImposteriser.INSTANCE);
|
context.setImposteriser(ClassImposteriser.INSTANCE);
|
||||||
app = context.mock(Application.class);
|
app = context.mock(Application.class);
|
||||||
applicationInfo = new ApplicationInfo();
|
applicationInfo = new ApplicationInfo();
|
||||||
applicationInfo.dataDir = testDir.getAbsolutePath();
|
applicationInfo.dataDir = testDir.getAbsolutePath();
|
||||||
|
|||||||
@@ -1,117 +1,103 @@
|
|||||||
dependencyVerification {
|
dependencyVerification {
|
||||||
verify = [
|
verify = [
|
||||||
'cglib:cglib:3.2.8:cglib-3.2.8.jar:3f64de999ecc5595dc84ca8ff0879d8a34c8623f9ef3c517a53ed59023fcb9db',
|
'cglib:cglib:3.2.0:cglib-3.2.0.jar:adb13bab79712ad6bdf1bd59f2a3918018a8016e722e8a357065afb9e6690861',
|
||||||
'com.android.tools.analytics-library:protos:27.2.2:protos-27.2.2.jar:02482564443c294dfe87c5f2b25387f724a698a09ed58e0cf0127400caa35a19',
|
'com.android.tools.analytics-library:protos:26.5.1:protos-26.5.1.jar:8dde1130725461fe827f2a343d353f2b51e8870661fc860d7d5ebddb097ead4e',
|
||||||
'com.android.tools.analytics-library:shared:27.2.2:shared-27.2.2.jar:0efe017ca17ee775c5af386475a09799a1282faa04821d54810c1a34f6348d9c',
|
'com.android.tools.analytics-library:shared:26.5.1:shared-26.5.1.jar:ccc2f3b00ec17b11401610ba68553544fc8fc517120e84439ac6eb86b875e18d',
|
||||||
'com.android.tools.analytics-library:tracker:27.2.2:tracker-27.2.2.jar:62489d84192dc06219664945c43201654ff85c3b715f46550751512a880d0e39',
|
'com.android.tools.analytics-library:tracker:26.5.1:tracker-26.5.1.jar:3a76984c0fe2e847ca7a8b35b4780ef0447a9d1666946cb8e60466318e0ab5ae',
|
||||||
'com.android.tools.build:aapt2-proto:4.1.0-alpha01-6193524:aapt2-proto-4.1.0-alpha01-6193524.jar:17e75523e1e92dd4f222c7368ee41df9e964a508232f591e265d0c499baf9dca',
|
'com.android.tools.build:aapt2-proto:0.4.0:aapt2-proto-0.4.0.jar:fac0435e08898f89eeeb9ca236bea707155ff816c12205ced285ad53604133ca',
|
||||||
'com.android.tools.build:apksig:4.2.2:apksig-4.2.2.jar:632690bf641b429dcb31650e6b2f6a2e87c4ac8afd45a6ba3cbc99fb1612178f',
|
'com.android.tools.build:apksig:3.5.1:apksig-3.5.1.jar:1fd33e7f009a2a0da766cfeec4211a09f548034b015c289a66d75dd8a9302f4a',
|
||||||
'com.android.tools.build:apkzlib:4.2.2:apkzlib-4.2.2.jar:3b5167c1265e97f65201c4d2be6a6f72165a3aa2fe9e0594a59b67af9e9e97b9',
|
'com.android.tools.build:apkzlib:3.5.1:apkzlib-3.5.1.jar:9f330167cbe973b7db407692f74f4f6453b7ffa5f2048934b06280c2ceee60fa',
|
||||||
'com.android.tools.build:builder-model:4.2.2:builder-model-4.2.2.jar:41868de0cb88ae70b828eee4191c13e0233f433abb1becdf6a2bd391bd446bc0',
|
'com.android.tools.build:builder-model:3.5.1:builder-model-3.5.1.jar:39ea3c82b76b6e0c9f9fa88d93e0edc1dd4a0f1dfae0ef6fbf2d451da47e5450',
|
||||||
'com.android.tools.build:builder-test-api:4.2.2:builder-test-api-4.2.2.jar:2f305c6d3a7b637d736b821bad372dcabd959e979f2065a9f65bac1e7b4d1875',
|
'com.android.tools.build:builder-test-api:3.5.1:builder-test-api-3.5.1.jar:a1b59305584cbcaa078fdc9cfb80871012755b822dd32e8da19add6f7bbcb762',
|
||||||
'com.android.tools.build:builder:4.2.2:builder-4.2.2.jar:40fedd0d16db8f34ddb4eaf812d966b90ef1764f65cf119030442823bcf995cd',
|
'com.android.tools.build:builder:3.5.1:builder-3.5.1.jar:e3a8d382434c5f60990730c4719fc814e85a898a33a1e96c1df8d627d3c6eea6',
|
||||||
'com.android.tools.build:gradle-api:4.2.2:gradle-api-4.2.2.jar:dd4ef35bbbfb8fc2d20e3311c76b516bc1672e82b61cb3a59fc877da0f9b4f61',
|
'com.android.tools.build:gradle-api:3.5.1:gradle-api-3.5.1.jar:be9b41859bace11998f66b04ed944f87e413f3ad6da3c4665587699da125addc',
|
||||||
'com.android.tools.build:manifest-merger:27.2.2:manifest-merger-27.2.2.jar:971974756f32d9e94c857d92772b1499b0b0f5d9c70cb8ebbd20d9bbf804a923',
|
'com.android.tools.build:manifest-merger:26.5.1:manifest-merger-26.5.1.jar:dcad9ecb967251f4d750f55a4204a2b400e8fbfe5cb930a1d0d5dbe10ae8bdfc',
|
||||||
'com.android.tools.ddms:ddmlib:27.2.2:ddmlib-27.2.2.jar:9ab0f9b58737c316af454184705854c75936ca3531f21acc29bd68a3343334d1',
|
'com.android.tools.ddms:ddmlib:26.5.1:ddmlib-26.5.1.jar:b081aef2a4ed3f4d47cae4cdb128469735f25a114e026d37123bf9ffdec742a8',
|
||||||
'com.android.tools.external.com-intellij:intellij-core:27.2.2:intellij-core-27.2.2.jar:01619d5dc28ec909cbdee699f1f13056e84462faf6dccf4817561293fb28bef0',
|
'com.android.tools.external.com-intellij:intellij-core:26.5.1:intellij-core-26.5.1.jar:20eced30adc124805bd93488d9cd9d3e33e6bf7b48e9fe5a703d4983f894d450',
|
||||||
'com.android.tools.external.com-intellij:kotlin-compiler:27.2.2:kotlin-compiler-27.2.2.jar:71bd460199ce7293ecc54b91a115319c1e4b585eca5a5b3699f6a406f29e626c',
|
'com.android.tools.external.com-intellij:kotlin-compiler:26.5.1:kotlin-compiler-26.5.1.jar:5aed762dd54875b77ae7018d97c05756ff0c5b9fd02ec595dd396ccd14cc22cb',
|
||||||
'com.android.tools.external.org-jetbrains:uast:27.2.2:uast-27.2.2.jar:efa59302fd433015e993143530cecb456b63d10d0b89bd1d3b1a016904338a65',
|
'com.android.tools.external.org-jetbrains:uast:26.5.1:uast-26.5.1.jar:4bc8653d6c0943f40fee963a149e36c6baa45683d2530968a13f5007e3c40740',
|
||||||
'com.android.tools.layoutlib:layoutlib-api:27.2.2:layoutlib-api-27.2.2.jar:f0901f2295d814e82ad95850ea2103dd89d8489e01727fafa55ccccc0dccd163',
|
'com.android.tools.layoutlib:layoutlib-api:26.5.1:layoutlib-api-26.5.1.jar:88732f11396c427273e515d23042e35633f4fe4295528a99b866aa2adf0efd9c',
|
||||||
'com.android.tools.lint:lint-api:27.2.2:lint-api-27.2.2.jar:1ecb5959c8e624ee49cdf9178de67bb0e823b4382ed253410eb36afe5c458b05',
|
'com.android.tools.lint:lint-api:26.5.1:lint-api-26.5.1.jar:ec33fcd72bfaf70dd841e03fbfd93f109c2e575aec146067c606689c3972f0de',
|
||||||
'com.android.tools.lint:lint-checks:27.2.2:lint-checks-27.2.2.jar:989e545a6b5e398e63a9f3608da02d6111f2241faec1baa0a3b4492cb03aeaf2',
|
'com.android.tools.lint:lint-checks:26.5.1:lint-checks-26.5.1.jar:a1b9607d484aaae7a71dcecdc76f8003d8239af226c776894a2cf63f9e6c60d7',
|
||||||
'com.android.tools.lint:lint-gradle-api:27.2.2:lint-gradle-api-27.2.2.jar:2be9c69d6fbbfb012ff6521fdfcb22eb7cfaa57d108e07bb1d4143dae9c1b433',
|
'com.android.tools.lint:lint-gradle-api:26.5.1:lint-gradle-api-26.5.1.jar:82453fd98a8394cc84ed995c04d2cd744abd1d6589403427ba7eef53115406f3',
|
||||||
'com.android.tools.lint:lint-gradle:27.2.2:lint-gradle-27.2.2.jar:742dedd5ccb459a245a35bf4fa16dfecc762da1a6b1741332cfe5228e812301a',
|
'com.android.tools.lint:lint-gradle:26.5.1:lint-gradle-26.5.1.jar:59465b56cf7db77c656d5f8195d721c3d48b6bdd0502d774de335bfe4baff00b',
|
||||||
'com.android.tools.lint:lint-model:27.2.2:lint-model-27.2.2.jar:ee31012586462bea2d591b6175934e5f29b6f781a78fda50f79387972364b9ab',
|
'com.android.tools.lint:lint:26.5.1:lint-26.5.1.jar:336e4b04ec6f8b0f25879131b7a7862d77df83a1879ee5b71be26128755f8e2e',
|
||||||
'com.android.tools.lint:lint:27.2.2:lint-27.2.2.jar:7247016af7fba8cabee6ae887515b144f5a2ff7823422654daf23be9202f8fb1',
|
'com.android.tools:annotations:26.5.1:annotations-26.5.1.jar:2c43c82f8c59d8f7a61e3239e1a2dc9f69dc342ec09af9b7c9f69b25337c0b6e',
|
||||||
'com.android.tools:annotations:27.2.2:annotations-27.2.2.jar:9375fb2df5c0cf1b46fef9e65b3a27ac88925ccf90054b19ae0ca0adc7036fe1',
|
'com.android.tools:common:26.5.1:common-26.5.1.jar:eccfa54486ed54c4e3123cc42195d023bd0dd21bcd2f0e4868e8c6fc70f8ef6b',
|
||||||
'com.android.tools:common:27.2.2:common-27.2.2.jar:a76f4e10cad39bed317be031fee915d280aa8bc11616c58ab94e051b1e38769d',
|
'com.android.tools:dvlib:26.5.1:dvlib-26.5.1.jar:46f93ad498b4756e7d867d2fe38c38890a80e7407a4ae459e4a8c8d5c5aeacfe',
|
||||||
'com.android.tools:dvlib:27.2.2:dvlib-27.2.2.jar:9931c6b57460b5f8cc2613ca5ff8596aa089a67655ace13d173f90538ecb4301',
|
'com.android.tools:repository:26.5.1:repository-26.5.1.jar:2b3ee791aa4c3e8ce60498c161a27ca7228816fc630eed4d9f25f2f36a106dce',
|
||||||
'com.android.tools:repository:27.2.2:repository-27.2.2.jar:ac5f9b19dc5d9d08e80b57da76059f5760ca76c221e40ffd4bf43d7b13991674',
|
'com.android.tools:sdk-common:26.5.1:sdk-common-26.5.1.jar:365f749676c3574676fd465177c8a492f340816db2b520d6ed114d3b6e77bea7',
|
||||||
'com.android.tools:sdk-common:27.2.2:sdk-common-27.2.2.jar:b147acc13850808d61fc391ccfeeebdf90841b461a7042acb2d92e466da8e674',
|
'com.android.tools:sdklib:26.5.1:sdklib-26.5.1.jar:007da104afb27c8c682a1628023fe9ec438249c8d15ef0fd6624c5bb8e23b696',
|
||||||
'com.android.tools:sdklib:27.2.2:sdklib-27.2.2.jar:fae0bafbe8b4f546cf64986a22b7d8ed108d45519366ff22f0170a9cf3ea7f34',
|
|
||||||
'com.android:signflinger:4.2.2:signflinger-4.2.2.jar:4d7aafd9666707b483b1ad2c466824287cf2e379dda1d204dd3b7e453ffcf760',
|
|
||||||
'com.android:zipflinger:4.2.2:zipflinger-4.2.2.jar:8e4677086c9a8f4a67374a4edc31db7e481f0d9b85907263c51ca72452c23a93',
|
|
||||||
'com.google.code.findbugs:annotations:3.0.1:annotations-3.0.1.jar:6b47ff0a6de0ce17cbedc3abb0828ca5bce3009d53ea47b3723ff023c4742f79',
|
|
||||||
'com.google.code.findbugs:jsr305:3.0.2:jsr305-3.0.2.jar:766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7',
|
'com.google.code.findbugs:jsr305:3.0.2:jsr305-3.0.2.jar:766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7',
|
||||||
'com.google.code.gson:gson:2.8.6:gson-2.8.6.jar:c8fb4839054d280b3033f800d1f5a97de2f028eb8ba2eb458ad287e536f3f25f',
|
'com.google.code.gson:gson:2.8.5:gson-2.8.5.jar:233a0149fc365c9f6edbd683cfe266b19bdc773be98eabdaf6b3c924b48e7d81',
|
||||||
'com.google.dagger:dagger-compiler:2.24:dagger-compiler-2.24.jar:3c5afb955fb188da485cb2c048eff37dce0e1530b9780a0f2f7187d16d1ccc1f',
|
'com.google.dagger:dagger-compiler:2.24:dagger-compiler-2.24.jar:3c5afb955fb188da485cb2c048eff37dce0e1530b9780a0f2f7187d16d1ccc1f',
|
||||||
'com.google.dagger:dagger-producers:2.24:dagger-producers-2.24.jar:f10f45b95191954d5d6b043fca9e62fb621d21bf70634b8f8476c7988b504c3a',
|
'com.google.dagger:dagger-producers:2.24:dagger-producers-2.24.jar:f10f45b95191954d5d6b043fca9e62fb621d21bf70634b8f8476c7988b504c3a',
|
||||||
'com.google.dagger:dagger-spi:2.24:dagger-spi-2.24.jar:c038445d14dbcb4054e61bf49e05009edf26fce4fdc7ec1a9db544784f68e718',
|
'com.google.dagger:dagger-spi:2.24:dagger-spi-2.24.jar:c038445d14dbcb4054e61bf49e05009edf26fce4fdc7ec1a9db544784f68e718',
|
||||||
'com.google.dagger:dagger:2.24:dagger-2.24.jar:550a6e46a6dfcdf1d764887b6090cea94f783327e50e5c73754f18facfc70b64',
|
'com.google.dagger:dagger:2.24:dagger-2.24.jar:550a6e46a6dfcdf1d764887b6090cea94f783327e50e5c73754f18facfc70b64',
|
||||||
'com.google.errorprone:error_prone_annotations:2.2.0:error_prone_annotations-2.2.0.jar:6ebd22ca1b9d8ec06d41de8d64e0596981d9607b42035f9ed374f9de271a481a',
|
'com.google.errorprone:error_prone_annotations:2.2.0:error_prone_annotations-2.2.0.jar:6ebd22ca1b9d8ec06d41de8d64e0596981d9607b42035f9ed374f9de271a481a',
|
||||||
'com.google.errorprone:error_prone_annotations:2.3.2:error_prone_annotations-2.3.2.jar:357cd6cfb067c969226c442451502aee13800a24e950fdfde77bcdb4565a668d',
|
|
||||||
'com.google.errorprone:javac-shaded:9-dev-r4023-3:javac-shaded-9-dev-r4023-3.jar:65bfccf60986c47fbc17c9ebab0be626afc41741e0a6ec7109e0768817a36f30',
|
'com.google.errorprone:javac-shaded:9-dev-r4023-3:javac-shaded-9-dev-r4023-3.jar:65bfccf60986c47fbc17c9ebab0be626afc41741e0a6ec7109e0768817a36f30',
|
||||||
'com.google.googlejavaformat:google-java-format:1.5:google-java-format-1.5.jar:aa19ad7850fb85178aa22f2fddb163b84d6ce4d0035872f30d4408195ca1144e',
|
'com.google.googlejavaformat:google-java-format:1.5:google-java-format-1.5.jar:aa19ad7850fb85178aa22f2fddb163b84d6ce4d0035872f30d4408195ca1144e',
|
||||||
'com.google.guava:failureaccess:1.0.1:failureaccess-1.0.1.jar:a171ee4c734dd2da837e4b16be9df4661afab72a41adaf31eb84dfdaf936ca26',
|
'com.google.guava:failureaccess:1.0.1:failureaccess-1.0.1.jar:a171ee4c734dd2da837e4b16be9df4661afab72a41adaf31eb84dfdaf936ca26',
|
||||||
|
'com.google.guava:guava:27.0.1-jre:guava-27.0.1-jre.jar:e1c814fd04492a27c38e0317eabeaa1b3e950ec8010239e400fe90ad6c9107b4',
|
||||||
'com.google.guava:guava:27.1-jre:guava-27.1-jre.jar:4a5aa70cc968a4d137e599ad37553e5cfeed2265e8c193476d7119036c536fe7',
|
'com.google.guava:guava:27.1-jre:guava-27.1-jre.jar:4a5aa70cc968a4d137e599ad37553e5cfeed2265e8c193476d7119036c536fe7',
|
||||||
'com.google.guava:guava:28.1-jre:guava-28.1-jre.jar:30beb8b8527bd07c6e747e77f1a92122c2f29d57ce347461a4a55eb26e382da4',
|
|
||||||
'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava:listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:b372a037d4230aa57fbeffdef30fd6123f9c0c2db85d0aced00c91b974f33f99',
|
'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava:listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:b372a037d4230aa57fbeffdef30fd6123f9c0c2db85d0aced00c91b974f33f99',
|
||||||
'com.google.j2objc:j2objc-annotations:1.1:j2objc-annotations-1.1.jar:2994a7eb78f2710bd3d3bfb639b2c94e219cedac0d4d084d516e78c16dddecf6',
|
'com.google.j2objc:j2objc-annotations:1.1:j2objc-annotations-1.1.jar:2994a7eb78f2710bd3d3bfb639b2c94e219cedac0d4d084d516e78c16dddecf6',
|
||||||
'com.google.j2objc:j2objc-annotations:1.3:j2objc-annotations-1.3.jar:21af30c92267bd6122c0e0b4d20cccb6641a37eaf956c6540ec471d584e64a7b',
|
|
||||||
'com.google.jimfs:jimfs:1.1:jimfs-1.1.jar:c4828e28d7c0a930af9387510b3bada7daa5c04d7c25a75c7b8b081f1c257ddd',
|
'com.google.jimfs:jimfs:1.1:jimfs-1.1.jar:c4828e28d7c0a930af9387510b3bada7daa5c04d7c25a75c7b8b081f1c257ddd',
|
||||||
'com.google.protobuf:protobuf-java:3.10.0:protobuf-java-3.10.0.jar:161d7d61a8cb3970891c299578702fd079646e032329d6c2cabf998d191437c9',
|
'com.google.protobuf:protobuf-java:3.4.0:protobuf-java-3.4.0.jar:dce7e66b32456a1b1198da0caff3a8acb71548658391e798c79369241e6490a4',
|
||||||
'com.googlecode.json-simple:json-simple:1.1:json-simple-1.1.jar:2d9484f4c649f708f47f9a479465fc729770ee65617dca3011836602264f6439',
|
'com.googlecode.json-simple:json-simple:1.1:json-simple-1.1.jar:2d9484f4c649f708f47f9a479465fc729770ee65617dca3011836602264f6439',
|
||||||
'com.squareup:javapoet:1.11.1:javapoet-1.11.1.jar:9cbf2107be499ec6e95afd36b58e3ca122a24166cdd375732e51267d64058e90',
|
'com.squareup:javapoet:1.11.1:javapoet-1.11.1.jar:9cbf2107be499ec6e95afd36b58e3ca122a24166cdd375732e51267d64058e90',
|
||||||
'com.squareup:javawriter:2.5.0:javawriter-2.5.0.jar:fcfb09fb0ea0aa97d3cfe7ea792398081348e468f126b3603cb3803f240197f0',
|
'com.squareup:javawriter:2.5.0:javawriter-2.5.0.jar:fcfb09fb0ea0aa97d3cfe7ea792398081348e468f126b3603cb3803f240197f0',
|
||||||
'com.sun.activation:javax.activation:1.2.0:javax.activation-1.2.0.jar:993302b16cd7056f21e779cc577d175a810bb4900ef73cd8fbf2b50f928ba9ce',
|
'com.sun.activation:javax.activation:1.2.0:javax.activation-1.2.0.jar:993302b16cd7056f21e779cc577d175a810bb4900ef73cd8fbf2b50f928ba9ce',
|
||||||
'com.sun.istack:istack-commons-runtime:3.0.8:istack-commons-runtime-3.0.8.jar:4ffabb06be454a05e4398e20c77fa2b6308d4b88dfbef7ca30a76b5b7d5505ef',
|
'com.sun.istack:istack-commons-runtime:2.21:istack-commons-runtime-2.21.jar:c33e67a0807095f02a0e2da139412dd7c4f9cc1a4c054b3e434f96831ba950f4',
|
||||||
'com.sun.xml.fastinfoset:FastInfoset:1.2.16:FastInfoset-1.2.16.jar:056f3a1e144409f21ed16afc26805f58e9a21f3fce1543c42d400719d250c511',
|
'com.sun.xml.fastinfoset:FastInfoset:1.2.13:FastInfoset-1.2.13.jar:27a77db909f3c2833c0b1a37c55af1db06045118ad2eed96ce567b6632bce038',
|
||||||
'commons-codec:commons-codec:1.10:commons-codec-1.10.jar:4241dfa94e711d435f29a4604a3e2de5c4aa3c165e23bd066be6fc1fc4309569',
|
'commons-codec:commons-codec:1.10:commons-codec-1.10.jar:4241dfa94e711d435f29a4604a3e2de5c4aa3c165e23bd066be6fc1fc4309569',
|
||||||
'commons-logging:commons-logging:1.2:commons-logging-1.2.jar:daddea1ea0be0f56978ab3006b8ac92834afeefbd9b7e4e6316fca57df0fa636',
|
'commons-logging:commons-logging:1.2:commons-logging-1.2.jar:daddea1ea0be0f56978ab3006b8ac92834afeefbd9b7e4e6316fca57df0fa636',
|
||||||
'it.unimi.dsi:fastutil:8.4.0:fastutil-8.4.0.jar:2ad2824a4a0a0eb836b52ee2fc84ba2134f44bce7bfa54015ae3f31c710a3071',
|
'it.unimi.dsi:fastutil:7.2.0:fastutil-7.2.0.jar:74fa208043740642f7e6eb09faba15965218ad2f50ce3020efb100136e4b591c',
|
||||||
'jakarta.activation:jakarta.activation-api:1.2.1:jakarta.activation-api-1.2.1.jar:8b0a0f52fa8b05c5431921a063ed866efaa41dadf2e3a7ee3e1961f2b0d9645b',
|
|
||||||
'jakarta.xml.bind:jakarta.xml.bind-api:2.3.2:jakarta.xml.bind-api-2.3.2.jar:69156304079bdeed9fc0ae3b39389f19b3cc4ba4443bc80508995394ead742ea',
|
|
||||||
'javax.annotation:jsr250-api:1.0:jsr250-api-1.0.jar:a1a922d0d9b6d183ed3800dfac01d1e1eb159f0e8c6f94736931c1def54a941f',
|
'javax.annotation:jsr250-api:1.0:jsr250-api-1.0.jar:a1a922d0d9b6d183ed3800dfac01d1e1eb159f0e8c6f94736931c1def54a941f',
|
||||||
'javax.inject:javax.inject:1:javax.inject-1.jar:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
|
'javax.inject:javax.inject:1:javax.inject-1.jar:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
|
||||||
|
'javax.xml.bind:jaxb-api:2.2.12-b140109.1041:jaxb-api-2.2.12-b140109.1041.jar:b5e60cd8b7b5ff01ce4a74c5dd008f4fbd14ced3495d0b47b85cfedc182211f2',
|
||||||
'junit:junit:4.12:junit-4.12.jar:59721f0805e223d84b90677887d9ff567dc534d7c502ca903c0c2b17f05c116a',
|
'junit:junit:4.12:junit-4.12.jar:59721f0805e223d84b90677887d9ff567dc534d7c502ca903c0c2b17f05c116a',
|
||||||
'net.bytebuddy:byte-buddy:1.9.12:byte-buddy-1.9.12.jar:3688c3d434bebc3edc5516296a2ed0f47b65e451071b4afecad84f902f0efc11',
|
|
||||||
'net.java.dev.jna:jna-platform:5.6.0:jna-platform-5.6.0.jar:9ecea8bf2b1b39963939d18b70464eef60c508fed8820f9dcaba0c35518eabf7',
|
|
||||||
'net.java.dev.jna:jna:5.6.0:jna-5.6.0.jar:5557e235a8aa2f9766d5dc609d67948f2a8832c2d796cea9ef1d6cbe0b3b7eaf',
|
|
||||||
'net.jcip:jcip-annotations:1.0:jcip-annotations-1.0.jar:be5805392060c71474bf6c9a67a099471274d30b83eef84bfc4e0889a4f1dcc0',
|
|
||||||
'net.ltgt.gradle.incap:incap:0.2:incap-0.2.jar:b625b9806b0f1e4bc7a2e3457119488de3cd57ea20feedd513db070a573a4ffd',
|
'net.ltgt.gradle.incap:incap:0.2:incap-0.2.jar:b625b9806b0f1e4bc7a2e3457119488de3cd57ea20feedd513db070a573a4ffd',
|
||||||
'net.sf.jopt-simple:jopt-simple:4.9:jopt-simple-4.9.jar:26c5856e954b5f864db76f13b86919b59c6eecf9fd930b96baa8884626baf2f5',
|
'net.sf.jopt-simple:jopt-simple:4.9:jopt-simple-4.9.jar:26c5856e954b5f864db76f13b86919b59c6eecf9fd930b96baa8884626baf2f5',
|
||||||
'net.sf.kxml:kxml2:2.3.0:kxml2-2.3.0.jar:f264dd9f79a1fde10ce5ecc53221eff24be4c9331c830b7d52f2f08a7b633de2',
|
'net.sf.kxml:kxml2:2.3.0:kxml2-2.3.0.jar:f264dd9f79a1fde10ce5ecc53221eff24be4c9331c830b7d52f2f08a7b633de2',
|
||||||
'org.apache-extras.beanshell:bsh:2.0b6:bsh-2.0b6.jar:a17955976070c0573235ee662f2794a78082758b61accffce8d3f8aedcd91047',
|
'org.apache.ant:ant-launcher:1.9.4:ant-launcher-1.9.4.jar:7bccea20b41801ca17bcbc909a78c835d0f443f12d639c77bd6ae3d05861608d',
|
||||||
|
'org.apache.ant:ant:1.9.4:ant-1.9.4.jar:649ae0730251de07b8913f49286d46bba7b92d47c5f332610aa426c4f02161d8',
|
||||||
'org.apache.commons:commons-compress:1.12:commons-compress-1.12.jar:2c1542faf343185b7cab9c3d55c8ae5471d6d095d3887a4adefdbdf2984dc0b6',
|
'org.apache.commons:commons-compress:1.12:commons-compress-1.12.jar:2c1542faf343185b7cab9c3d55c8ae5471d6d095d3887a4adefdbdf2984dc0b6',
|
||||||
'org.apache.httpcomponents:httpclient:4.5.6:httpclient-4.5.6.jar:c03f813195e7a80e3608d0ddd8da80b21696a4c92a6a2298865bf149071551c7',
|
'org.apache.httpcomponents:httpclient:4.5.6:httpclient-4.5.6.jar:c03f813195e7a80e3608d0ddd8da80b21696a4c92a6a2298865bf149071551c7',
|
||||||
'org.apache.httpcomponents:httpcore:4.4.10:httpcore-4.4.10.jar:78ba1096561957db1b55200a159b648876430342d15d461277e62360da19f6fd',
|
'org.apache.httpcomponents:httpcore:4.4.10:httpcore-4.4.10.jar:78ba1096561957db1b55200a159b648876430342d15d461277e62360da19f6fd',
|
||||||
'org.apache.httpcomponents:httpmime:4.5.6:httpmime-4.5.6.jar:0b2b1102c18d3c7e05a77214b9b7501a6f6056174ae5604e0e256776eda7553e',
|
'org.apache.httpcomponents:httpmime:4.5.6:httpmime-4.5.6.jar:0b2b1102c18d3c7e05a77214b9b7501a6f6056174ae5604e0e256776eda7553e',
|
||||||
|
'org.beanshell:bsh:1.3.0:bsh-1.3.0.jar:9b04edc75d19db54f1b4e8b5355e9364384c6cf71eb0a1b9724c159d779879f8',
|
||||||
'org.bouncycastle:bcpkix-jdk15on:1.56:bcpkix-jdk15on-1.56.jar:7043dee4e9e7175e93e0b36f45b1ec1ecb893c5f755667e8b916eb8dd201c6ca',
|
'org.bouncycastle:bcpkix-jdk15on:1.56:bcpkix-jdk15on-1.56.jar:7043dee4e9e7175e93e0b36f45b1ec1ecb893c5f755667e8b916eb8dd201c6ca',
|
||||||
'org.bouncycastle:bcprov-jdk15on:1.56:bcprov-jdk15on-1.56.jar:963e1ee14f808ffb99897d848ddcdb28fa91ddda867eb18d303e82728f878349',
|
'org.bouncycastle:bcprov-jdk15on:1.56:bcprov-jdk15on-1.56.jar:963e1ee14f808ffb99897d848ddcdb28fa91ddda867eb18d303e82728f878349',
|
||||||
'org.briarproject:obfs4proxy-android:0.0.12-dev-40245c4a:obfs4proxy-android-0.0.12-dev-40245c4a.zip:8ab05a8f8391be2cb5ab2b665c281a06d9e3a756bd0f95a40a36ca927866ea82',
|
'org.briarproject:obfs4proxy-android:0.0.11-2:obfs4proxy-android-0.0.11-2.zip:57e55cbe87aa2aac210fdbb6cd8cdeafe15f825406a08ebf77a8b787aa2c6a8a',
|
||||||
'org.briarproject:tor-android:0.3.5.13:tor-android-0.3.5.13.zip:e0978db136731dae07774b722970cdae1e462fb5adc82845dd80a7e2d87f356c',
|
'org.briarproject:tor-android:0.3.5.10:tor-android-0.3.5.10.zip:edd83bf557fcff2105eaa0bdb3f607a6852ebe7360920929ae3039dd5f4774c5',
|
||||||
'org.checkerframework:checker-compat-qual:2.5.3:checker-compat-qual-2.5.3.jar:d76b9afea61c7c082908023f0cbc1427fab9abd2df915c8b8a3e7a509bccbc6d',
|
'org.checkerframework:checker-compat-qual:2.5.3:checker-compat-qual-2.5.3.jar:d76b9afea61c7c082908023f0cbc1427fab9abd2df915c8b8a3e7a509bccbc6d',
|
||||||
'org.checkerframework:checker-qual:2.5.2:checker-qual-2.5.2.jar:64b02691c8b9d4e7700f8ee2e742dce7ea2c6e81e662b7522c9ee3bf568c040a',
|
'org.checkerframework:checker-qual:2.5.2:checker-qual-2.5.2.jar:64b02691c8b9d4e7700f8ee2e742dce7ea2c6e81e662b7522c9ee3bf568c040a',
|
||||||
'org.checkerframework:checker-qual:2.8.1:checker-qual-2.8.1.jar:9103499008bcecd4e948da29b17864abb64304e15706444ae209d17ebe0575df',
|
|
||||||
'org.codehaus.groovy:groovy-all:2.4.15:groovy-all-2.4.15.jar:51d6c4e71782e85674239189499854359d380fb75e1a703756e3aaa5b98a5af0',
|
'org.codehaus.groovy:groovy-all:2.4.15:groovy-all-2.4.15.jar:51d6c4e71782e85674239189499854359d380fb75e1a703756e3aaa5b98a5af0',
|
||||||
'org.codehaus.mojo:animal-sniffer-annotations:1.17:animal-sniffer-annotations-1.17.jar:92654f493ecfec52082e76354f0ebf87648dc3d5cec2e3c3cdb947c016747a53',
|
'org.codehaus.mojo:animal-sniffer-annotations:1.17:animal-sniffer-annotations-1.17.jar:92654f493ecfec52082e76354f0ebf87648dc3d5cec2e3c3cdb947c016747a53',
|
||||||
'org.codehaus.mojo:animal-sniffer-annotations:1.18:animal-sniffer-annotations-1.18.jar:47f05852b48ee9baefef80fa3d8cea60efa4753c0013121dd7fe5eef2e5c729d',
|
'org.glassfish.jaxb:jaxb-core:2.2.11:jaxb-core-2.2.11.jar:37bcaee8ebb04362c8352a5bf6221b86967ecdab5164c696b10b9a2bb587b2aa',
|
||||||
'org.glassfish.jaxb:jaxb-runtime:2.3.2:jaxb-runtime-2.3.2.jar:e6e0a1e89fb6ff786279e6a0082d5cef52dc2ebe67053d041800737652b4fd1b',
|
'org.glassfish.jaxb:jaxb-runtime:2.2.11:jaxb-runtime-2.2.11.jar:a874f2351cfba8e2946be3002d10c18a6da8f21b52ba2acf52f2b85d5520ed70',
|
||||||
'org.glassfish.jaxb:txw2:2.3.2:txw2-2.3.2.jar:4a6a9f483388d461b81aa9a28c685b8b74c0597993bf1884b04eddbca95f48fe',
|
'org.glassfish.jaxb:txw2:2.2.11:txw2-2.2.11.jar:272a3ccad45a4511351920cd2a8633c53cab8d5220c7a92954da5526bb5eafea',
|
||||||
'org.hamcrest:hamcrest-core:2.1:hamcrest-core-2.1.jar:e09109e54a289d88506b9bfec987ddd199f4217c9464132668351b9a4f00bee9',
|
'org.hamcrest:hamcrest-core:1.3:hamcrest-core-1.3.jar:66fdef91e9739348df7a096aa384a5685f4e875584cce89386a7a47251c4d8e9',
|
||||||
'org.hamcrest:hamcrest-library:2.1:hamcrest-library-2.1.jar:b7e2b6895b3b679f0e47b6380fda391b225e9b78505db9d8bdde8d3cc8d52a21',
|
'org.hamcrest:hamcrest-library:1.3:hamcrest-library-1.3.jar:711d64522f9ec410983bd310934296da134be4254a125080a0416ec178dfad1c',
|
||||||
'org.hamcrest:hamcrest:2.1:hamcrest-2.1.jar:ba93b2e3a562322ba432f0a1b53addcc55cb188253319a020ed77f824e692050',
|
'org.jetbrains.kotlin:kotlin-reflect:1.3.50:kotlin-reflect-1.3.50.jar:64583199ea5a54aefd1bd1595288925f784226ee562d1dd279011c6075b3d7a4',
|
||||||
'org.jetbrains.intellij.deps:trove4j:1.0.20181211:trove4j-1.0.20181211.jar:affb7c85a3c87bdcf69ff1dbb84de11f63dc931293934bc08cd7ab18de083601',
|
'org.jetbrains.kotlin:kotlin-stdlib-common:1.3.50:kotlin-stdlib-common-1.3.50.jar:8ce678e88e4ba018b66dacecf952471e4d7dfee156a8a819760a5a5ff29d323c',
|
||||||
'org.jetbrains.kotlin:kotlin-reflect:1.4.31:kotlin-reflect-1.4.31.jar:91fad0b42974a7d5811e30a61f05706e176b144235717c6de7e81e3a781028f2',
|
'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50:kotlin-stdlib-jdk7-1.3.50.jar:9a026639e76212f8d57b86d55b075394c2e009f1979110751d34c05c5f75d57b',
|
||||||
'org.jetbrains.kotlin:kotlin-stdlib-common:1.4.31:kotlin-stdlib-common-1.4.31.jar:57962f44371a746b678218a0802a8712c6255206de9a69ede215e3aa4b044708',
|
'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.50:kotlin-stdlib-jdk8-1.3.50.jar:1b351fb6e09c14b55525c74c1f4cf48942eae43c348b7bc764a5e6e423d4da0c',
|
||||||
'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.31:kotlin-stdlib-jdk7-1.4.31.jar:1f966e54e86cf4b7d7014afdce04e0f3ee4625084cda3494edccc7b84af52664',
|
'org.jetbrains.kotlin:kotlin-stdlib:1.3.50:kotlin-stdlib-1.3.50.jar:e6f05746ee0366d0b52825a090fac474dcf44082c9083bbb205bd16976488d6c',
|
||||||
'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.31:kotlin-stdlib-jdk8-1.4.31.jar:b2f8364435ebcb0106ff9d4415a11ffdef8ec7786ee6e5ed465a01556cbd1683',
|
'org.jetbrains.trove4j:trove4j:20160824:trove4j-20160824.jar:1917871c8deb468307a584680c87a44572f5a8b0b98c6d397fc0f5f86596dbe7',
|
||||||
'org.jetbrains.kotlin:kotlin-stdlib:1.4.31:kotlin-stdlib-1.4.31.jar:76a599d88b167e8ac90879b6daa722c6ad3452ba714c9aba19bd196544b97f1c',
|
|
||||||
'org.jetbrains:annotations:13.0:annotations-13.0.jar:ace2a10dc8e2d5fd34925ecac03e4988b2c0f851650c94b8cef49ba1bd111478',
|
'org.jetbrains:annotations:13.0:annotations-13.0.jar:ace2a10dc8e2d5fd34925ecac03e4988b2c0f851650c94b8cef49ba1bd111478',
|
||||||
'org.jmock:jmock-imposters:2.12.0:jmock-imposters-2.12.0.jar:3b836269745a137c9b2347e8d7c2104845b126ef04f012d6bfd94f1a7dea7b09',
|
'org.jmock:jmock-junit4:2.8.2:jmock-junit4-2.8.2.jar:f7ee4df4f7bd7b7f1cafad3b99eb74d579f109d5992ff625347352edb55e674c',
|
||||||
'org.jmock:jmock-junit4:2.12.0:jmock-junit4-2.12.0.jar:3233062fc889637c151a24f1ee086bad04321ab7d8264fef279daff0fa27205b',
|
'org.jmock:jmock-legacy:2.8.2:jmock-legacy-2.8.2.jar:f2b985a5c08a9edb7f37612330c058809da3f6a6d63ce792426ebf8ff0d6d31b',
|
||||||
'org.jmock:jmock-legacy:2.12.0:jmock-legacy-2.12.0.jar:dea3a9cca653d082e2fe7e40232e982fe03a9984c7d67ceff24f3e03fe580dcd',
|
'org.jmock:jmock-testjar:2.8.2:jmock-testjar-2.8.2.jar:8900860f72c474e027cf97fe78dcbf154a1aa7fc62b6845c5fb4e4f3c7bc8760',
|
||||||
'org.jmock:jmock-testjar:2.12.0:jmock-testjar-2.12.0.jar:efefbcf6cd294d0e29f0c46eb2a3380d4ca4e1763ff719c69e2f2ac62f564a04',
|
'org.jmock:jmock:2.8.2:jmock-2.8.2.jar:6c73cb4a2e6dbfb61fd99c9a768539c170ab6568e57846bd60dbf19596b65b16',
|
||||||
'org.jmock:jmock:2.12.0:jmock-2.12.0.jar:266d07314c0cd343c46ff8a55601272de8cf406807caf55e6f313295f83d10be',
|
'org.jvnet.staxex:stax-ex:1.7.7:stax-ex-1.7.7.jar:a31ff7d77163c0deb09e7fee59ad35ae44c2cee2cc8552a116ccd1583d813fb4',
|
||||||
'org.jvnet.staxex:stax-ex:1.8.1:stax-ex-1.8.1.jar:20522549056e9e50aa35ef0b445a2e47a53d06be0b0a9467d704e2483ffb049a',
|
'org.objenesis:objenesis:2.1:objenesis-2.1.jar:c74330cc6b806c804fd37e74487b4fe5d7c2750c5e15fbc6efa13bdee1bdef80',
|
||||||
'org.objenesis:objenesis:3.0.1:objenesis-3.0.1.jar:7a8ff780b9ff48415d7c705f60030b0acaa616e7f823c98eede3b63508d4e984',
|
'org.ow2.asm:asm-analysis:6.0:asm-analysis-6.0.jar:2f1a6387219c3a6cc4856481f221b03bd9f2408a326d416af09af5d6f608c1f4',
|
||||||
'org.ow2.asm:asm-analysis:7.0:asm-analysis-7.0.jar:e981f8f650c4d900bb033650b18e122fa6b161eadd5f88978d08751f72ee8474',
|
'org.ow2.asm:asm-commons:6.0:asm-commons-6.0.jar:f1bce5c648a96a017bdcd01fe5d59af9845297fd7b79b81c015a6fbbd9719abf',
|
||||||
'org.ow2.asm:asm-commons:7.0:asm-commons-7.0.jar:fed348ef05958e3e846a3ac074a12af5f7936ef3d21ce44a62c4fa08a771927d',
|
'org.ow2.asm:asm-tree:6.0:asm-tree-6.0.jar:887998fb69727c8759e4d253f856822801e33f9fd4caa566b3ac58ee92106215',
|
||||||
'org.ow2.asm:asm-tree:7.0:asm-tree-7.0.jar:cfd7a0874f9de36a999c127feeadfbfe6e04d4a71ee954d7af3d853f0be48a6c',
|
'org.ow2.asm:asm-util:6.0:asm-util-6.0.jar:356afebdb0f870175262e5188f8709a3b17aa2a5a6a4b0340b04d4b449bca5f6',
|
||||||
'org.ow2.asm:asm-util:7.0:asm-util-7.0.jar:75fbbca440ef463f41c2b0ab1a80abe67e910ac486da60a7863cbcb5bae7e145',
|
'org.ow2.asm:asm:5.0.4:asm-5.0.4.jar:896618ed8ae62702521a78bc7be42b7c491a08e6920a15f89a3ecdec31e9a220',
|
||||||
'org.ow2.asm:asm:7.0:asm-7.0.jar:b88ef66468b3c978ad0c97fd6e90979e56155b4ac69089ba7a44e9aa7ffe9acf',
|
'org.ow2.asm:asm:6.0:asm-6.0.jar:dd8971c74a4e697899a8e95caae4ea8760ea6c486dc6b97b1795e75760420461',
|
||||||
'org.ow2.asm:asm:7.1:asm-7.1.jar:4ab2fa2b6d2cc9ccb1eaa05ea329c407b47b13ed2915f62f8c4b8cc96258d4de',
|
|
||||||
'xerces:xercesImpl:2.12.0:xercesImpl-2.12.0.jar:b50d3a4ca502faa4d1c838acb8aa9480446953421f7327e338c5dda3da5e76d0',
|
|
||||||
'xml-apis:xml-apis:1.4.01:xml-apis-1.4.01.jar:a840968176645684bb01aed376e067ab39614885f9eee44abe35a5f20ebe7fad',
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,10 @@ dependencies {
|
|||||||
implementation "com.google.dagger:dagger:2.24"
|
implementation "com.google.dagger:dagger:2.24"
|
||||||
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
||||||
|
|
||||||
testImplementation "junit:junit:$junit_version"
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation "org.jmock:jmock:$jmock_version"
|
testImplementation "org.jmock:jmock:2.8.2"
|
||||||
testImplementation "org.jmock:jmock-junit4:$jmock_version"
|
testImplementation "org.jmock:jmock-junit4:2.8.2"
|
||||||
|
testImplementation "org.jmock:jmock-legacy:2.8.2"
|
||||||
|
|
||||||
signature 'org.codehaus.mojo.signature:java16:1.1@signature'
|
signature 'org.codehaus.mojo.signature:java16:1.1@signature'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,4 @@ package org.briarproject.bramble.api;
|
|||||||
public interface FeatureFlags {
|
public interface FeatureFlags {
|
||||||
|
|
||||||
boolean shouldEnableImageAttachments();
|
boolean shouldEnableImageAttachments();
|
||||||
|
|
||||||
boolean shouldEnableProfilePictures();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package org.briarproject.bramble.api.account;
|
|||||||
|
|
||||||
import org.briarproject.bramble.api.crypto.DecryptionException;
|
import org.briarproject.bramble.api.crypto.DecryptionException;
|
||||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
import org.briarproject.bramble.api.identity.Identity;
|
|
||||||
import org.briarproject.bramble.api.identity.IdentityManager;
|
import org.briarproject.bramble.api.identity.IdentityManager;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
|
|
||||||
@@ -44,17 +43,6 @@ public interface AccountManager {
|
|||||||
*/
|
*/
|
||||||
boolean createAccount(String name, String password);
|
boolean createAccount(String name, String password);
|
||||||
|
|
||||||
/**
|
|
||||||
* Restores a given identity by registering it with the
|
|
||||||
* {@link IdentityManager}. Creates a database key, encrypts it with the
|
|
||||||
* given password and stores it on disk. {@link #accountExists()} will
|
|
||||||
* return true after this method returns true.
|
|
||||||
* @param identity
|
|
||||||
* @param password
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
boolean restoreAccount(Identity identity, String password);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes all account state from disk. {@link #accountExists()} will
|
* Deletes all account state from disk. {@link #accountExists()} will
|
||||||
* return false after this method returns.
|
* return false after this method returns.
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
package org.briarproject.bramble.api.contact;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Record types for the contact exchange protocol.
|
|
||||||
*/
|
|
||||||
public interface ContactExchangeRecordTypes {
|
|
||||||
|
|
||||||
byte CONTACT_INFO = 0;
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ package org.briarproject.bramble.api.contact;
|
|||||||
import org.briarproject.bramble.api.FormatException;
|
import org.briarproject.bramble.api.FormatException;
|
||||||
import org.briarproject.bramble.api.Pair;
|
import org.briarproject.bramble.api.Pair;
|
||||||
import org.briarproject.bramble.api.UnsupportedVersionException;
|
import org.briarproject.bramble.api.UnsupportedVersionException;
|
||||||
import org.briarproject.bramble.api.crypto.PublicKey;
|
|
||||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
import org.briarproject.bramble.api.db.ContactExistsException;
|
import org.briarproject.bramble.api.db.ContactExistsException;
|
||||||
import org.briarproject.bramble.api.db.DbException;
|
import org.briarproject.bramble.api.db.DbException;
|
||||||
@@ -12,6 +11,7 @@ import org.briarproject.bramble.api.db.PendingContactExistsException;
|
|||||||
import org.briarproject.bramble.api.db.Transaction;
|
import org.briarproject.bramble.api.db.Transaction;
|
||||||
import org.briarproject.bramble.api.identity.Author;
|
import org.briarproject.bramble.api.identity.Author;
|
||||||
import org.briarproject.bramble.api.identity.AuthorId;
|
import org.briarproject.bramble.api.identity.AuthorId;
|
||||||
|
import org.briarproject.bramble.api.identity.AuthorInfo;
|
||||||
import org.briarproject.bramble.api.lifecycle.LifecycleManager;
|
import org.briarproject.bramble.api.lifecycle.LifecycleManager;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
|
|
||||||
@@ -49,10 +49,6 @@ public interface ContactManager {
|
|||||||
SecretKey rootKey, long timestamp, boolean alice, boolean verified,
|
SecretKey rootKey, long timestamp, boolean alice, boolean verified,
|
||||||
boolean active) throws DbException;
|
boolean active) throws DbException;
|
||||||
|
|
||||||
ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
|
||||||
PublicKey handshake, boolean verified)
|
|
||||||
throws DbException, GeneralSecurityException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores a contact associated with the given local and remote pseudonyms,
|
* Stores a contact associated with the given local and remote pseudonyms,
|
||||||
* replacing the given pending contact, derives and stores handshake mode
|
* replacing the given pending contact, derives and stores handshake mode
|
||||||
@@ -183,11 +179,6 @@ public interface ContactManager {
|
|||||||
*/
|
*/
|
||||||
Collection<Contact> getContacts() throws DbException;
|
Collection<Contact> getContacts() throws DbException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns all contacts.
|
|
||||||
*/
|
|
||||||
Collection<Contact> getContacts(Transaction txn) throws DbException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a contact and all associated state.
|
* Removes a contact and all associated state.
|
||||||
*/
|
*/
|
||||||
@@ -210,19 +201,6 @@ public interface ContactManager {
|
|||||||
void setContactAlias(ContactId c, @Nullable String alias)
|
void setContactAlias(ContactId c, @Nullable String alias)
|
||||||
throws DbException;
|
throws DbException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the contact's handshake public key
|
|
||||||
*/
|
|
||||||
void setHandshakePublicKey(Transaction txn, ContactId c,
|
|
||||||
PublicKey handshakePublicKey) throws DbException,
|
|
||||||
GeneralSecurityException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the contact's handshake public key
|
|
||||||
*/
|
|
||||||
void setHandshakePublicKey(ContactId c, PublicKey handshakePublicKey)
|
|
||||||
throws DbException, GeneralSecurityException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if a contact with this {@code remoteAuthorId} belongs to
|
* Returns true if a contact with this {@code remoteAuthorId} belongs to
|
||||||
* the local pseudonym with this {@code localAuthorId}.
|
* the local pseudonym with this {@code localAuthorId}.
|
||||||
@@ -237,6 +215,16 @@ public interface ContactManager {
|
|||||||
boolean contactExists(AuthorId remoteAuthorId, AuthorId localAuthorId)
|
boolean contactExists(AuthorId remoteAuthorId, AuthorId localAuthorId)
|
||||||
throws DbException;
|
throws DbException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link AuthorInfo} for the given author.
|
||||||
|
*/
|
||||||
|
AuthorInfo getAuthorInfo(AuthorId a) throws DbException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link AuthorInfo} for the given author.
|
||||||
|
*/
|
||||||
|
AuthorInfo getAuthorInfo(Transaction txn, AuthorId a) throws DbException;
|
||||||
|
|
||||||
interface ContactHook {
|
interface ContactHook {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,19 +24,6 @@ public interface HandshakeManager {
|
|||||||
HandshakeResult handshake(PendingContactId p, InputStream in,
|
HandshakeResult handshake(PendingContactId p, InputStream in,
|
||||||
StreamWriter out) throws DbException, IOException;
|
StreamWriter out) throws DbException, IOException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Handshakes with the given contact. Returns an ephemeral master key
|
|
||||||
* authenticated with both parties' handshake key pairs and a flag
|
|
||||||
* indicating whether the local peer is Alice or Bob.
|
|
||||||
*
|
|
||||||
* @param in An incoming stream for the handshake, which must be secured in
|
|
||||||
* handshake mode
|
|
||||||
* @param out An outgoing stream for the handshake, which must be secured
|
|
||||||
* in handshake mode
|
|
||||||
*/
|
|
||||||
HandshakeResult handshake(ContactId c, InputStream in, StreamWriter out)
|
|
||||||
throws DbException, IOException;
|
|
||||||
|
|
||||||
class HandshakeResult {
|
class HandshakeResult {
|
||||||
|
|
||||||
private final SecretKey masterKey;
|
private final SecretKey masterKey;
|
||||||
|
|||||||
@@ -19,10 +19,4 @@ public interface StreamDecrypterFactory {
|
|||||||
*/
|
*/
|
||||||
StreamDecrypter createContactExchangeStreamDecrypter(InputStream in,
|
StreamDecrypter createContactExchangeStreamDecrypter(InputStream in,
|
||||||
SecretKey headerKey);
|
SecretKey headerKey);
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a {@link StreamDecrypter} for decrypting a log stream.
|
|
||||||
*/
|
|
||||||
StreamDecrypter createLogStreamDecrypter(InputStream in,
|
|
||||||
SecretKey headerKey);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,6 @@ public interface StreamEncrypterFactory {
|
|||||||
* Creates a {@link StreamEncrypter} for encrypting a contact exchange
|
* Creates a {@link StreamEncrypter} for encrypting a contact exchange
|
||||||
* stream.
|
* stream.
|
||||||
*/
|
*/
|
||||||
StreamEncrypter createContactExchangeStreamEncrypter(OutputStream out,
|
StreamEncrypter createContactExchangeStreamDecrypter(OutputStream out,
|
||||||
SecretKey headerKey);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a {@link StreamEncrypter} for encrypting a log stream.
|
|
||||||
*/
|
|
||||||
StreamEncrypter createLogStreamEncrypter(OutputStream out,
|
|
||||||
SecretKey headerKey);
|
SecretKey headerKey);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -546,11 +546,6 @@ public interface DatabaseComponent extends TransactionManager {
|
|||||||
void setContactAlias(Transaction txn, ContactId c, @Nullable String alias)
|
void setContactAlias(Transaction txn, ContactId c, @Nullable String alias)
|
||||||
throws DbException;
|
throws DbException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the remote handshake public key for a given contact
|
|
||||||
*/
|
|
||||||
void setHandshakePublicKey(Transaction txn, ContactId c, PublicKey handshakePublicKey) throws DbException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the given group's visibility to the given contact.
|
* Sets the given group's visibility to the given contact.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package org.briarproject.briar.api.identity;
|
package org.briarproject.bramble.api.identity;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.briarproject.bramble.api.nullsafety.NullSafety;
|
|
||||||
import org.briarproject.briar.api.attachment.AttachmentHeader;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.annotation.concurrent.Immutable;
|
import javax.annotation.concurrent.Immutable;
|
||||||
@@ -22,18 +20,14 @@ public class AuthorInfo {
|
|||||||
private final Status status;
|
private final Status status;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final String alias;
|
private final String alias;
|
||||||
@Nullable
|
|
||||||
private final AttachmentHeader avatarHeader;
|
|
||||||
|
|
||||||
public AuthorInfo(Status status, @Nullable String alias,
|
public AuthorInfo(Status status, @Nullable String alias) {
|
||||||
@Nullable AttachmentHeader avatarHeader) {
|
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.alias = alias;
|
this.alias = alias;
|
||||||
this.avatarHeader = avatarHeader;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuthorInfo(Status status) {
|
public AuthorInfo(Status status) {
|
||||||
this(status, null, null);
|
this(status, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Status getStatus() {
|
public Status getStatus() {
|
||||||
@@ -45,11 +39,6 @@ public class AuthorInfo {
|
|||||||
return alias;
|
return alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public AttachmentHeader getAvatarHeader() {
|
|
||||||
return avatarHeader;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hashCode = status.ordinal();
|
int hashCode = status.ordinal();
|
||||||
@@ -62,9 +51,6 @@ public class AuthorInfo {
|
|||||||
if (!(o instanceof AuthorInfo)) return false;
|
if (!(o instanceof AuthorInfo)) return false;
|
||||||
AuthorInfo info = (AuthorInfo) o;
|
AuthorInfo info = (AuthorInfo) o;
|
||||||
return status == info.status &&
|
return status == info.status &&
|
||||||
// aliases are equal
|
(alias == null ? info.alias == null : alias.equals(info.alias));
|
||||||
NullSafety.equals(alias, info.alias) &&
|
|
||||||
// avatars are equal
|
|
||||||
NullSafety.equals(avatarHeader, info.avatarHeader);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,11 +26,6 @@ public interface IdentityManager {
|
|||||||
*/
|
*/
|
||||||
void registerIdentity(Identity i);
|
void registerIdentity(Identity i);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the cached local identity or loads it from the database.
|
|
||||||
*/
|
|
||||||
Identity getIdentity(Transaction txn) throws DbException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the cached local identity or loads it from the database.
|
* Returns the cached local identity or loads it from the database.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,12 +8,11 @@ import javax.annotation.concurrent.Immutable;
|
|||||||
@NotNullByDefault
|
@NotNullByDefault
|
||||||
public class NetworkStatus {
|
public class NetworkStatus {
|
||||||
|
|
||||||
private final boolean connected, wifi, ipv6Only;
|
private final boolean connected, wifi;
|
||||||
|
|
||||||
public NetworkStatus(boolean connected, boolean wifi, boolean ipv6Only) {
|
public NetworkStatus(boolean connected, boolean wifi) {
|
||||||
this.connected = connected;
|
this.connected = connected;
|
||||||
this.wifi = wifi;
|
this.wifi = wifi;
|
||||||
this.ipv6Only = ipv6Only;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
@@ -23,8 +22,4 @@ public class NetworkStatus {
|
|||||||
public boolean isWifi() {
|
public boolean isWifi() {
|
||||||
return wifi;
|
return wifi;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIpv6Only() {
|
|
||||||
return ipv6Only;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,12 +29,4 @@ public class NullSafety {
|
|||||||
public static void requireNull(@Nullable Object o) {
|
public static void requireNull(@Nullable Object o) {
|
||||||
if (o != null) throw new AssertionError();
|
if (o != null) throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Stand-in for {@code Objects.equals()}.
|
|
||||||
*/
|
|
||||||
public static boolean equals(@Nullable Object a, @Nullable Object b) {
|
|
||||||
return (a == b) || (a != null && a.equals(b));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,13 +74,6 @@ public interface TransportPropertyManager {
|
|||||||
TransportProperties getRemoteProperties(ContactId c, TransportId t)
|
TransportProperties getRemoteProperties(ContactId c, TransportId t)
|
||||||
throws DbException;
|
throws DbException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the remote transport properties for the given contact and
|
|
||||||
* transport.
|
|
||||||
*/
|
|
||||||
TransportProperties getRemoteProperties(Transaction txn, ContactId c,
|
|
||||||
TransportId t) throws DbException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merges the given properties with the existing local properties for the
|
* Merges the given properties with the existing local properties for the
|
||||||
* given transport.
|
* given transport.
|
||||||
|
|||||||
@@ -13,6 +13,4 @@ public interface DevConfig {
|
|||||||
String getDevOnionAddress();
|
String getDevOnionAddress();
|
||||||
|
|
||||||
File getReportDir();
|
File getReportDir();
|
||||||
|
|
||||||
File getLogcatFile();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ public interface DevReporter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends any reports previously stored on disk.
|
* Sends any reports previously stored on disk.
|
||||||
*
|
|
||||||
* @return The number of reports that were sent.
|
|
||||||
*/
|
*/
|
||||||
int sendReports();
|
void sendReports();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,20 +35,6 @@ public interface KeyManager {
|
|||||||
ContactId c, SecretKey rootKey, long timestamp, boolean alice,
|
ContactId c, SecretKey rootKey, long timestamp, boolean alice,
|
||||||
boolean active) throws DbException;
|
boolean active) throws DbException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Derives and stores a set of rotation mode transport keys for
|
|
||||||
* communicating with the given contact over each transport and returns the
|
|
||||||
* key set IDs.
|
|
||||||
* <p/>
|
|
||||||
* {@link StreamContext StreamContexts} for the contact can be created
|
|
||||||
* after this method has returned.
|
|
||||||
*
|
|
||||||
* @param alice True if the local party is Alice
|
|
||||||
* @param active Whether the derived keys can be used for outgoing streams
|
|
||||||
*/
|
|
||||||
Map<TransportId, KeySetId> addRotationKeys(ContactId c, SecretKey rootKey,
|
|
||||||
long timestamp, boolean alice, boolean active) throws DbException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Informs the key manager that a new contact has been added. Derives and
|
* Informs the key manager that a new contact has been added. Derives and
|
||||||
* stores a set of handshake mode transport keys for communicating with the
|
* stores a set of handshake mode transport keys for communicating with the
|
||||||
|
|||||||
@@ -16,13 +16,8 @@ public interface StreamReaderFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an {@link InputStream InputStream} for reading from a contact
|
* Creates an {@link InputStream InputStream} for reading from a contact
|
||||||
* exchange stream.
|
* exchangestream.
|
||||||
*/
|
*/
|
||||||
InputStream createContactExchangeStreamReader(InputStream in,
|
InputStream createContactExchangeStreamReader(InputStream in,
|
||||||
SecretKey headerKey);
|
SecretKey headerKey);
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an {@link InputStream} for reading from a log stream.
|
|
||||||
*/
|
|
||||||
InputStream createLogStreamReader(InputStream in, SecretKey headerKey);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,19 +7,17 @@ import java.io.OutputStream;
|
|||||||
|
|
||||||
@NotNullByDefault
|
@NotNullByDefault
|
||||||
public interface StreamWriterFactory {
|
public interface StreamWriterFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@link StreamWriter} for writing to a transport stream.
|
* Creates an {@link OutputStream OutputStream} for writing to a
|
||||||
|
* transport stream
|
||||||
*/
|
*/
|
||||||
StreamWriter createStreamWriter(OutputStream out, StreamContext ctx);
|
StreamWriter createStreamWriter(OutputStream out, StreamContext ctx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@link StreamWriter} for writing to a contact exchange stream.
|
* Creates an {@link OutputStream OutputStream} for writing to a contact
|
||||||
|
* exchange stream.
|
||||||
*/
|
*/
|
||||||
StreamWriter createContactExchangeStreamWriter(OutputStream out,
|
StreamWriter createContactExchangeStreamWriter(OutputStream out,
|
||||||
SecretKey headerKey);
|
SecretKey headerKey);
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a {@link StreamWriter} for writing to a log stream.
|
|
||||||
*/
|
|
||||||
StreamWriter createLogStreamWriter(OutputStream out, SecretKey headerKey);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package org.briarproject.bramble.api.identity;
|
||||||
|
|
||||||
|
import org.briarproject.bramble.test.BrambleTestCase;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.NONE;
|
||||||
|
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.VERIFIED;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotEquals;
|
||||||
|
|
||||||
|
public class AuthorInfoTest extends BrambleTestCase {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEquals() {
|
||||||
|
assertEquals(
|
||||||
|
new AuthorInfo(NONE),
|
||||||
|
new AuthorInfo(NONE, null)
|
||||||
|
);
|
||||||
|
assertEquals(
|
||||||
|
new AuthorInfo(NONE, "test"),
|
||||||
|
new AuthorInfo(NONE, "test")
|
||||||
|
);
|
||||||
|
|
||||||
|
assertNotEquals(
|
||||||
|
new AuthorInfo(NONE),
|
||||||
|
new AuthorInfo(VERIFIED)
|
||||||
|
);
|
||||||
|
assertNotEquals(
|
||||||
|
new AuthorInfo(NONE, "test"),
|
||||||
|
new AuthorInfo(NONE)
|
||||||
|
);
|
||||||
|
assertNotEquals(
|
||||||
|
new AuthorInfo(NONE),
|
||||||
|
new AuthorInfo(NONE, "test")
|
||||||
|
);
|
||||||
|
assertNotEquals(
|
||||||
|
new AuthorInfo(NONE, "a"),
|
||||||
|
new AuthorInfo(NONE, "b")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,27 +1,24 @@
|
|||||||
dependencyVerification {
|
dependencyVerification {
|
||||||
verify = [
|
verify = [
|
||||||
'cglib:cglib:3.2.8:cglib-3.2.8.jar:3f64de999ecc5595dc84ca8ff0879d8a34c8623f9ef3c517a53ed59023fcb9db',
|
'cglib:cglib:3.2.0:cglib-3.2.0.jar:adb13bab79712ad6bdf1bd59f2a3918018a8016e722e8a357065afb9e6690861',
|
||||||
'com.google.code.findbugs:annotations:3.0.1:annotations-3.0.1.jar:6b47ff0a6de0ce17cbedc3abb0828ca5bce3009d53ea47b3723ff023c4742f79',
|
|
||||||
'com.google.code.findbugs:jsr305:3.0.2:jsr305-3.0.2.jar:766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7',
|
'com.google.code.findbugs:jsr305:3.0.2:jsr305-3.0.2.jar:766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7',
|
||||||
'com.google.dagger:dagger:2.24:dagger-2.24.jar:550a6e46a6dfcdf1d764887b6090cea94f783327e50e5c73754f18facfc70b64',
|
'com.google.dagger:dagger:2.24:dagger-2.24.jar:550a6e46a6dfcdf1d764887b6090cea94f783327e50e5c73754f18facfc70b64',
|
||||||
'javax.inject:javax.inject:1:javax.inject-1.jar:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
|
'javax.inject:javax.inject:1:javax.inject-1.jar:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
|
||||||
'junit:junit:4.12:junit-4.12.jar:59721f0805e223d84b90677887d9ff567dc534d7c502ca903c0c2b17f05c116a',
|
'junit:junit:4.12:junit-4.12.jar:59721f0805e223d84b90677887d9ff567dc534d7c502ca903c0c2b17f05c116a',
|
||||||
'net.bytebuddy:byte-buddy:1.9.12:byte-buddy-1.9.12.jar:3688c3d434bebc3edc5516296a2ed0f47b65e451071b4afecad84f902f0efc11',
|
'org.apache.ant:ant-launcher:1.9.4:ant-launcher-1.9.4.jar:7bccea20b41801ca17bcbc909a78c835d0f443f12d639c77bd6ae3d05861608d',
|
||||||
'net.jcip:jcip-annotations:1.0:jcip-annotations-1.0.jar:be5805392060c71474bf6c9a67a099471274d30b83eef84bfc4e0889a4f1dcc0',
|
'org.apache.ant:ant:1.9.4:ant-1.9.4.jar:649ae0730251de07b8913f49286d46bba7b92d47c5f332610aa426c4f02161d8',
|
||||||
'org.apache-extras.beanshell:bsh:2.0b6:bsh-2.0b6.jar:a17955976070c0573235ee662f2794a78082758b61accffce8d3f8aedcd91047',
|
'org.beanshell:bsh:1.3.0:bsh-1.3.0.jar:9b04edc75d19db54f1b4e8b5355e9364384c6cf71eb0a1b9724c159d779879f8',
|
||||||
'org.codehaus.mojo.signature:java16:1.1:java16-1.1.signature:53799223a2c98dba2d0add810bed76315460df285c69e4f397ae6098f87dd619',
|
'org.codehaus.mojo.signature:java16:1.1:java16-1.1.signature:53799223a2c98dba2d0add810bed76315460df285c69e4f397ae6098f87dd619',
|
||||||
'org.codehaus.mojo:animal-sniffer-ant-tasks:1.16:animal-sniffer-ant-tasks-1.16.jar:890040976fbe2d584619a6a61b1fd2e925b3b5eb342a85eb2762c467c0d64e90',
|
'org.codehaus.mojo:animal-sniffer-ant-tasks:1.16:animal-sniffer-ant-tasks-1.16.jar:890040976fbe2d584619a6a61b1fd2e925b3b5eb342a85eb2762c467c0d64e90',
|
||||||
'org.codehaus.mojo:animal-sniffer:1.16:animal-sniffer-1.16.jar:72be8bcc226ba43b937c722a08a07852bfa1b11400089265d5df0ee7b38b1d52',
|
'org.codehaus.mojo:animal-sniffer:1.16:animal-sniffer-1.16.jar:72be8bcc226ba43b937c722a08a07852bfa1b11400089265d5df0ee7b38b1d52',
|
||||||
'org.hamcrest:hamcrest-core:2.1:hamcrest-core-2.1.jar:e09109e54a289d88506b9bfec987ddd199f4217c9464132668351b9a4f00bee9',
|
'org.hamcrest:hamcrest-core:1.3:hamcrest-core-1.3.jar:66fdef91e9739348df7a096aa384a5685f4e875584cce89386a7a47251c4d8e9',
|
||||||
'org.hamcrest:hamcrest-library:2.1:hamcrest-library-2.1.jar:b7e2b6895b3b679f0e47b6380fda391b225e9b78505db9d8bdde8d3cc8d52a21',
|
'org.hamcrest:hamcrest-library:1.3:hamcrest-library-1.3.jar:711d64522f9ec410983bd310934296da134be4254a125080a0416ec178dfad1c',
|
||||||
'org.hamcrest:hamcrest:2.1:hamcrest-2.1.jar:ba93b2e3a562322ba432f0a1b53addcc55cb188253319a020ed77f824e692050',
|
'org.jmock:jmock-junit4:2.8.2:jmock-junit4-2.8.2.jar:f7ee4df4f7bd7b7f1cafad3b99eb74d579f109d5992ff625347352edb55e674c',
|
||||||
'org.jmock:jmock-imposters:2.12.0:jmock-imposters-2.12.0.jar:3b836269745a137c9b2347e8d7c2104845b126ef04f012d6bfd94f1a7dea7b09',
|
'org.jmock:jmock-legacy:2.8.2:jmock-legacy-2.8.2.jar:f2b985a5c08a9edb7f37612330c058809da3f6a6d63ce792426ebf8ff0d6d31b',
|
||||||
'org.jmock:jmock-junit4:2.12.0:jmock-junit4-2.12.0.jar:3233062fc889637c151a24f1ee086bad04321ab7d8264fef279daff0fa27205b',
|
'org.jmock:jmock-testjar:2.8.2:jmock-testjar-2.8.2.jar:8900860f72c474e027cf97fe78dcbf154a1aa7fc62b6845c5fb4e4f3c7bc8760',
|
||||||
'org.jmock:jmock-legacy:2.12.0:jmock-legacy-2.12.0.jar:dea3a9cca653d082e2fe7e40232e982fe03a9984c7d67ceff24f3e03fe580dcd',
|
'org.jmock:jmock:2.8.2:jmock-2.8.2.jar:6c73cb4a2e6dbfb61fd99c9a768539c170ab6568e57846bd60dbf19596b65b16',
|
||||||
'org.jmock:jmock-testjar:2.12.0:jmock-testjar-2.12.0.jar:efefbcf6cd294d0e29f0c46eb2a3380d4ca4e1763ff719c69e2f2ac62f564a04',
|
'org.objenesis:objenesis:2.1:objenesis-2.1.jar:c74330cc6b806c804fd37e74487b4fe5d7c2750c5e15fbc6efa13bdee1bdef80',
|
||||||
'org.jmock:jmock:2.12.0:jmock-2.12.0.jar:266d07314c0cd343c46ff8a55601272de8cf406807caf55e6f313295f83d10be',
|
|
||||||
'org.objenesis:objenesis:3.0.1:objenesis-3.0.1.jar:7a8ff780b9ff48415d7c705f60030b0acaa616e7f823c98eede3b63508d4e984',
|
|
||||||
'org.ow2.asm:asm-all:5.2:asm-all-5.2.jar:7fbffbc1db3422e2101689fd88df8384b15817b52b9b2b267b9f6d2511dc198d',
|
'org.ow2.asm:asm-all:5.2:asm-all-5.2.jar:7fbffbc1db3422e2101689fd88df8384b15817b52b9b2b267b9f6d2511dc198d',
|
||||||
'org.ow2.asm:asm:7.1:asm-7.1.jar:4ab2fa2b6d2cc9ccb1eaa05ea329c407b47b13ed2915f62f8c4b8cc96258d4de',
|
'org.ow2.asm:asm:5.0.4:asm-5.0.4.jar:896618ed8ae62702521a78bc7be42b7c491a08e6920a15f89a3ecdec31e9a220',
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ apply from: '../dagger.gradle'
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(path: ':bramble-api', configuration: 'default')
|
implementation project(path: ':bramble-api', configuration: 'default')
|
||||||
implementation 'org.bouncycastle:bcprov-jdk15on:1.65'
|
implementation 'com.madgag.spongycastle:core:1.58.0.0'
|
||||||
implementation 'com.h2database:h2:1.4.192' // The last version that supports Java 1.6
|
implementation 'com.h2database:h2:1.4.192' // The last version that supports Java 1.6
|
||||||
implementation 'org.bitlet:weupnp:0.1.4'
|
implementation 'org.bitlet:weupnp:0.1.4'
|
||||||
implementation 'net.i2p.crypto:eddsa:0.2.0'
|
implementation 'net.i2p.crypto:eddsa:0.2.0'
|
||||||
@@ -21,25 +21,16 @@ dependencies {
|
|||||||
|
|
||||||
testImplementation project(path: ':bramble-api', configuration: 'testOutput')
|
testImplementation project(path: ':bramble-api', configuration: 'testOutput')
|
||||||
testImplementation 'org.hsqldb:hsqldb:2.3.5' // The last version that supports Java 1.6
|
testImplementation 'org.hsqldb:hsqldb:2.3.5' // The last version that supports Java 1.6
|
||||||
testImplementation 'net.jodah:concurrentunit:0.4.2'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation "junit:junit:$junit_version"
|
testImplementation "org.jmock:jmock:2.8.2"
|
||||||
testImplementation "org.jmock:jmock:$jmock_version"
|
testImplementation "org.jmock:jmock-junit4:2.8.2"
|
||||||
testImplementation "org.jmock:jmock-junit4:$jmock_version"
|
testImplementation "org.jmock:jmock-legacy:2.8.2"
|
||||||
testImplementation "org.jmock:jmock-imposters:$jmock_version"
|
|
||||||
|
|
||||||
testAnnotationProcessor 'com.google.dagger:dagger-compiler:2.24'
|
testAnnotationProcessor 'com.google.dagger:dagger-compiler:2.24'
|
||||||
|
|
||||||
signature 'org.codehaus.mojo.signature:java16:1.1@signature'
|
signature 'org.codehaus.mojo.signature:java16:1.1@signature'
|
||||||
}
|
}
|
||||||
|
|
||||||
animalsniffer {
|
|
||||||
// Allow requireNonNull: Android desugaring rewrites it (so it's safe for us to use),
|
|
||||||
// and it gets used when passing method references instead of lambdas with Java 11.
|
|
||||||
// Note that this line allows *all* methods from java.util.Objects.
|
|
||||||
// That's the best that we can do with the configuration options that Animal Sniffer offers.
|
|
||||||
ignore 'java.util.Objects'
|
|
||||||
}
|
|
||||||
|
|
||||||
// needed to make test output available to bramble-java
|
// needed to make test output available to bramble-java
|
||||||
configurations {
|
configurations {
|
||||||
testOutput.extendsFrom(testCompile)
|
testOutput.extendsFrom(testCompile)
|
||||||
|
|||||||
@@ -176,18 +176,6 @@ class AccountManagerImpl implements AccountManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean restoreAccount(Identity identity, String password) {
|
|
||||||
synchronized (stateChangeLock) {
|
|
||||||
if (hasDatabaseKey())
|
|
||||||
throw new AssertionError("Already have a database key");
|
|
||||||
identityManager.registerIdentity(identity);
|
|
||||||
SecretKey key = crypto.generateSecretKey();
|
|
||||||
if (!encryptAndStoreDatabaseKey(key, password)) return false;
|
|
||||||
databaseKey = key;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GuardedBy("stateChangeLock")
|
@GuardedBy("stateChangeLock")
|
||||||
private boolean encryptAndStoreDatabaseKey(SecretKey key, String password) {
|
private boolean encryptAndStoreDatabaseKey(SecretKey key, String password) {
|
||||||
byte[] plaintext = key.getBytes();
|
byte[] plaintext = key.getBytes();
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class ConnectionManagerImpl implements ConnectionManager {
|
|||||||
ioExecutor.execute(new IncomingDuplexSyncConnection(keyManager,
|
ioExecutor.execute(new IncomingDuplexSyncConnection(keyManager,
|
||||||
connectionRegistry, streamReaderFactory, streamWriterFactory,
|
connectionRegistry, streamReaderFactory, streamWriterFactory,
|
||||||
syncSessionFactory, transportPropertyManager, ioExecutor,
|
syncSessionFactory, transportPropertyManager, ioExecutor,
|
||||||
t, d, handshakeManager));
|
t, d));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -101,7 +101,7 @@ class ConnectionManagerImpl implements ConnectionManager {
|
|||||||
ioExecutor.execute(new OutgoingDuplexSyncConnection(keyManager,
|
ioExecutor.execute(new OutgoingDuplexSyncConnection(keyManager,
|
||||||
connectionRegistry, streamReaderFactory, streamWriterFactory,
|
connectionRegistry, streamReaderFactory, streamWriterFactory,
|
||||||
syncSessionFactory, transportPropertyManager, ioExecutor,
|
syncSessionFactory, transportPropertyManager, ioExecutor,
|
||||||
secureRandom, handshakeManager, c, t, d));
|
secureRandom, c, t, d));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package org.briarproject.bramble.connection;
|
|||||||
import org.briarproject.bramble.api.connection.ConnectionRegistry;
|
import org.briarproject.bramble.api.connection.ConnectionRegistry;
|
||||||
import org.briarproject.bramble.api.connection.InterruptibleConnection;
|
import org.briarproject.bramble.api.connection.InterruptibleConnection;
|
||||||
import org.briarproject.bramble.api.contact.ContactId;
|
import org.briarproject.bramble.api.contact.ContactId;
|
||||||
import org.briarproject.bramble.api.contact.HandshakeManager;
|
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.briarproject.bramble.api.plugin.TransportConnectionReader;
|
import org.briarproject.bramble.api.plugin.TransportConnectionReader;
|
||||||
import org.briarproject.bramble.api.plugin.TransportConnectionWriter;
|
import org.briarproject.bramble.api.plugin.TransportConnectionWriter;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package org.briarproject.bramble.connection;
|
|||||||
|
|
||||||
import org.briarproject.bramble.api.connection.ConnectionRegistry;
|
import org.briarproject.bramble.api.connection.ConnectionRegistry;
|
||||||
import org.briarproject.bramble.api.contact.ContactId;
|
import org.briarproject.bramble.api.contact.ContactId;
|
||||||
import org.briarproject.bramble.api.contact.HandshakeManager;
|
|
||||||
import org.briarproject.bramble.api.db.DbException;
|
import org.briarproject.bramble.api.db.DbException;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.briarproject.bramble.api.plugin.TransportId;
|
import org.briarproject.bramble.api.plugin.TransportId;
|
||||||
@@ -14,11 +13,9 @@ import org.briarproject.bramble.api.sync.SyncSessionFactory;
|
|||||||
import org.briarproject.bramble.api.transport.KeyManager;
|
import org.briarproject.bramble.api.transport.KeyManager;
|
||||||
import org.briarproject.bramble.api.transport.StreamContext;
|
import org.briarproject.bramble.api.transport.StreamContext;
|
||||||
import org.briarproject.bramble.api.transport.StreamReaderFactory;
|
import org.briarproject.bramble.api.transport.StreamReaderFactory;
|
||||||
import org.briarproject.bramble.api.transport.StreamWriter;
|
|
||||||
import org.briarproject.bramble.api.transport.StreamWriterFactory;
|
import org.briarproject.bramble.api.transport.StreamWriterFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
import static java.util.logging.Level.WARNING;
|
import static java.util.logging.Level.WARNING;
|
||||||
@@ -27,10 +24,6 @@ import static org.briarproject.bramble.util.LogUtils.logException;
|
|||||||
@NotNullByDefault
|
@NotNullByDefault
|
||||||
class IncomingDuplexSyncConnection extends DuplexSyncConnection
|
class IncomingDuplexSyncConnection extends DuplexSyncConnection
|
||||||
implements Runnable {
|
implements Runnable {
|
||||||
private final HandshakeManager handshakeManager;
|
|
||||||
|
|
||||||
// FIXME: Exchange timestamp as part of handshake protocol?
|
|
||||||
private static final long TIMESTAMP = 1617235200; // 1 April 2021 00:00 UTC
|
|
||||||
|
|
||||||
IncomingDuplexSyncConnection(KeyManager keyManager,
|
IncomingDuplexSyncConnection(KeyManager keyManager,
|
||||||
ConnectionRegistry connectionRegistry,
|
ConnectionRegistry connectionRegistry,
|
||||||
@@ -39,18 +32,14 @@ class IncomingDuplexSyncConnection extends DuplexSyncConnection
|
|||||||
SyncSessionFactory syncSessionFactory,
|
SyncSessionFactory syncSessionFactory,
|
||||||
TransportPropertyManager transportPropertyManager,
|
TransportPropertyManager transportPropertyManager,
|
||||||
Executor ioExecutor, TransportId transportId,
|
Executor ioExecutor, TransportId transportId,
|
||||||
DuplexTransportConnection connection,
|
DuplexTransportConnection connection) {
|
||||||
HandshakeManager handshakeManager) {
|
|
||||||
super(keyManager, connectionRegistry, streamReaderFactory,
|
super(keyManager, connectionRegistry, streamReaderFactory,
|
||||||
streamWriterFactory, syncSessionFactory,
|
streamWriterFactory, syncSessionFactory,
|
||||||
transportPropertyManager, ioExecutor, transportId, connection);
|
transportPropertyManager, ioExecutor, transportId, connection);
|
||||||
this.handshakeManager = handshakeManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
LOG.info("Running IncomingDuplexSyncConnection on transport " +
|
|
||||||
transportId.getString());
|
|
||||||
// Read and recognise the tag
|
// Read and recognise the tag
|
||||||
StreamContext ctx = recogniseTag(reader, transportId);
|
StreamContext ctx = recogniseTag(reader, transportId);
|
||||||
if (ctx == null) {
|
if (ctx == null) {
|
||||||
@@ -65,22 +54,10 @@ class IncomingDuplexSyncConnection extends DuplexSyncConnection
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ctx.isHandshakeMode()) {
|
if (ctx.isHandshakeMode()) {
|
||||||
if (!performHandshake(ctx, contactId)) {
|
// TODO: Support handshake mode for contacts
|
||||||
LOG.warning("Handshake failed");
|
LOG.warning("Received handshake tag, expected rotation mode");
|
||||||
return;
|
onReadError(true);
|
||||||
}
|
return;
|
||||||
// Allocate a rotation mode stream context
|
|
||||||
ctx = allocateStreamContext(contactId, transportId);
|
|
||||||
if (ctx == null) {
|
|
||||||
LOG.warning("Could not allocate stream context");
|
|
||||||
onWriteError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ctx.isHandshakeMode()) {
|
|
||||||
LOG.warning("Got handshake mode context after handshaking");
|
|
||||||
onWriteError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
connectionRegistry.registerIncomingConnection(contactId, transportId,
|
connectionRegistry.registerIncomingConnection(contactId, transportId,
|
||||||
this);
|
this);
|
||||||
@@ -126,35 +103,5 @@ class IncomingDuplexSyncConnection extends DuplexSyncConnection
|
|||||||
onWriteError();
|
onWriteError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean performHandshake(StreamContext ctxIn, ContactId contactId) {
|
|
||||||
LOG.info("Performing handshake (Incoming)");
|
|
||||||
// Allocate the outgoing stream context
|
|
||||||
StreamContext ctxOut =
|
|
||||||
allocateStreamContext(contactId, transportId);
|
|
||||||
if (ctxOut == null) {
|
|
||||||
LOG.warning("Could not allocate stream context");
|
|
||||||
onReadError(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
InputStream in = streamReaderFactory.createStreamReader(
|
|
||||||
reader.getInputStream(), ctxIn);
|
|
||||||
// Flush the output stream to send the outgoing stream header
|
|
||||||
StreamWriter out = streamWriterFactory.createStreamWriter(
|
|
||||||
writer.getOutputStream(), ctxOut);
|
|
||||||
out.getOutputStream().flush();
|
|
||||||
HandshakeManager.HandshakeResult result =
|
|
||||||
handshakeManager.handshake(contactId, in, out);
|
|
||||||
keyManager.addRotationKeys(contactId, result.getMasterKey(),
|
|
||||||
TIMESTAMP, result.isAlice(), true);
|
|
||||||
LOG.info("Rotation keys added");
|
|
||||||
return true;
|
|
||||||
} catch (IOException | DbException e) {
|
|
||||||
logException(LOG, WARNING, e);
|
|
||||||
onReadError(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package org.briarproject.bramble.connection;
|
|||||||
|
|
||||||
import org.briarproject.bramble.api.connection.ConnectionRegistry;
|
import org.briarproject.bramble.api.connection.ConnectionRegistry;
|
||||||
import org.briarproject.bramble.api.contact.ContactId;
|
import org.briarproject.bramble.api.contact.ContactId;
|
||||||
import org.briarproject.bramble.api.contact.HandshakeManager;
|
|
||||||
import org.briarproject.bramble.api.db.DbException;
|
import org.briarproject.bramble.api.db.DbException;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.briarproject.bramble.api.plugin.TransportId;
|
import org.briarproject.bramble.api.plugin.TransportId;
|
||||||
@@ -15,11 +14,9 @@ import org.briarproject.bramble.api.sync.SyncSessionFactory;
|
|||||||
import org.briarproject.bramble.api.transport.KeyManager;
|
import org.briarproject.bramble.api.transport.KeyManager;
|
||||||
import org.briarproject.bramble.api.transport.StreamContext;
|
import org.briarproject.bramble.api.transport.StreamContext;
|
||||||
import org.briarproject.bramble.api.transport.StreamReaderFactory;
|
import org.briarproject.bramble.api.transport.StreamReaderFactory;
|
||||||
import org.briarproject.bramble.api.transport.StreamWriter;
|
|
||||||
import org.briarproject.bramble.api.transport.StreamWriterFactory;
|
import org.briarproject.bramble.api.transport.StreamWriterFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
@@ -31,38 +28,26 @@ import static org.briarproject.bramble.util.LogUtils.logException;
|
|||||||
class OutgoingDuplexSyncConnection extends DuplexSyncConnection
|
class OutgoingDuplexSyncConnection extends DuplexSyncConnection
|
||||||
implements Runnable {
|
implements Runnable {
|
||||||
|
|
||||||
// FIXME: Exchange timestamp as part of handshake protocol?
|
|
||||||
private static final long TIMESTAMP = 1617235200; // 1 April 2021 00:00 UTC
|
|
||||||
|
|
||||||
private final SecureRandom secureRandom;
|
private final SecureRandom secureRandom;
|
||||||
private final HandshakeManager handshakeManager;
|
|
||||||
private final ContactId contactId;
|
private final ContactId contactId;
|
||||||
|
|
||||||
OutgoingDuplexSyncConnection(
|
OutgoingDuplexSyncConnection(KeyManager keyManager,
|
||||||
KeyManager keyManager,
|
|
||||||
ConnectionRegistry connectionRegistry,
|
ConnectionRegistry connectionRegistry,
|
||||||
StreamReaderFactory streamReaderFactory,
|
StreamReaderFactory streamReaderFactory,
|
||||||
StreamWriterFactory streamWriterFactory,
|
StreamWriterFactory streamWriterFactory,
|
||||||
SyncSessionFactory syncSessionFactory,
|
SyncSessionFactory syncSessionFactory,
|
||||||
TransportPropertyManager transportPropertyManager,
|
TransportPropertyManager transportPropertyManager,
|
||||||
Executor ioExecutor,
|
Executor ioExecutor, SecureRandom secureRandom, ContactId contactId,
|
||||||
SecureRandom secureRandom,
|
TransportId transportId, DuplexTransportConnection connection) {
|
||||||
HandshakeManager handshakeManager,
|
|
||||||
ContactId contactId,
|
|
||||||
TransportId transportId,
|
|
||||||
DuplexTransportConnection connection) {
|
|
||||||
super(keyManager, connectionRegistry, streamReaderFactory,
|
super(keyManager, connectionRegistry, streamReaderFactory,
|
||||||
streamWriterFactory, syncSessionFactory,
|
streamWriterFactory, syncSessionFactory,
|
||||||
transportPropertyManager, ioExecutor, transportId, connection);
|
transportPropertyManager, ioExecutor, transportId, connection);
|
||||||
this.secureRandom = secureRandom;
|
this.secureRandom = secureRandom;
|
||||||
this.handshakeManager = handshakeManager;
|
|
||||||
this.contactId = contactId;
|
this.contactId = contactId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
LOG.info("Running OutgoingDuplexSyncConnection on transport " +
|
|
||||||
transportId.getString());
|
|
||||||
// Allocate a stream context
|
// Allocate a stream context
|
||||||
StreamContext ctx = allocateStreamContext(contactId, transportId);
|
StreamContext ctx = allocateStreamContext(contactId, transportId);
|
||||||
if (ctx == null) {
|
if (ctx == null) {
|
||||||
@@ -71,22 +56,10 @@ class OutgoingDuplexSyncConnection extends DuplexSyncConnection
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ctx.isHandshakeMode()) {
|
if (ctx.isHandshakeMode()) {
|
||||||
if (!performHandshake(ctx)) {
|
// TODO: Support handshake mode for contacts
|
||||||
LOG.warning("Handshake failed");
|
LOG.warning("Cannot use handshake mode stream context");
|
||||||
return;
|
onWriteError();
|
||||||
}
|
return;
|
||||||
// Allocate a rotation mode stream context
|
|
||||||
ctx = allocateStreamContext(contactId, transportId);
|
|
||||||
if (ctx == null) {
|
|
||||||
LOG.warning("Could not allocate stream context");
|
|
||||||
onWriteError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ctx.isHandshakeMode()) {
|
|
||||||
LOG.warning("Got handshake mode context after handshaking");
|
|
||||||
onWriteError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Start the incoming session on another thread
|
// Start the incoming session on another thread
|
||||||
Priority priority = generatePriority();
|
Priority priority = generatePriority();
|
||||||
@@ -154,59 +127,6 @@ class OutgoingDuplexSyncConnection extends DuplexSyncConnection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean performHandshake(StreamContext ctxOut) {
|
|
||||||
LOG.info("Performing handshake (Outgoing)");
|
|
||||||
// Flush the output stream to send the outgoing stream header
|
|
||||||
StreamWriter out;
|
|
||||||
try {
|
|
||||||
out = streamWriterFactory.createStreamWriter(
|
|
||||||
writer.getOutputStream(), ctxOut);
|
|
||||||
out.getOutputStream().flush();
|
|
||||||
} catch (IOException e) {
|
|
||||||
logException(LOG, WARNING, e);
|
|
||||||
onWriteError();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Read and recognise the tag
|
|
||||||
StreamContext ctxIn = recogniseTag(reader, transportId);
|
|
||||||
// Unrecognised tags are suspicious in this case
|
|
||||||
if (ctxIn == null) {
|
|
||||||
LOG.warning("Unrecognised tag for returning stream");
|
|
||||||
onReadError();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Check that the stream comes from the expected contact
|
|
||||||
ContactId inContactId = ctxIn.getContactId();
|
|
||||||
if (contactId == null) {
|
|
||||||
LOG.warning("Expected contact tag, got rendezvous tag");
|
|
||||||
onReadError();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!inContactId.equals(contactId)) {
|
|
||||||
LOG.warning("Wrong contact ID for returning stream");
|
|
||||||
onReadError();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// TODO: Register the connection, close it if it's redundant
|
|
||||||
// Handshake and exchange contacts
|
|
||||||
try {
|
|
||||||
InputStream in = streamReaderFactory.createStreamReader(
|
|
||||||
reader.getInputStream(), ctxIn);
|
|
||||||
HandshakeManager.HandshakeResult result =
|
|
||||||
handshakeManager.handshake(contactId, in, out);
|
|
||||||
keyManager.addRotationKeys(contactId, result.getMasterKey(),
|
|
||||||
TIMESTAMP, result.isAlice(), true);
|
|
||||||
LOG.info("Rotation keys added");
|
|
||||||
return true;
|
|
||||||
} catch (IOException | DbException e) {
|
|
||||||
logException(LOG, WARNING, e);
|
|
||||||
onWriteError();
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
// TODO: Unregister the connection
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onReadError() {
|
private void onReadError() {
|
||||||
// 'Recognised' is always true for outgoing connections
|
// 'Recognised' is always true for outgoing connections
|
||||||
onReadError(true);
|
onReadError(true);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.briarproject.bramble.api.contact;
|
package org.briarproject.bramble.contact;
|
||||||
|
|
||||||
public interface ContactExchangeConstants {
|
interface ContactExchangeConstants {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current version of the contact exchange protocol.
|
* The current version of the contact exchange protocol.
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package org.briarproject.bramble.api.contact;
|
package org.briarproject.bramble.contact;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.crypto.PrivateKey;
|
import org.briarproject.bramble.api.crypto.PrivateKey;
|
||||||
import org.briarproject.bramble.api.crypto.PublicKey;
|
import org.briarproject.bramble.api.crypto.PublicKey;
|
||||||
@@ -6,7 +6,7 @@ import org.briarproject.bramble.api.crypto.SecretKey;
|
|||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
|
|
||||||
@NotNullByDefault
|
@NotNullByDefault
|
||||||
public interface ContactExchangeCrypto {
|
interface ContactExchangeCrypto {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Derives the header key for a contact exchange stream from the master key.
|
* Derives the header key for a contact exchange stream from the master key.
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.briarproject.bramble.contact;
|
package org.briarproject.bramble.contact;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.contact.ContactExchangeCrypto;
|
|
||||||
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
||||||
import org.briarproject.bramble.api.crypto.PrivateKey;
|
import org.briarproject.bramble.api.crypto.PrivateKey;
|
||||||
import org.briarproject.bramble.api.crypto.PublicKey;
|
import org.briarproject.bramble.api.crypto.PublicKey;
|
||||||
@@ -11,12 +10,12 @@ import java.security.GeneralSecurityException;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import static org.briarproject.bramble.api.contact.ContactExchangeConstants.ALICE_KEY_LABEL;
|
import static org.briarproject.bramble.contact.ContactExchangeConstants.ALICE_KEY_LABEL;
|
||||||
import static org.briarproject.bramble.api.contact.ContactExchangeConstants.ALICE_NONCE_LABEL;
|
import static org.briarproject.bramble.contact.ContactExchangeConstants.ALICE_NONCE_LABEL;
|
||||||
import static org.briarproject.bramble.api.contact.ContactExchangeConstants.BOB_KEY_LABEL;
|
import static org.briarproject.bramble.contact.ContactExchangeConstants.BOB_KEY_LABEL;
|
||||||
import static org.briarproject.bramble.api.contact.ContactExchangeConstants.BOB_NONCE_LABEL;
|
import static org.briarproject.bramble.contact.ContactExchangeConstants.BOB_NONCE_LABEL;
|
||||||
import static org.briarproject.bramble.api.contact.ContactExchangeConstants.PROTOCOL_VERSION;
|
import static org.briarproject.bramble.contact.ContactExchangeConstants.PROTOCOL_VERSION;
|
||||||
import static org.briarproject.bramble.api.contact.ContactExchangeConstants.SIGNING_LABEL;
|
import static org.briarproject.bramble.contact.ContactExchangeConstants.SIGNING_LABEL;
|
||||||
|
|
||||||
@NotNullByDefault
|
@NotNullByDefault
|
||||||
class ContactExchangeCryptoImpl implements ContactExchangeCrypto {
|
class ContactExchangeCryptoImpl implements ContactExchangeCrypto {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import org.briarproject.bramble.api.FormatException;
|
|||||||
import org.briarproject.bramble.api.Predicate;
|
import org.briarproject.bramble.api.Predicate;
|
||||||
import org.briarproject.bramble.api.client.ClientHelper;
|
import org.briarproject.bramble.api.client.ClientHelper;
|
||||||
import org.briarproject.bramble.api.contact.Contact;
|
import org.briarproject.bramble.api.contact.Contact;
|
||||||
import org.briarproject.bramble.api.contact.ContactExchangeCrypto;
|
|
||||||
import org.briarproject.bramble.api.contact.ContactExchangeManager;
|
import org.briarproject.bramble.api.contact.ContactExchangeManager;
|
||||||
import org.briarproject.bramble.api.contact.ContactId;
|
import org.briarproject.bramble.api.contact.ContactId;
|
||||||
import org.briarproject.bramble.api.contact.ContactManager;
|
import org.briarproject.bramble.api.contact.ContactManager;
|
||||||
@@ -48,8 +47,8 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import static java.util.logging.Logger.getLogger;
|
import static java.util.logging.Logger.getLogger;
|
||||||
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_SIGNATURE_LENGTH;
|
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_SIGNATURE_LENGTH;
|
||||||
import static org.briarproject.bramble.api.contact.ContactExchangeConstants.PROTOCOL_VERSION;
|
import static org.briarproject.bramble.contact.ContactExchangeConstants.PROTOCOL_VERSION;
|
||||||
import static org.briarproject.bramble.api.contact.ContactExchangeRecordTypes.CONTACT_INFO;
|
import static org.briarproject.bramble.contact.ContactExchangeRecordTypes.CONTACT_INFO;
|
||||||
import static org.briarproject.bramble.util.ValidationUtils.checkLength;
|
import static org.briarproject.bramble.util.ValidationUtils.checkLength;
|
||||||
import static org.briarproject.bramble.util.ValidationUtils.checkSize;
|
import static org.briarproject.bramble.util.ValidationUtils.checkSize;
|
||||||
|
|
||||||
@@ -82,8 +81,7 @@ class ContactExchangeManagerImpl implements ContactExchangeManager {
|
|||||||
private final ContactManager contactManager;
|
private final ContactManager contactManager;
|
||||||
private final IdentityManager identityManager;
|
private final IdentityManager identityManager;
|
||||||
private final TransportPropertyManager transportPropertyManager;
|
private final TransportPropertyManager transportPropertyManager;
|
||||||
private final org.briarproject.bramble.api.contact.ContactExchangeCrypto
|
private final ContactExchangeCrypto contactExchangeCrypto;
|
||||||
contactExchangeCrypto;
|
|
||||||
private final StreamReaderFactory streamReaderFactory;
|
private final StreamReaderFactory streamReaderFactory;
|
||||||
private final StreamWriterFactory streamWriterFactory;
|
private final StreamWriterFactory streamWriterFactory;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package org.briarproject.bramble.contact;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Record types for the contact exchange protocol.
|
||||||
|
*/
|
||||||
|
interface ContactExchangeRecordTypes {
|
||||||
|
|
||||||
|
byte CONTACT_INFO = 0;
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ import org.briarproject.bramble.api.contact.PendingContact;
|
|||||||
import org.briarproject.bramble.api.contact.PendingContactId;
|
import org.briarproject.bramble.api.contact.PendingContactId;
|
||||||
import org.briarproject.bramble.api.contact.PendingContactState;
|
import org.briarproject.bramble.api.contact.PendingContactState;
|
||||||
import org.briarproject.bramble.api.contact.event.PendingContactStateChangedEvent;
|
import org.briarproject.bramble.api.contact.event.PendingContactStateChangedEvent;
|
||||||
import org.briarproject.bramble.api.crypto.CryptoConstants;
|
|
||||||
import org.briarproject.bramble.api.crypto.KeyPair;
|
import org.briarproject.bramble.api.crypto.KeyPair;
|
||||||
import org.briarproject.bramble.api.crypto.PublicKey;
|
import org.briarproject.bramble.api.crypto.PublicKey;
|
||||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
@@ -21,7 +20,9 @@ import org.briarproject.bramble.api.event.Event;
|
|||||||
import org.briarproject.bramble.api.event.EventListener;
|
import org.briarproject.bramble.api.event.EventListener;
|
||||||
import org.briarproject.bramble.api.identity.Author;
|
import org.briarproject.bramble.api.identity.Author;
|
||||||
import org.briarproject.bramble.api.identity.AuthorId;
|
import org.briarproject.bramble.api.identity.AuthorId;
|
||||||
|
import org.briarproject.bramble.api.identity.AuthorInfo;
|
||||||
import org.briarproject.bramble.api.identity.IdentityManager;
|
import org.briarproject.bramble.api.identity.IdentityManager;
|
||||||
|
import org.briarproject.bramble.api.identity.LocalAuthor;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.briarproject.bramble.api.transport.KeyManager;
|
import org.briarproject.bramble.api.transport.KeyManager;
|
||||||
|
|
||||||
@@ -39,6 +40,10 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import static org.briarproject.bramble.api.contact.PendingContactState.WAITING_FOR_CONNECTION;
|
import static org.briarproject.bramble.api.contact.PendingContactState.WAITING_FOR_CONNECTION;
|
||||||
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
|
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
|
||||||
|
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.OURSELVES;
|
||||||
|
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.UNKNOWN;
|
||||||
|
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.UNVERIFIED;
|
||||||
|
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.VERIFIED;
|
||||||
import static org.briarproject.bramble.util.StringUtils.toUtf8;
|
import static org.briarproject.bramble.util.StringUtils.toUtf8;
|
||||||
|
|
||||||
@ThreadSafe
|
@ThreadSafe
|
||||||
@@ -120,18 +125,6 @@ class ContactManagerImpl implements ContactManager, EventListener {
|
|||||||
verified, active));
|
verified, active));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
|
||||||
PublicKey handshake, boolean verified)
|
|
||||||
throws DbException, GeneralSecurityException {
|
|
||||||
ContactId c = db.addContact(txn, remote, local, handshake, verified);
|
|
||||||
Contact contact = db.getContact(txn, c);
|
|
||||||
KeyPair ourKeyPair = identityManager.getHandshakeKeys(txn);
|
|
||||||
keyManager.addContact(txn, c, handshake, ourKeyPair);
|
|
||||||
for (ContactHook hook : hooks) hook.addingContact(txn, contact);
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHandshakeLink() throws DbException {
|
public String getHandshakeLink() throws DbException {
|
||||||
KeyPair keyPair = db.transactionWithResult(true,
|
KeyPair keyPair = db.transactionWithResult(true,
|
||||||
@@ -220,11 +213,6 @@ class ContactManagerImpl implements ContactManager, EventListener {
|
|||||||
return db.transactionWithResult(true, db::getContacts);
|
return db.transactionWithResult(true, db::getContacts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<Contact> getContacts(Transaction txn) throws DbException {
|
|
||||||
return db.getContacts(txn);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeContact(ContactId c) throws DbException {
|
public void removeContact(ContactId c) throws DbException {
|
||||||
db.transaction(false, txn -> removeContact(txn, c));
|
db.transaction(false, txn -> removeContact(txn, c));
|
||||||
@@ -247,25 +235,6 @@ class ContactManagerImpl implements ContactManager, EventListener {
|
|||||||
db.transaction(false, txn -> setContactAlias(txn, c, alias));
|
db.transaction(false, txn -> setContactAlias(txn, c, alias));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHandshakePublicKey(Transaction txn, ContactId c,
|
|
||||||
PublicKey handshakePublicKey) throws DbException, GeneralSecurityException {
|
|
||||||
if (handshakePublicKey.getKeyType() !=
|
|
||||||
CryptoConstants.KEY_TYPE_AGREEMENT) {
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
db.setHandshakePublicKey(txn, c, handshakePublicKey);
|
|
||||||
KeyPair ourKeyPair = identityManager.getHandshakeKeys(txn);
|
|
||||||
keyManager.addContact(txn, c, handshakePublicKey, ourKeyPair);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHandshakePublicKey(ContactId c, PublicKey handshakePublicKey)
|
|
||||||
throws DbException, GeneralSecurityException {
|
|
||||||
db.transaction(false,
|
|
||||||
txn -> setHandshakePublicKey(txn, c, handshakePublicKey));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contactExists(Transaction txn, AuthorId remoteAuthorId,
|
public boolean contactExists(Transaction txn, AuthorId remoteAuthorId,
|
||||||
AuthorId localAuthorId) throws DbException {
|
AuthorId localAuthorId) throws DbException {
|
||||||
@@ -287,6 +256,25 @@ class ContactManagerImpl implements ContactManager, EventListener {
|
|||||||
db.removeContact(txn, c);
|
db.removeContact(txn, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AuthorInfo getAuthorInfo(AuthorId a) throws DbException {
|
||||||
|
return db.transactionWithResult(true, txn -> getAuthorInfo(txn, a));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AuthorInfo getAuthorInfo(Transaction txn, AuthorId authorId)
|
||||||
|
throws DbException {
|
||||||
|
LocalAuthor localAuthor = identityManager.getLocalAuthor(txn);
|
||||||
|
if (localAuthor.getId().equals(authorId))
|
||||||
|
return new AuthorInfo(OURSELVES);
|
||||||
|
Collection<Contact> contacts = db.getContactsByAuthorId(txn, authorId);
|
||||||
|
if (contacts.isEmpty()) return new AuthorInfo(UNKNOWN);
|
||||||
|
if (contacts.size() > 1) throw new AssertionError();
|
||||||
|
Contact c = contacts.iterator().next();
|
||||||
|
if (c.isVerified()) return new AuthorInfo(VERIFIED, c.getAlias());
|
||||||
|
else return new AuthorInfo(UNVERIFIED, c.getAlias());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void eventOccurred(Event e) {
|
public void eventOccurred(Event e) {
|
||||||
if (e instanceof PendingContactStateChangedEvent) {
|
if (e instanceof PendingContactStateChangedEvent) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.briarproject.bramble.contact;
|
package org.briarproject.bramble.contact;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.contact.ContactExchangeCrypto;
|
|
||||||
import org.briarproject.bramble.api.contact.ContactExchangeManager;
|
import org.briarproject.bramble.api.contact.ContactExchangeManager;
|
||||||
import org.briarproject.bramble.api.contact.ContactManager;
|
import org.briarproject.bramble.api.contact.ContactManager;
|
||||||
import org.briarproject.bramble.api.contact.HandshakeManager;
|
import org.briarproject.bramble.api.contact.HandshakeManager;
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package org.briarproject.bramble.contact;
|
|||||||
import org.briarproject.bramble.api.FormatException;
|
import org.briarproject.bramble.api.FormatException;
|
||||||
import org.briarproject.bramble.api.Pair;
|
import org.briarproject.bramble.api.Pair;
|
||||||
import org.briarproject.bramble.api.Predicate;
|
import org.briarproject.bramble.api.Predicate;
|
||||||
import org.briarproject.bramble.api.contact.Contact;
|
|
||||||
import org.briarproject.bramble.api.contact.ContactId;
|
|
||||||
import org.briarproject.bramble.api.contact.ContactManager;
|
import org.briarproject.bramble.api.contact.ContactManager;
|
||||||
import org.briarproject.bramble.api.contact.HandshakeManager;
|
import org.briarproject.bramble.api.contact.HandshakeManager;
|
||||||
import org.briarproject.bramble.api.contact.PendingContact;
|
import org.briarproject.bramble.api.contact.PendingContact;
|
||||||
@@ -90,27 +88,6 @@ class HandshakeManagerImpl implements HandshakeManager {
|
|||||||
});
|
});
|
||||||
PublicKey theirStaticPublicKey = keys.getFirst();
|
PublicKey theirStaticPublicKey = keys.getFirst();
|
||||||
KeyPair ourStaticKeyPair = keys.getSecond();
|
KeyPair ourStaticKeyPair = keys.getSecond();
|
||||||
return handshake(theirStaticPublicKey, ourStaticKeyPair, in, out);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandshakeResult handshake(ContactId c, InputStream in,
|
|
||||||
StreamWriter out) throws DbException, IOException {
|
|
||||||
Pair<PublicKey, KeyPair> keys = db.transactionWithResult(true, txn -> {
|
|
||||||
Contact contact = contactManager.getContact(txn, c);
|
|
||||||
PublicKey handshakePublicKey = contact.getHandshakePublicKey();
|
|
||||||
if (handshakePublicKey == null) throw new DbException();
|
|
||||||
KeyPair keyPair = identityManager.getHandshakeKeys(txn);
|
|
||||||
return new Pair<>(handshakePublicKey, keyPair);
|
|
||||||
});
|
|
||||||
PublicKey theirStaticPublicKey = keys.getFirst();
|
|
||||||
KeyPair ourStaticKeyPair = keys.getSecond();
|
|
||||||
return handshake(theirStaticPublicKey, ourStaticKeyPair, in, out);
|
|
||||||
}
|
|
||||||
|
|
||||||
private HandshakeResult handshake(PublicKey theirStaticPublicKey,
|
|
||||||
KeyPair ourStaticKeyPair, InputStream in, StreamWriter out)
|
|
||||||
throws IOException {
|
|
||||||
boolean alice = transportCrypto.isAlice(theirStaticPublicKey,
|
boolean alice = transportCrypto.isAlice(theirStaticPublicKey,
|
||||||
ourStaticKeyPair);
|
ourStaticKeyPair);
|
||||||
RecordReader recordReader = recordReaderFactory.createRecordReader(in);
|
RecordReader recordReader = recordReaderFactory.createRecordReader(in);
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import org.briarproject.bramble.api.system.Clock;
|
|||||||
import org.briarproject.bramble.util.Base32;
|
import org.briarproject.bramble.util.Base32;
|
||||||
|
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -53,7 +52,7 @@ class PendingContactFactoryImpl implements PendingContactFactory {
|
|||||||
byte[] raw = new byte[RAW_LINK_BYTES];
|
byte[] raw = new byte[RAW_LINK_BYTES];
|
||||||
raw[0] = FORMAT_VERSION;
|
raw[0] = FORMAT_VERSION;
|
||||||
arraycopy(encoded, 0, raw, 1, encoded.length);
|
arraycopy(encoded, 0, raw, 1, encoded.length);
|
||||||
return "briar://" + Base32.encode(raw).toLowerCase(Locale.US);
|
return "briar://" + Base32.encode(raw).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
private PublicKey parseHandshakeLink(String link) throws FormatException {
|
private PublicKey parseHandshakeLink(String link) throws FormatException {
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package org.briarproject.bramble.api.crypto;
|
package org.briarproject.bramble.crypto;
|
||||||
|
|
||||||
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
|
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
|
|
||||||
@NotNullByDefault
|
@NotNullByDefault
|
||||||
public interface AuthenticatedCipher {
|
interface AuthenticatedCipher {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes this cipher for encryption or decryption with a key and an
|
* Initializes this cipher for encryption or decryption with a key and an
|
||||||
@@ -6,7 +6,6 @@ import net.i2p.crypto.eddsa.KeyPairGenerator;
|
|||||||
|
|
||||||
import org.briarproject.bramble.api.crypto.AgreementPrivateKey;
|
import org.briarproject.bramble.api.crypto.AgreementPrivateKey;
|
||||||
import org.briarproject.bramble.api.crypto.AgreementPublicKey;
|
import org.briarproject.bramble.api.crypto.AgreementPublicKey;
|
||||||
import org.briarproject.bramble.api.crypto.AuthenticatedCipher;
|
|
||||||
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
||||||
import org.briarproject.bramble.api.crypto.DecryptionException;
|
import org.briarproject.bramble.api.crypto.DecryptionException;
|
||||||
import org.briarproject.bramble.api.crypto.KeyPair;
|
import org.briarproject.bramble.api.crypto.KeyPair;
|
||||||
@@ -21,9 +20,9 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
|||||||
import org.briarproject.bramble.api.system.SecureRandomProvider;
|
import org.briarproject.bramble.api.system.SecureRandomProvider;
|
||||||
import org.briarproject.bramble.util.ByteUtils;
|
import org.briarproject.bramble.util.ByteUtils;
|
||||||
import org.briarproject.bramble.util.StringUtils;
|
import org.briarproject.bramble.util.StringUtils;
|
||||||
import org.bouncycastle.crypto.CryptoException;
|
import org.spongycastle.crypto.CryptoException;
|
||||||
import org.bouncycastle.crypto.Digest;
|
import org.spongycastle.crypto.Digest;
|
||||||
import org.bouncycastle.crypto.digests.Blake2bDigest;
|
import org.spongycastle.crypto.digests.Blake2bDigest;
|
||||||
import org.whispersystems.curve25519.Curve25519;
|
import org.whispersystems.curve25519.Curve25519;
|
||||||
import org.whispersystems.curve25519.Curve25519KeyPair;
|
import org.whispersystems.curve25519.Curve25519KeyPair;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.briarproject.bramble.crypto;
|
package org.briarproject.bramble.crypto;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.crypto.AuthenticatedCipher;
|
|
||||||
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
||||||
import org.briarproject.bramble.api.crypto.KeyAgreementCrypto;
|
import org.briarproject.bramble.api.crypto.KeyAgreementCrypto;
|
||||||
import org.briarproject.bramble.api.crypto.PasswordStrengthEstimator;
|
import org.briarproject.bramble.api.crypto.PasswordStrengthEstimator;
|
||||||
|
|||||||
@@ -6,33 +6,33 @@ import org.briarproject.bramble.api.crypto.PrivateKey;
|
|||||||
import org.briarproject.bramble.api.crypto.PublicKey;
|
import org.briarproject.bramble.api.crypto.PublicKey;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.briarproject.bramble.util.StringUtils;
|
import org.briarproject.bramble.util.StringUtils;
|
||||||
import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves;
|
import org.spongycastle.asn1.teletrust.TeleTrusTNamedCurves;
|
||||||
import org.bouncycastle.asn1.x9.X9ECParameters;
|
import org.spongycastle.asn1.x9.X9ECParameters;
|
||||||
import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
|
import org.spongycastle.crypto.AsymmetricCipherKeyPair;
|
||||||
import org.bouncycastle.crypto.BasicAgreement;
|
import org.spongycastle.crypto.BasicAgreement;
|
||||||
import org.bouncycastle.crypto.BlockCipher;
|
import org.spongycastle.crypto.BlockCipher;
|
||||||
import org.bouncycastle.crypto.CipherParameters;
|
import org.spongycastle.crypto.CipherParameters;
|
||||||
import org.bouncycastle.crypto.CryptoException;
|
import org.spongycastle.crypto.CryptoException;
|
||||||
import org.bouncycastle.crypto.DerivationFunction;
|
import org.spongycastle.crypto.DerivationFunction;
|
||||||
import org.bouncycastle.crypto.KeyEncoder;
|
import org.spongycastle.crypto.KeyEncoder;
|
||||||
import org.bouncycastle.crypto.Mac;
|
import org.spongycastle.crypto.Mac;
|
||||||
import org.bouncycastle.crypto.agreement.ECDHCBasicAgreement;
|
import org.spongycastle.crypto.agreement.ECDHCBasicAgreement;
|
||||||
import org.bouncycastle.crypto.digests.SHA256Digest;
|
import org.spongycastle.crypto.digests.SHA256Digest;
|
||||||
import org.bouncycastle.crypto.engines.AESLightEngine;
|
import org.spongycastle.crypto.engines.AESLightEngine;
|
||||||
import org.bouncycastle.crypto.engines.IESEngine;
|
import org.spongycastle.crypto.engines.IESEngine;
|
||||||
import org.bouncycastle.crypto.generators.ECKeyPairGenerator;
|
import org.spongycastle.crypto.generators.ECKeyPairGenerator;
|
||||||
import org.bouncycastle.crypto.generators.EphemeralKeyPairGenerator;
|
import org.spongycastle.crypto.generators.EphemeralKeyPairGenerator;
|
||||||
import org.bouncycastle.crypto.generators.KDF2BytesGenerator;
|
import org.spongycastle.crypto.generators.KDF2BytesGenerator;
|
||||||
import org.bouncycastle.crypto.macs.HMac;
|
import org.spongycastle.crypto.macs.HMac;
|
||||||
import org.bouncycastle.crypto.modes.CBCBlockCipher;
|
import org.spongycastle.crypto.modes.CBCBlockCipher;
|
||||||
import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher;
|
import org.spongycastle.crypto.paddings.PaddedBufferedBlockCipher;
|
||||||
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
|
import org.spongycastle.crypto.params.AsymmetricKeyParameter;
|
||||||
import org.bouncycastle.crypto.params.ECDomainParameters;
|
import org.spongycastle.crypto.params.ECDomainParameters;
|
||||||
import org.bouncycastle.crypto.params.ECKeyGenerationParameters;
|
import org.spongycastle.crypto.params.ECKeyGenerationParameters;
|
||||||
import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
|
import org.spongycastle.crypto.params.ECPrivateKeyParameters;
|
||||||
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
|
import org.spongycastle.crypto.params.ECPublicKeyParameters;
|
||||||
import org.bouncycastle.crypto.params.IESWithCipherParameters;
|
import org.spongycastle.crypto.params.IESWithCipherParameters;
|
||||||
import org.bouncycastle.crypto.parsers.ECIESPublicKeyParser;
|
import org.spongycastle.crypto.parsers.ECIESPublicKeyParser;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
|||||||
@@ -3,22 +3,20 @@ package org.briarproject.bramble.crypto;
|
|||||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
import org.briarproject.bramble.api.system.Clock;
|
import org.briarproject.bramble.api.system.Clock;
|
||||||
import org.briarproject.bramble.util.StringUtils;
|
import org.briarproject.bramble.util.StringUtils;
|
||||||
import org.bouncycastle.crypto.generators.SCrypt;
|
import org.spongycastle.crypto.generators.SCrypt;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import static java.lang.Math.min;
|
|
||||||
import static java.util.logging.Level.INFO;
|
import static java.util.logging.Level.INFO;
|
||||||
import static java.util.logging.Logger.getLogger;
|
|
||||||
import static org.briarproject.bramble.util.LogUtils.logDuration;
|
import static org.briarproject.bramble.util.LogUtils.logDuration;
|
||||||
import static org.briarproject.bramble.util.LogUtils.now;
|
import static org.briarproject.bramble.util.LogUtils.now;
|
||||||
|
|
||||||
class ScryptKdf implements PasswordBasedKdf {
|
class ScryptKdf implements PasswordBasedKdf {
|
||||||
|
|
||||||
private static final Logger LOG =
|
private static final Logger LOG =
|
||||||
getLogger(ScryptKdf.class.getName());
|
Logger.getLogger(ScryptKdf.class.getName());
|
||||||
|
|
||||||
private static final int MIN_COST = 256; // Min parameter N
|
private static final int MIN_COST = 256; // Min parameter N
|
||||||
private static final int MAX_COST = 1024 * 1024; // Max parameter N
|
private static final int MAX_COST = 1024 * 1024; // Max parameter N
|
||||||
@@ -35,20 +33,10 @@ class ScryptKdf implements PasswordBasedKdf {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int chooseCostParameter() {
|
public int chooseCostParameter() {
|
||||||
// Scrypt uses at least 128 * N * r bytes of memory. Don't use more
|
|
||||||
// than half of the JVM's max heap size or we may run out of memory.
|
|
||||||
// https://blog.filippo.io/the-scrypt-parameters/
|
|
||||||
long maxMemory = Runtime.getRuntime().maxMemory();
|
|
||||||
long maxCost = min(MAX_COST, maxMemory / BLOCK_SIZE / 256);
|
|
||||||
if (LOG.isLoggable(INFO) && maxCost < MAX_COST) {
|
|
||||||
LOG.info("Max cost capped at " + maxCost
|
|
||||||
+ " due to max heap size " + maxMemory);
|
|
||||||
}
|
|
||||||
// Increase the cost from min to max while measuring performance
|
// Increase the cost from min to max while measuring performance
|
||||||
int cost = MIN_COST;
|
int cost = MIN_COST;
|
||||||
while (cost * 2 <= maxCost && measureDuration(cost) * 2 <= TARGET_MS) {
|
while (cost * 2 <= MAX_COST && measureDuration(cost) * 2 <= TARGET_MS)
|
||||||
cost *= 2;
|
cost *= 2;
|
||||||
}
|
|
||||||
if (LOG.isLoggable(INFO))
|
if (LOG.isLoggable(INFO))
|
||||||
LOG.info("KDF cost parameter " + cost);
|
LOG.info("KDF cost parameter " + cost);
|
||||||
return cost;
|
return cost;
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import org.briarproject.bramble.api.crypto.KeyParser;
|
|||||||
import org.briarproject.bramble.api.crypto.PrivateKey;
|
import org.briarproject.bramble.api.crypto.PrivateKey;
|
||||||
import org.briarproject.bramble.api.crypto.PublicKey;
|
import org.briarproject.bramble.api.crypto.PublicKey;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.bouncycastle.crypto.params.ECDomainParameters;
|
import org.spongycastle.crypto.params.ECDomainParameters;
|
||||||
import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
|
import org.spongycastle.crypto.params.ECPrivateKeyParameters;
|
||||||
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
|
import org.spongycastle.crypto.params.ECPublicKeyParameters;
|
||||||
import org.bouncycastle.math.ec.ECCurve;
|
import org.spongycastle.math.ec.ECCurve;
|
||||||
import org.bouncycastle.math.ec.ECPoint;
|
import org.spongycastle.math.ec.ECPoint;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.briarproject.bramble.crypto;
|
|||||||
|
|
||||||
import org.briarproject.bramble.api.crypto.PrivateKey;
|
import org.briarproject.bramble.api.crypto.PrivateKey;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.bouncycastle.crypto.params.ECPrivateKeyParameters;
|
import org.spongycastle.crypto.params.ECPrivateKeyParameters;
|
||||||
|
|
||||||
import javax.annotation.concurrent.Immutable;
|
import javax.annotation.concurrent.Immutable;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.briarproject.bramble.crypto;
|
|||||||
|
|
||||||
import org.briarproject.bramble.api.crypto.PublicKey;
|
import org.briarproject.bramble.api.crypto.PublicKey;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.bouncycastle.crypto.params.ECPublicKeyParameters;
|
import org.spongycastle.crypto.params.ECPublicKeyParameters;
|
||||||
|
|
||||||
import javax.annotation.concurrent.Immutable;
|
import javax.annotation.concurrent.Immutable;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.briarproject.bramble.crypto;
|
package org.briarproject.bramble.crypto;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.crypto.AuthenticatedCipher;
|
|
||||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
import org.briarproject.bramble.api.crypto.StreamDecrypter;
|
import org.briarproject.bramble.api.crypto.StreamDecrypter;
|
||||||
import org.briarproject.bramble.api.crypto.StreamDecrypterFactory;
|
import org.briarproject.bramble.api.crypto.StreamDecrypterFactory;
|
||||||
@@ -37,10 +36,4 @@ class StreamDecrypterFactoryImpl implements StreamDecrypterFactory {
|
|||||||
SecretKey headerKey) {
|
SecretKey headerKey) {
|
||||||
return new StreamDecrypterImpl(in, cipherProvider.get(), 0, headerKey);
|
return new StreamDecrypterImpl(in, cipherProvider.get(), 0, headerKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public StreamDecrypter createLogStreamDecrypter(InputStream in,
|
|
||||||
SecretKey headerKey) {
|
|
||||||
return createContactExchangeStreamDecrypter(in, headerKey);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package org.briarproject.bramble.crypto;
|
package org.briarproject.bramble.crypto;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.FormatException;
|
import org.briarproject.bramble.api.FormatException;
|
||||||
import org.briarproject.bramble.api.crypto.AuthenticatedCipher;
|
|
||||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
import org.briarproject.bramble.api.crypto.StreamDecrypter;
|
import org.briarproject.bramble.api.crypto.StreamDecrypter;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.briarproject.bramble.crypto;
|
package org.briarproject.bramble.crypto;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.crypto.AuthenticatedCipher;
|
|
||||||
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
||||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
import org.briarproject.bramble.api.crypto.StreamEncrypter;
|
import org.briarproject.bramble.api.crypto.StreamEncrypter;
|
||||||
@@ -52,7 +51,7 @@ class StreamEncrypterFactoryImpl implements StreamEncrypterFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamEncrypter createContactExchangeStreamEncrypter(
|
public StreamEncrypter createContactExchangeStreamDecrypter(
|
||||||
OutputStream out, SecretKey headerKey) {
|
OutputStream out, SecretKey headerKey) {
|
||||||
AuthenticatedCipher cipher = cipherProvider.get();
|
AuthenticatedCipher cipher = cipherProvider.get();
|
||||||
byte[] streamHeaderNonce = new byte[STREAM_HEADER_NONCE_LENGTH];
|
byte[] streamHeaderNonce = new byte[STREAM_HEADER_NONCE_LENGTH];
|
||||||
@@ -61,10 +60,4 @@ class StreamEncrypterFactoryImpl implements StreamEncrypterFactory {
|
|||||||
return new StreamEncrypterImpl(out, cipher, 0, null, streamHeaderNonce,
|
return new StreamEncrypterImpl(out, cipher, 0, null, streamHeaderNonce,
|
||||||
headerKey, frameKey);
|
headerKey, frameKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public StreamEncrypter createLogStreamEncrypter(OutputStream out,
|
|
||||||
SecretKey headerKey) {
|
|
||||||
return createContactExchangeStreamEncrypter(out, headerKey);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.briarproject.bramble.crypto;
|
package org.briarproject.bramble.crypto;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.crypto.AuthenticatedCipher;
|
|
||||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
import org.briarproject.bramble.api.crypto.StreamEncrypter;
|
import org.briarproject.bramble.api.crypto.StreamEncrypter;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import org.briarproject.bramble.api.plugin.TransportId;
|
|||||||
import org.briarproject.bramble.api.transport.IncomingKeys;
|
import org.briarproject.bramble.api.transport.IncomingKeys;
|
||||||
import org.briarproject.bramble.api.transport.OutgoingKeys;
|
import org.briarproject.bramble.api.transport.OutgoingKeys;
|
||||||
import org.briarproject.bramble.api.transport.TransportKeys;
|
import org.briarproject.bramble.api.transport.TransportKeys;
|
||||||
import org.bouncycastle.crypto.Digest;
|
import org.spongycastle.crypto.Digest;
|
||||||
import org.bouncycastle.crypto.digests.Blake2bDigest;
|
import org.spongycastle.crypto.digests.Blake2bDigest;
|
||||||
|
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
package org.briarproject.bramble.crypto;
|
package org.briarproject.bramble.crypto;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.crypto.AuthenticatedCipher;
|
|
||||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.bouncycastle.crypto.DataLengthException;
|
import org.spongycastle.crypto.DataLengthException;
|
||||||
import org.bouncycastle.crypto.engines.XSalsa20Engine;
|
import org.spongycastle.crypto.engines.XSalsa20Engine;
|
||||||
import org.bouncycastle.crypto.generators.Poly1305KeyGenerator;
|
import org.spongycastle.crypto.generators.Poly1305KeyGenerator;
|
||||||
import org.bouncycastle.crypto.macs.Poly1305;
|
import org.spongycastle.crypto.macs.Poly1305;
|
||||||
import org.bouncycastle.crypto.params.KeyParameter;
|
import org.spongycastle.crypto.params.KeyParameter;
|
||||||
import org.bouncycastle.crypto.params.ParametersWithIV;
|
import org.spongycastle.crypto.params.ParametersWithIV;
|
||||||
|
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import org.briarproject.bramble.api.transport.KeySetId;
|
|||||||
import org.briarproject.bramble.api.transport.TransportKeySet;
|
import org.briarproject.bramble.api.transport.TransportKeySet;
|
||||||
import org.briarproject.bramble.api.transport.TransportKeys;
|
import org.briarproject.bramble.api.transport.TransportKeys;
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -696,11 +695,6 @@ interface Database<T> {
|
|||||||
void setHandshakeKeyPair(T txn, AuthorId local, PublicKey publicKey,
|
void setHandshakeKeyPair(T txn, AuthorId local, PublicKey publicKey,
|
||||||
PrivateKey privateKey) throws DbException;
|
PrivateKey privateKey) throws DbException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the handshake public key for a given contact
|
|
||||||
*/
|
|
||||||
void setHandshakePublicKey(T txn, ContactId c, PublicKey handshakePublicKey) throws DbException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks the given message as permanent, i.e. not temporary.
|
* Marks the given message as permanent, i.e. not temporary.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1040,15 +1040,6 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHandshakePublicKey(Transaction transaction, ContactId c, PublicKey handshakePublicKey) throws DbException {
|
|
||||||
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
|
||||||
T txn = unbox(transaction);
|
|
||||||
if (!db.containsContact(txn, c))
|
|
||||||
throw new NoSuchContactException();
|
|
||||||
db.setHandshakePublicKey(txn, c, handshakePublicKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHandshakeKeyPair(Transaction transaction, AuthorId local,
|
public void setHandshakeKeyPair(Transaction transaction, AuthorId local,
|
||||||
PublicKey publicKey, PrivateKey privateKey) throws DbException {
|
PublicKey publicKey, PrivateKey privateKey) throws DbException {
|
||||||
|
|||||||
@@ -3058,23 +3058,6 @@ abstract class JdbcDatabase implements Database<Connection> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHandshakePublicKey(Connection txn, ContactId c, PublicKey handshakePublicKey) throws DbException {
|
|
||||||
PreparedStatement ps = null;
|
|
||||||
try {
|
|
||||||
String sql = "UPDATE contacts SET handshakePublicKey = ? WHERE contactId = ?";
|
|
||||||
ps = txn.prepareStatement(sql);
|
|
||||||
ps.setBytes(1, handshakePublicKey.getEncoded());
|
|
||||||
ps.setInt(2, c.getInt());
|
|
||||||
int affected = ps.executeUpdate();
|
|
||||||
if (affected < 0 || affected > 1) throw new DbStateException();
|
|
||||||
ps.close();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
tryToClose(ps, LOG, WARNING);
|
|
||||||
throw new DbException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setGroupVisibility(Connection txn, ContactId c, GroupId g,
|
public void setGroupVisibility(Connection txn, ContactId c, GroupId g,
|
||||||
boolean shared) throws DbException {
|
boolean shared) throws DbException {
|
||||||
|
|||||||
@@ -118,11 +118,6 @@ class IdentityManagerImpl implements IdentityManager, OpenDatabaseHook {
|
|||||||
return cached.getLocalAuthor();
|
return cached.getLocalAuthor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Identity getIdentity(Transaction txn) throws DbException {
|
|
||||||
return getCachedIdentity(txn);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalAuthor getLocalAuthor(Transaction txn) throws DbException {
|
public LocalAuthor getLocalAuthor(Transaction txn) throws DbException {
|
||||||
return getCachedIdentity(txn).getLocalAuthor();
|
return getCachedIdentity(txn).getLocalAuthor();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package org.briarproject.bramble.keyagreement;
|
package org.briarproject.bramble.keyagreement;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.Pair;
|
|
||||||
import org.briarproject.bramble.api.crypto.KeyAgreementCrypto;
|
import org.briarproject.bramble.api.crypto.KeyAgreementCrypto;
|
||||||
import org.briarproject.bramble.api.crypto.KeyPair;
|
import org.briarproject.bramble.api.crypto.KeyPair;
|
||||||
import org.briarproject.bramble.api.data.BdfList;
|
import org.briarproject.bramble.api.data.BdfList;
|
||||||
@@ -9,8 +8,6 @@ import org.briarproject.bramble.api.keyagreement.KeyAgreementListener;
|
|||||||
import org.briarproject.bramble.api.keyagreement.Payload;
|
import org.briarproject.bramble.api.keyagreement.Payload;
|
||||||
import org.briarproject.bramble.api.keyagreement.TransportDescriptor;
|
import org.briarproject.bramble.api.keyagreement.TransportDescriptor;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.briarproject.bramble.api.plugin.BluetoothConstants;
|
|
||||||
import org.briarproject.bramble.api.plugin.LanTcpConstants;
|
|
||||||
import org.briarproject.bramble.api.plugin.Plugin;
|
import org.briarproject.bramble.api.plugin.Plugin;
|
||||||
import org.briarproject.bramble.api.plugin.PluginManager;
|
import org.briarproject.bramble.api.plugin.PluginManager;
|
||||||
import org.briarproject.bramble.api.plugin.TransportId;
|
import org.briarproject.bramble.api.plugin.TransportId;
|
||||||
@@ -22,9 +19,7 @@ import org.briarproject.bramble.api.record.RecordWriterFactory;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
@@ -33,10 +28,8 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import static java.util.Arrays.asList;
|
|
||||||
import static java.util.logging.Level.INFO;
|
import static java.util.logging.Level.INFO;
|
||||||
import static java.util.logging.Level.WARNING;
|
import static java.util.logging.Level.WARNING;
|
||||||
import static java.util.logging.Logger.getLogger;
|
|
||||||
import static org.briarproject.bramble.api.keyagreement.KeyAgreementConstants.CONNECTION_TIMEOUT;
|
import static org.briarproject.bramble.api.keyagreement.KeyAgreementConstants.CONNECTION_TIMEOUT;
|
||||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||||
|
|
||||||
@@ -48,10 +41,7 @@ class KeyAgreementConnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final Logger LOG =
|
private static final Logger LOG =
|
||||||
getLogger(KeyAgreementConnector.class.getName());
|
Logger.getLogger(KeyAgreementConnector.class.getName());
|
||||||
|
|
||||||
private static final List<TransportId> PREFERRED_TRANSPORTS =
|
|
||||||
asList(BluetoothConstants.ID, LanTcpConstants.ID);
|
|
||||||
|
|
||||||
private final Callbacks callbacks;
|
private final Callbacks callbacks;
|
||||||
private final KeyAgreementCrypto keyAgreementCrypto;
|
private final KeyAgreementCrypto keyAgreementCrypto;
|
||||||
@@ -115,39 +105,24 @@ class KeyAgreementConnector {
|
|||||||
this.alice = alice;
|
this.alice = alice;
|
||||||
aliceLatch.countDown();
|
aliceLatch.countDown();
|
||||||
|
|
||||||
// Start connecting over supported transports in order of preference
|
// Start connecting over supported transports
|
||||||
if (LOG.isLoggable(INFO)) {
|
if (LOG.isLoggable(INFO)) {
|
||||||
LOG.info("Starting outgoing BQP connections as "
|
LOG.info("Starting outgoing BQP connections as "
|
||||||
+ (alice ? "Alice" : "Bob"));
|
+ (alice ? "Alice" : "Bob"));
|
||||||
}
|
}
|
||||||
Map<TransportId, TransportDescriptor> descriptors = new HashMap<>();
|
|
||||||
for (TransportDescriptor d : remotePayload.getTransportDescriptors()) {
|
for (TransportDescriptor d : remotePayload.getTransportDescriptors()) {
|
||||||
descriptors.put(d.getId(), d);
|
Plugin p = pluginManager.getPlugin(d.getId());
|
||||||
}
|
if (p instanceof DuplexPlugin) {
|
||||||
List<Pair<DuplexPlugin, BdfList>> transports = new ArrayList<>();
|
|
||||||
for (TransportId id : PREFERRED_TRANSPORTS) {
|
|
||||||
TransportDescriptor d = descriptors.get(id);
|
|
||||||
LOG.info("id: " + id + " d: " + d);
|
|
||||||
Plugin p = pluginManager.getPlugin(id);
|
|
||||||
if (d != null && p instanceof DuplexPlugin) {
|
|
||||||
if (LOG.isLoggable(INFO))
|
if (LOG.isLoggable(INFO))
|
||||||
LOG.info("Connecting via " + id);
|
LOG.info("Connecting via " + d.getId());
|
||||||
transports.add(new Pair<>((DuplexPlugin) p, d.getDescriptor()));
|
DuplexPlugin plugin = (DuplexPlugin) p;
|
||||||
|
byte[] commitment = remotePayload.getCommitment();
|
||||||
|
BdfList descriptor = d.getDescriptor();
|
||||||
|
connectionChooser.submit(new ReadableTask(
|
||||||
|
new ConnectorTask(plugin, commitment, descriptor)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: If we don't have any transports in common with the peer,
|
|
||||||
// warn the user and give up (#1224)
|
|
||||||
if (transports.isEmpty()) {
|
|
||||||
LOG.info("No transports found");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!transports.isEmpty()) {
|
|
||||||
byte[] commitment = remotePayload.getCommitment();
|
|
||||||
connectionChooser.submit(new ReadableTask(new ConnectorTask(
|
|
||||||
transports, commitment)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get chosen connection
|
// Get chosen connection
|
||||||
try {
|
try {
|
||||||
KeyAgreementConnection chosen =
|
KeyAgreementConnection chosen =
|
||||||
@@ -173,13 +148,15 @@ class KeyAgreementConnector {
|
|||||||
|
|
||||||
private class ConnectorTask implements Callable<KeyAgreementConnection> {
|
private class ConnectorTask implements Callable<KeyAgreementConnection> {
|
||||||
|
|
||||||
private final List<Pair<DuplexPlugin, BdfList>> transports;
|
|
||||||
private final byte[] commitment;
|
private final byte[] commitment;
|
||||||
|
private final BdfList descriptor;
|
||||||
|
private final DuplexPlugin plugin;
|
||||||
|
|
||||||
private ConnectorTask(List<Pair<DuplexPlugin, BdfList>> transports,
|
private ConnectorTask(DuplexPlugin plugin, byte[] commitment,
|
||||||
byte[] commitment) {
|
BdfList descriptor) {
|
||||||
this.transports = transports;
|
this.plugin = plugin;
|
||||||
this.commitment = commitment;
|
this.commitment = commitment;
|
||||||
|
this.descriptor = descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -187,18 +164,13 @@ class KeyAgreementConnector {
|
|||||||
public KeyAgreementConnection call() throws Exception {
|
public KeyAgreementConnection call() throws Exception {
|
||||||
// Repeat attempts until we connect, get stopped, or get interrupted
|
// Repeat attempts until we connect, get stopped, or get interrupted
|
||||||
while (!stopped) {
|
while (!stopped) {
|
||||||
for (Pair<DuplexPlugin, BdfList> pair : transports) {
|
DuplexTransportConnection conn =
|
||||||
if (stopped) return null;
|
plugin.createKeyAgreementConnection(commitment,
|
||||||
DuplexPlugin plugin = pair.getFirst();
|
descriptor);
|
||||||
BdfList descriptor = pair.getSecond();
|
if (conn != null) {
|
||||||
DuplexTransportConnection conn =
|
if (LOG.isLoggable(INFO))
|
||||||
plugin.createKeyAgreementConnection(commitment,
|
LOG.info(plugin.getId() + ": Outgoing connection");
|
||||||
descriptor);
|
return new KeyAgreementConnection(conn, plugin.getId());
|
||||||
if (conn != null) {
|
|
||||||
if (LOG.isLoggable(INFO))
|
|
||||||
LOG.info(plugin.getId() + ": Outgoing connection");
|
|
||||||
return new KeyAgreementConnection(conn, plugin.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Wait 2s before retry (to circumvent transient failures)
|
// Wait 2s before retry (to circumvent transient failures)
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ class KeyAgreementTransport {
|
|||||||
Logger.getLogger(KeyAgreementTransport.class.getName());
|
Logger.getLogger(KeyAgreementTransport.class.getName());
|
||||||
|
|
||||||
// Accept records with current protocol version, known record type
|
// Accept records with current protocol version, known record type
|
||||||
private static final Predicate<Record> ACCEPT = r ->
|
private static Predicate<Record> ACCEPT = r ->
|
||||||
r.getProtocolVersion() == PROTOCOL_VERSION &&
|
r.getProtocolVersion() == PROTOCOL_VERSION &&
|
||||||
isKnownRecordType(r.getRecordType());
|
isKnownRecordType(r.getRecordType());
|
||||||
|
|
||||||
// Ignore records with current protocol version, unknown record type
|
// Ignore records with current protocol version, unknown record type
|
||||||
private static final Predicate<Record> IGNORE = r ->
|
private static Predicate<Record> IGNORE = r ->
|
||||||
r.getProtocolVersion() == PROTOCOL_VERSION &&
|
r.getProtocolVersion() == PROTOCOL_VERSION &&
|
||||||
!isKnownRecordType(r.getRecordType());
|
!isKnownRecordType(r.getRecordType());
|
||||||
|
|
||||||
|
|||||||
@@ -436,10 +436,8 @@ abstract class BluetoothPlugin<S, SS> implements DuplexPlugin, EventListener {
|
|||||||
String uuid = UUID.nameUUIDFromBytes(commitment).toString();
|
String uuid = UUID.nameUUIDFromBytes(commitment).toString();
|
||||||
DuplexTransportConnection conn;
|
DuplexTransportConnection conn;
|
||||||
if (descriptor.size() == 1) {
|
if (descriptor.size() == 1) {
|
||||||
if (LOG.isLoggable(INFO)) {
|
if (LOG.isLoggable(INFO))
|
||||||
LOG.info("Discovering address for key agreement UUID " +
|
LOG.info("Discovering address for key agreement UUID " + uuid);
|
||||||
uuid);
|
|
||||||
}
|
|
||||||
conn = discoverAndConnect(uuid);
|
conn = discoverAndConnect(uuid);
|
||||||
} else {
|
} else {
|
||||||
String address;
|
String address;
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
private final CircumventionProvider circumventionProvider;
|
private final CircumventionProvider circumventionProvider;
|
||||||
private final ResourceProvider resourceProvider;
|
private final ResourceProvider resourceProvider;
|
||||||
private final int maxLatency, maxIdleTime, socketTimeout;
|
private final int maxLatency, maxIdleTime, socketTimeout;
|
||||||
private final File torDirectory, geoIpFile, configFile;
|
private final File torDirectory, torFile, geoIpFile, obfs4File, configFile;
|
||||||
private final File doneFile, cookieFile;
|
private final File doneFile, cookieFile;
|
||||||
private final AtomicBoolean used = new AtomicBoolean(false);
|
private final AtomicBoolean used = new AtomicBoolean(false);
|
||||||
|
|
||||||
@@ -181,7 +181,9 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
socketTimeout = Integer.MAX_VALUE;
|
socketTimeout = Integer.MAX_VALUE;
|
||||||
else socketTimeout = maxIdleTime * 2;
|
else socketTimeout = maxIdleTime * 2;
|
||||||
this.torDirectory = torDirectory;
|
this.torDirectory = torDirectory;
|
||||||
|
torFile = new File(torDirectory, "tor");
|
||||||
geoIpFile = new File(torDirectory, "geoip");
|
geoIpFile = new File(torDirectory, "geoip");
|
||||||
|
obfs4File = new File(torDirectory, "obfs4proxy");
|
||||||
configFile = new File(torDirectory, "torrc");
|
configFile = new File(torDirectory, "torrc");
|
||||||
doneFile = new File(torDirectory, "done");
|
doneFile = new File(torDirectory, "done");
|
||||||
cookieFile = new File(torDirectory, ".tor/control_auth_cookie");
|
cookieFile = new File(torDirectory, ".tor/control_auth_cookie");
|
||||||
@@ -190,14 +192,6 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
new PoliteExecutor("TorPlugin", ioExecutor, 1);
|
new PoliteExecutor("TorPlugin", ioExecutor, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected File getTorExecutableFile() {
|
|
||||||
return new File(torDirectory, "tor");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected File getObfs4ExecutableFile() {
|
|
||||||
return new File(torDirectory, "obfs4proxy");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TransportId getId() {
|
public TransportId getId() {
|
||||||
return TorConstants.ID;
|
return TorConstants.ID;
|
||||||
@@ -230,7 +224,6 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
LOG.warning("Old auth cookie not deleted");
|
LOG.warning("Old auth cookie not deleted");
|
||||||
// Start a new Tor process
|
// Start a new Tor process
|
||||||
LOG.info("Starting Tor");
|
LOG.info("Starting Tor");
|
||||||
File torFile = getTorExecutableFile();
|
|
||||||
String torPath = torFile.getAbsolutePath();
|
String torPath = torFile.getAbsolutePath();
|
||||||
String configPath = configFile.getAbsolutePath();
|
String configPath = configFile.getAbsolutePath();
|
||||||
String pid = String.valueOf(getProcessId());
|
String pid = String.valueOf(getProcessId());
|
||||||
@@ -329,43 +322,44 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void installAssets() throws PluginException {
|
private void installAssets() throws PluginException {
|
||||||
|
InputStream in = null;
|
||||||
|
OutputStream out = null;
|
||||||
try {
|
try {
|
||||||
// The done file may already exist from a previous installation
|
// The done file may already exist from a previous installation
|
||||||
//noinspection ResultOfMethodCallIgnored
|
//noinspection ResultOfMethodCallIgnored
|
||||||
doneFile.delete();
|
doneFile.delete();
|
||||||
installTorExecutable();
|
// Unzip the Tor binary to the filesystem
|
||||||
installObfs4Executable();
|
in = getTorInputStream();
|
||||||
extract(getGeoIpInputStream(), geoIpFile);
|
out = new FileOutputStream(torFile);
|
||||||
extract(getConfigInputStream(), configFile);
|
copyAndClose(in, out);
|
||||||
|
// Make the Tor binary executable
|
||||||
|
if (!torFile.setExecutable(true, true)) throw new IOException();
|
||||||
|
// Unzip the GeoIP database to the filesystem
|
||||||
|
in = getGeoIpInputStream();
|
||||||
|
out = new FileOutputStream(geoIpFile);
|
||||||
|
copyAndClose(in, out);
|
||||||
|
// Unzip the Obfs4 proxy to the filesystem
|
||||||
|
in = getObfs4InputStream();
|
||||||
|
out = new FileOutputStream(obfs4File);
|
||||||
|
copyAndClose(in, out);
|
||||||
|
// Make the Obfs4 proxy executable
|
||||||
|
if (!obfs4File.setExecutable(true, true)) throw new IOException();
|
||||||
|
// Copy the config file to the filesystem
|
||||||
|
in = getConfigInputStream();
|
||||||
|
out = new FileOutputStream(configFile);
|
||||||
|
copyAndClose(in, out);
|
||||||
if (!doneFile.createNewFile())
|
if (!doneFile.createNewFile())
|
||||||
LOG.warning("Failed to create done file");
|
LOG.warning("Failed to create done file");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
tryToClose(in, LOG, WARNING);
|
||||||
|
tryToClose(out, LOG, WARNING);
|
||||||
throw new PluginException(e);
|
throw new PluginException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void extract(InputStream in, File dest) throws IOException {
|
private InputStream getTorInputStream() throws IOException {
|
||||||
OutputStream out = new FileOutputStream(dest);
|
|
||||||
copyAndClose(in, out);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void installTorExecutable() throws IOException {
|
|
||||||
if (LOG.isLoggable(INFO))
|
if (LOG.isLoggable(INFO))
|
||||||
LOG.info("Installing Tor binary for " + architecture);
|
LOG.info("Installing Tor binary for " + architecture);
|
||||||
File torFile = getTorExecutableFile();
|
|
||||||
extract(getTorInputStream(), torFile);
|
|
||||||
if (!torFile.setExecutable(true, true)) throw new IOException();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void installObfs4Executable() throws IOException {
|
|
||||||
if (LOG.isLoggable(INFO))
|
|
||||||
LOG.info("Installing obfs4proxy binary for " + architecture);
|
|
||||||
File obfs4File = getObfs4ExecutableFile();
|
|
||||||
extract(getObfs4InputStream(), obfs4File);
|
|
||||||
if (!obfs4File.setExecutable(true, true)) throw new IOException();
|
|
||||||
}
|
|
||||||
|
|
||||||
private InputStream getTorInputStream() throws IOException {
|
|
||||||
InputStream in = resourceProvider
|
InputStream in = resourceProvider
|
||||||
.getResourceInputStream("tor_" + architecture, ".zip");
|
.getResourceInputStream("tor_" + architecture, ".zip");
|
||||||
ZipInputStream zin = new ZipInputStream(in);
|
ZipInputStream zin = new ZipInputStream(in);
|
||||||
@@ -382,6 +376,8 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private InputStream getObfs4InputStream() throws IOException {
|
private InputStream getObfs4InputStream() throws IOException {
|
||||||
|
if (LOG.isLoggable(INFO))
|
||||||
|
LOG.info("Installing obfs4proxy binary for " + architecture);
|
||||||
InputStream in = resourceProvider
|
InputStream in = resourceProvider
|
||||||
.getResourceInputStream("obfs4proxy_" + architecture, ".zip");
|
.getResourceInputStream("obfs4proxy_" + architecture, ".zip");
|
||||||
ZipInputStream zin = new ZipInputStream(in);
|
ZipInputStream zin = new ZipInputStream(in);
|
||||||
@@ -573,7 +569,6 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
if (enable) {
|
if (enable) {
|
||||||
Collection<String> conf = new ArrayList<>();
|
Collection<String> conf = new ArrayList<>();
|
||||||
conf.add("UseBridges 1");
|
conf.add("UseBridges 1");
|
||||||
File obfs4File = getObfs4ExecutableFile();
|
|
||||||
if (needsMeek) {
|
if (needsMeek) {
|
||||||
conf.add("ClientTransportPlugin meek_lite exec " +
|
conf.add("ClientTransportPlugin meek_lite exec " +
|
||||||
obfs4File.getAbsolutePath());
|
obfs4File.getAbsolutePath());
|
||||||
@@ -863,7 +858,6 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
if (!state.isTorRunning()) return;
|
if (!state.isTorRunning()) return;
|
||||||
boolean online = status.isConnected();
|
boolean online = status.isConnected();
|
||||||
boolean wifi = status.isWifi();
|
boolean wifi = status.isWifi();
|
||||||
boolean ipv6Only = status.isIpv6Only();
|
|
||||||
String country = locationUtils.getCurrentCountry();
|
String country = locationUtils.getCurrentCountry();
|
||||||
boolean blocked =
|
boolean blocked =
|
||||||
circumventionProvider.isTorProbablyBlocked(country);
|
circumventionProvider.isTorProbablyBlocked(country);
|
||||||
@@ -880,8 +874,7 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
boolean automatic = network == PREF_TOR_NETWORK_AUTOMATIC;
|
boolean automatic = network == PREF_TOR_NETWORK_AUTOMATIC;
|
||||||
|
|
||||||
if (LOG.isLoggable(INFO)) {
|
if (LOG.isLoggable(INFO)) {
|
||||||
LOG.info("Online: " + online + ", wifi: " + wifi
|
LOG.info("Online: " + online + ", wifi: " + wifi);
|
||||||
+ ", IPv6 only: " + ipv6Only);
|
|
||||||
if (country.isEmpty()) LOG.info("Country code unknown");
|
if (country.isEmpty()) LOG.info("Country code unknown");
|
||||||
else LOG.info("Country code: " + country);
|
else LOG.info("Country code: " + country);
|
||||||
LOG.info("Charging: " + charging);
|
LOG.info("Charging: " + charging);
|
||||||
@@ -918,8 +911,7 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
enableNetwork = true;
|
enableNetwork = true;
|
||||||
if (network == PREF_TOR_NETWORK_WITH_BRIDGES ||
|
if (network == PREF_TOR_NETWORK_WITH_BRIDGES ||
|
||||||
(automatic && bridgesWork)) {
|
(automatic && bridgesWork)) {
|
||||||
if (ipv6Only ||
|
if (circumventionProvider.needsMeek(country)) {
|
||||||
circumventionProvider.needsMeek(country)) {
|
|
||||||
LOG.info("Using meek bridges");
|
LOG.info("Using meek bridges");
|
||||||
enableBridges = true;
|
enableBridges = true;
|
||||||
useMeek = true;
|
useMeek = true;
|
||||||
@@ -945,7 +937,6 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
if (enableNetwork) {
|
if (enableNetwork) {
|
||||||
enableBridges(enableBridges, useMeek);
|
enableBridges(enableBridges, useMeek);
|
||||||
enableConnectionPadding(enableConnectionPadding);
|
enableConnectionPadding(enableConnectionPadding);
|
||||||
useIpv6(ipv6Only);
|
|
||||||
}
|
}
|
||||||
enableNetwork(enableNetwork);
|
enableNetwork(enableNetwork);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -958,11 +949,6 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
controlConnection.setConf("ConnectionPadding", enable ? "1" : "0");
|
controlConnection.setConf("ConnectionPadding", enable ? "1" : "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void useIpv6(boolean ipv6Only) throws IOException {
|
|
||||||
controlConnection.setConf("ClientUseIPv4", ipv6Only ? "0" : "1");
|
|
||||||
controlConnection.setConf("ClientUseIPv6", ipv6Only ? "1" : "0");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ThreadSafe
|
@ThreadSafe
|
||||||
@NotNullByDefault
|
@NotNullByDefault
|
||||||
protected class PluginState {
|
protected class PluginState {
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import net.i2p.crypto.eddsa.spec.EdDSANamedCurveTable;
|
|||||||
import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec;
|
import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec;
|
||||||
|
|
||||||
import org.briarproject.bramble.util.Base32;
|
import org.briarproject.bramble.util.Base32;
|
||||||
import org.bouncycastle.crypto.Digest;
|
import org.spongycastle.crypto.Digest;
|
||||||
import org.bouncycastle.crypto.digests.SHA3Digest;
|
import org.spongycastle.crypto.digests.SHA3Digest;
|
||||||
import org.bouncycastle.util.encoders.Base64;
|
import org.spongycastle.util.encoders.Base64;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
|
|||||||
@@ -294,13 +294,7 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
|
|||||||
public TransportProperties getRemoteProperties(ContactId c, TransportId t)
|
public TransportProperties getRemoteProperties(ContactId c, TransportId t)
|
||||||
throws DbException {
|
throws DbException {
|
||||||
return db.transactionWithResult(true, txn ->
|
return db.transactionWithResult(true, txn ->
|
||||||
getRemoteProperties(txn, c, t));
|
getRemoteProperties(txn, db.getContact(txn, c), t));
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TransportProperties getRemoteProperties(Transaction txn,
|
|
||||||
ContactId c, TransportId t) throws DbException {
|
|
||||||
return getRemoteProperties(txn, db.getContact(txn, c), t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ import org.briarproject.bramble.api.system.Clock;
|
|||||||
import javax.annotation.concurrent.Immutable;
|
import javax.annotation.concurrent.Immutable;
|
||||||
|
|
||||||
import static org.briarproject.bramble.api.plugin.TransportId.MAX_TRANSPORT_ID_LENGTH;
|
import static org.briarproject.bramble.api.plugin.TransportId.MAX_TRANSPORT_ID_LENGTH;
|
||||||
import static org.briarproject.bramble.api.properties.TransportPropertyConstants.MSG_KEY_LOCAL;
|
|
||||||
import static org.briarproject.bramble.api.properties.TransportPropertyConstants.MSG_KEY_TRANSPORT_ID;
|
|
||||||
import static org.briarproject.bramble.api.properties.TransportPropertyConstants.MSG_KEY_VERSION;
|
|
||||||
import static org.briarproject.bramble.util.ValidationUtils.checkLength;
|
import static org.briarproject.bramble.util.ValidationUtils.checkLength;
|
||||||
import static org.briarproject.bramble.util.ValidationUtils.checkSize;
|
import static org.briarproject.bramble.util.ValidationUtils.checkSize;
|
||||||
|
|
||||||
@@ -46,9 +43,9 @@ class TransportPropertyValidator extends BdfMessageValidator {
|
|||||||
clientHelper.parseAndValidateTransportProperties(dictionary);
|
clientHelper.parseAndValidateTransportProperties(dictionary);
|
||||||
// Return the metadata
|
// Return the metadata
|
||||||
BdfDictionary meta = new BdfDictionary();
|
BdfDictionary meta = new BdfDictionary();
|
||||||
meta.put(MSG_KEY_TRANSPORT_ID, transportId);
|
meta.put("transportId", transportId);
|
||||||
meta.put(MSG_KEY_VERSION, version);
|
meta.put("version", version);
|
||||||
meta.put(MSG_KEY_LOCAL, false);
|
meta.put("local", false);
|
||||||
return new BdfMessageContext(meta);
|
return new BdfMessageContext(meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package org.briarproject.bramble.rendezvous;
|
|||||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.briarproject.bramble.api.rendezvous.KeyMaterialSource;
|
import org.briarproject.bramble.api.rendezvous.KeyMaterialSource;
|
||||||
import org.bouncycastle.crypto.engines.Salsa20Engine;
|
import org.spongycastle.crypto.engines.Salsa20Engine;
|
||||||
import org.bouncycastle.crypto.params.KeyParameter;
|
import org.spongycastle.crypto.params.KeyParameter;
|
||||||
import org.bouncycastle.crypto.params.ParametersWithIV;
|
import org.spongycastle.crypto.params.ParametersWithIV;
|
||||||
|
|
||||||
import javax.annotation.concurrent.GuardedBy;
|
import javax.annotation.concurrent.GuardedBy;
|
||||||
import javax.annotation.concurrent.ThreadSafe;
|
import javax.annotation.concurrent.ThreadSafe;
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import javax.annotation.concurrent.Immutable;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.net.SocketFactory;
|
import javax.net.SocketFactory;
|
||||||
|
|
||||||
import static java.util.logging.Level.INFO;
|
|
||||||
import static java.util.logging.Level.WARNING;
|
import static java.util.logging.Level.WARNING;
|
||||||
import static org.briarproject.bramble.util.IoUtils.tryToClose;
|
import static org.briarproject.bramble.util.IoUtils.tryToClose;
|
||||||
|
|
||||||
@@ -101,12 +100,11 @@ class DevReporterImpl implements DevReporter, EventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int sendReports() {
|
public void sendReports() {
|
||||||
File reportDir = devConfig.getReportDir();
|
File reportDir = devConfig.getReportDir();
|
||||||
File[] reports = reportDir.listFiles();
|
File[] reports = reportDir.listFiles();
|
||||||
int reportsSent = 0;
|
|
||||||
if (reports == null || reports.length == 0)
|
if (reports == null || reports.length == 0)
|
||||||
return reportsSent; // No reports to send
|
return; // No reports to send
|
||||||
|
|
||||||
LOG.info("Sending reports to developers");
|
LOG.info("Sending reports to developers");
|
||||||
for (File f : reports) {
|
for (File f : reports) {
|
||||||
@@ -118,15 +116,13 @@ class DevReporterImpl implements DevReporter, EventListener {
|
|||||||
in = new FileInputStream(f);
|
in = new FileInputStream(f);
|
||||||
IoUtils.copyAndClose(in, out);
|
IoUtils.copyAndClose(in, out);
|
||||||
f.delete();
|
f.delete();
|
||||||
reportsSent++;
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.log(WARNING, "Failed to send reports", e);
|
LOG.log(WARNING, "Failed to send reports", e);
|
||||||
tryToClose(out, LOG, WARNING);
|
tryToClose(out, LOG, WARNING);
|
||||||
tryToClose(in, LOG, WARNING);
|
tryToClose(in, LOG, WARNING);
|
||||||
return reportsSent;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (LOG.isLoggable(INFO)) LOG.info(reportsSent + " report(s) sent");
|
LOG.info("Reports sent");
|
||||||
return reportsSent;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import java.util.concurrent.Executor;
|
|||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import javax.annotation.concurrent.ThreadSafe;
|
import javax.annotation.concurrent.ThreadSafe;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
@@ -124,8 +125,7 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
|||||||
Group g = db.getGroup(txn, m.getGroupId());
|
Group g = db.getGroup(txn, m.getGroupId());
|
||||||
return new Pair<>(m, g);
|
return new Pair<>(m, g);
|
||||||
});
|
});
|
||||||
validateMessageAsync(mg.getFirst(), mg.getSecond());
|
validateMessageAsync(mg.getFirst(), mg.getSecond(), unvalidated);
|
||||||
validateNextMessageAsync(unvalidated);
|
|
||||||
} catch (NoSuchMessageException e) {
|
} catch (NoSuchMessageException e) {
|
||||||
LOG.info("Message removed before validation");
|
LOG.info("Message removed before validation");
|
||||||
validateNextMessageAsync(unvalidated);
|
validateNextMessageAsync(unvalidated);
|
||||||
@@ -213,12 +213,14 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateMessageAsync(Message m, Group g) {
|
private void validateMessageAsync(Message m, Group g,
|
||||||
validationExecutor.execute(() -> validateMessage(m, g));
|
@Nullable Queue<MessageId> unvalidated) {
|
||||||
|
validationExecutor.execute(() -> validateMessage(m, g, unvalidated));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ValidationExecutor
|
@ValidationExecutor
|
||||||
private void validateMessage(Message m, Group g) {
|
private void validateMessage(Message m, Group g,
|
||||||
|
@Nullable Queue<MessageId> unvalidated) {
|
||||||
ClientMajorVersion cv =
|
ClientMajorVersion cv =
|
||||||
new ClientMajorVersion(g.getClientId(), g.getMajorVersion());
|
new ClientMajorVersion(g.getClientId(), g.getMajorVersion());
|
||||||
MessageValidator v = validators.get(cv);
|
MessageValidator v = validators.get(cv);
|
||||||
@@ -234,6 +236,8 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
|||||||
Queue<MessageId> invalidate = new LinkedList<>();
|
Queue<MessageId> invalidate = new LinkedList<>();
|
||||||
invalidate.add(m.getId());
|
invalidate.add(m.getId());
|
||||||
invalidateNextMessageAsync(invalidate);
|
invalidateNextMessageAsync(invalidate);
|
||||||
|
} finally {
|
||||||
|
if (unvalidated != null) validateNextMessageAsync(unvalidated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -440,7 +444,7 @@ class ValidationManagerImpl implements ValidationManager, Service,
|
|||||||
try {
|
try {
|
||||||
Group g = db.transactionWithResult(true, txn ->
|
Group g = db.transactionWithResult(true, txn ->
|
||||||
db.getGroup(txn, m.getGroupId()));
|
db.getGroup(txn, m.getGroupId()));
|
||||||
validateMessageAsync(m, g);
|
validateMessageAsync(m, g, null);
|
||||||
} catch (NoSuchGroupException e) {
|
} catch (NoSuchGroupException e) {
|
||||||
LOG.info("Group removed before validation");
|
LOG.info("Group removed before validation");
|
||||||
} catch (DbException e) {
|
} catch (DbException e) {
|
||||||
|
|||||||
@@ -101,9 +101,9 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<TransportId, KeySetId> addRotationKeys(Transaction txn,
|
public Map<TransportId, KeySetId> addRotationKeys(
|
||||||
ContactId c, SecretKey rootKey, long timestamp, boolean alice,
|
Transaction txn, ContactId c, SecretKey rootKey, long timestamp,
|
||||||
boolean active) throws DbException {
|
boolean alice, boolean active) throws DbException {
|
||||||
Map<TransportId, KeySetId> ids = new HashMap<>();
|
Map<TransportId, KeySetId> ids = new HashMap<>();
|
||||||
for (Entry<TransportId, TransportKeyManager> e : managers.entrySet()) {
|
for (Entry<TransportId, TransportKeyManager> e : managers.entrySet()) {
|
||||||
TransportId t = e.getKey();
|
TransportId t = e.getKey();
|
||||||
@@ -114,14 +114,6 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
|
|||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<TransportId, KeySetId> addRotationKeys(ContactId c,
|
|
||||||
SecretKey rootKey, long timestamp, boolean alice, boolean active)
|
|
||||||
throws DbException {
|
|
||||||
return db.transactionWithResult(false, txn ->
|
|
||||||
addRotationKeys(txn, c, rootKey, timestamp, alice, active));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<TransportId, KeySetId> addContact(Transaction txn, ContactId c,
|
public Map<TransportId, KeySetId> addContact(Transaction txn, ContactId c,
|
||||||
PublicKey theirPublicKey, KeyPair ourKeyPair)
|
PublicKey theirPublicKey, KeyPair ourKeyPair)
|
||||||
@@ -145,7 +137,7 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
|
|||||||
PendingContactId p, PublicKey theirPublicKey, KeyPair ourKeyPair)
|
PendingContactId p, PublicKey theirPublicKey, KeyPair ourKeyPair)
|
||||||
throws DbException, GeneralSecurityException {
|
throws DbException, GeneralSecurityException {
|
||||||
SecretKey staticMasterKey = transportCrypto
|
SecretKey staticMasterKey = transportCrypto
|
||||||
.deriveStaticMasterKey(theirPublicKey, ourKeyPair);
|
.deriveStaticMasterKey(theirPublicKey, ourKeyPair);
|
||||||
SecretKey rootKey =
|
SecretKey rootKey =
|
||||||
transportCrypto.deriveHandshakeRootKey(staticMasterKey, true);
|
transportCrypto.deriveHandshakeRootKey(staticMasterKey, true);
|
||||||
boolean alice = transportCrypto.isAlice(theirPublicKey, ourKeyPair);
|
boolean alice = transportCrypto.isAlice(theirPublicKey, ourKeyPair);
|
||||||
|
|||||||
@@ -24,21 +24,15 @@ class StreamReaderFactoryImpl implements StreamReaderFactory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream createStreamReader(InputStream in, StreamContext ctx) {
|
public InputStream createStreamReader(InputStream in, StreamContext ctx) {
|
||||||
return new StreamReaderImpl(streamDecrypterFactory
|
return new StreamReaderImpl(
|
||||||
.createStreamDecrypter(in, ctx));
|
streamDecrypterFactory.createStreamDecrypter(in, ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream createContactExchangeStreamReader(InputStream in,
|
public InputStream createContactExchangeStreamReader(InputStream in,
|
||||||
SecretKey headerKey) {
|
SecretKey headerKey) {
|
||||||
return new StreamReaderImpl(streamDecrypterFactory
|
return new StreamReaderImpl(
|
||||||
.createContactExchangeStreamDecrypter(in, headerKey));
|
streamDecrypterFactory.createContactExchangeStreamDecrypter(in,
|
||||||
}
|
headerKey));
|
||||||
|
|
||||||
@Override
|
|
||||||
public InputStream createLogStreamReader(InputStream in,
|
|
||||||
SecretKey headerKey) {
|
|
||||||
return new StreamReaderImpl(streamDecrypterFactory
|
|
||||||
.createLogStreamDecrypter(in, headerKey));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,21 +26,15 @@ class StreamWriterFactoryImpl implements StreamWriterFactory {
|
|||||||
@Override
|
@Override
|
||||||
public StreamWriter createStreamWriter(OutputStream out,
|
public StreamWriter createStreamWriter(OutputStream out,
|
||||||
StreamContext ctx) {
|
StreamContext ctx) {
|
||||||
return new StreamWriterImpl(streamEncrypterFactory
|
return new StreamWriterImpl(
|
||||||
.createStreamEncrypter(out, ctx));
|
streamEncrypterFactory.createStreamEncrypter(out, ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamWriter createContactExchangeStreamWriter(OutputStream out,
|
public StreamWriter createContactExchangeStreamWriter(OutputStream out,
|
||||||
SecretKey headerKey) {
|
SecretKey headerKey) {
|
||||||
return new StreamWriterImpl(streamEncrypterFactory
|
return new StreamWriterImpl(
|
||||||
.createContactExchangeStreamEncrypter(out, headerKey));
|
streamEncrypterFactory.createContactExchangeStreamDecrypter(out,
|
||||||
}
|
headerKey));
|
||||||
|
|
||||||
@Override
|
|
||||||
public StreamWriter createLogStreamWriter(OutputStream out,
|
|
||||||
SecretKey headerKey) {
|
|
||||||
return new StreamWriterImpl(streamEncrypterFactory
|
|
||||||
.createLogStreamEncrypter(out, headerKey));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,5 @@
|
|||||||
Bridge obfs4 192.95.36.142:443 CDF2E852BF539B82BD10E27E9115A31734E378C2 cert=qUVQ0srL1JI/vO6V6m/24anYXiJD3QP2HgzUKQtQ7GRqqUvs7P+tG43RtAqdhLOALP7DJQ iat-mode=1
|
|
||||||
Bridge obfs4 38.229.1.78:80 C8CBDB2464FC9804A69531437BCF2BE31FDD2EE4 cert=Hmyfd2ev46gGY7NoVxA9ngrPF2zCZtzskRTzoWXbxNkzeVnGFPWmrTtILRyqCTjHR+s9dg iat-mode=1
|
|
||||||
Bridge obfs4 37.218.245.14:38224 D9A82D2F9C2F65A18407B1D2B764F130847F8B5D cert=bjRaMrr1BRiAW8IE9U5z27fQaYgOhX1UCmOpg2pFpoMvo6ZgQMzLsaTzzQNTlm7hNcb+Sg iat-mode=0
|
|
||||||
Bridge obfs4 85.31.186.98:443 011F2599C0E9B27EE74B353155E244813763C3E5 cert=ayq0XzCwhpdysn5o0EyDUbmSOx3X/oTEbzDMvczHOdBJKlvIdHHLJGkZARtT4dcBFArPPg iat-mode=0
|
|
||||||
Bridge obfs4 144.217.20.138:80 FB70B257C162BF1038CA669D568D76F5B7F0BABB cert=vYIV5MgrghGQvZPIi1tJwnzorMgqgmlKaB77Y3Z9Q/v94wZBOAXkW+fdx4aSxLVnKO+xNw iat-mode=0
|
|
||||||
Bridge obfs4 193.11.166.194:27015 2D82C2E354D531A68469ADF7F878FA6060C6BACA cert=4TLQPJrTSaDffMK7Nbao6LC7G9OW/NHkUwIdjLSS3KYf0Nv4/nQiiI8dY2TcsQx01NniOg iat-mode=0
|
|
||||||
Bridge obfs4 193.11.166.194:27020 86AC7B8D430DAC4117E9F42C9EAED18133863AAF cert=0LDeJH4JzMDtkJJrFphJCiPqKx7loozKN7VNfuukMGfHO0Z8OGdzHVkhVAOfo1mUdv9cMg iat-mode=0
|
|
||||||
Bridge obfs4 193.11.166.194:27025 1AE2C08904527FEA90C4C4F8C1083EA59FBC6FAF cert=ItvYZzW5tn6v3G4UnQa6Qz04Npro6e81AP70YujmK/KXwDFPTs3aHXcHp4n8Vt6w/bv8cA iat-mode=0
|
|
||||||
Bridge obfs4 209.148.46.65:443 74FAD13168806246602538555B5521A0383A1875 cert=ssH+9rP8dG2NLDN2XuFw63hIO/9MNNinLmxQDpVa+7kTOa9/m+tGWT1SmSYpQ9uTBGa6Hw iat-mode=0
|
|
||||||
Bridge obfs4 45.145.95.6:27015 C5B7CD6946FF10C5B3E89691A7D3F2C122D2117C cert=TD7PbUO0/0k6xYHMPW3vJxICfkMZNdkRrb63Zhl5j9dW3iRGiCx0A7mPhe5T2EDzQ35+Zw iat-mode=0
|
|
||||||
Bridge obfs4 51.222.13.177:80 5EDAC3B810E12B01F6FD8050D2FD3E277B289A08 cert=2uplIpLQ0q9+0qMFrK5pkaYRDOe460LL9WHBvatgkuRr/SL31wBOEupaMMJ6koRE6Ld0ew iat-mode=0
|
|
||||||
Bridge obfs4 78.46.188.239:37356 5A2D2F4158D0453E00C7C176978D3F41D69C45DB cert=3c0SwxpOisbohNxEc4tb875RVW8eOu1opRTVXJhafaKA/PNNtI7ElQIVOVZg1AdL5bxGCw iat-mode=0
|
Bridge obfs4 78.46.188.239:37356 5A2D2F4158D0453E00C7C176978D3F41D69C45DB cert=3c0SwxpOisbohNxEc4tb875RVW8eOu1opRTVXJhafaKA/PNNtI7ElQIVOVZg1AdL5bxGCw iat-mode=0
|
||||||
Bridge meek_lite 192.0.2.2:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com
|
Bridge obfs4 52.15.78.72:9443 02069A3C5362476936B62BA6F5ACC41ABD573A9B cert=ijYG/OKc7kqu2YzKNFfeXN7/BG2BOgfEP2KyYEiGDQthnHbsOiTWHeIG0WJVW+BckzDgKw iat-mode=0
|
||||||
|
Bridge obfs4 13.58.29.242:9443 0C58939A77DA6B6B29D4B5236A75865659607AE0 cert=OylWIEHb/ezpq1zWxW0sgKRn+9ARH2eOcQOZ8/Gew+4l+oKOhQ2jUX/Y+FSl61JorXZUWA iat-mode=0
|
||||||
|
Bridge obfs4 45.33.37.112:9443 60A609BB4ABE8D46E634AE81ED29ADAB7776B399 cert=t5v19WmNv5Sc2YPNr8RQids365W7MY8zJwQVkOxBjUMFomMWARDzsbYpcWLLcw0J9Gm+BQ iat-mode=0
|
||||||
|
Bridge meek_lite 0.0.2.0:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com
|
||||||
@@ -13,7 +13,7 @@ import org.briarproject.bramble.api.sync.Message;
|
|||||||
import org.briarproject.bramble.api.sync.MessageContext;
|
import org.briarproject.bramble.api.sync.MessageContext;
|
||||||
import org.briarproject.bramble.test.ValidatorTestCase;
|
import org.briarproject.bramble.test.ValidatorTestCase;
|
||||||
import org.jmock.Expectations;
|
import org.jmock.Expectations;
|
||||||
import org.jmock.imposters.ByteBuddyClassImposteriser;
|
import org.jmock.lib.legacy.ClassImposteriser;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.briarproject.bramble.api.transport.TransportConstants.MAX_CLOCK_DIFFERENCE;
|
import static org.briarproject.bramble.api.transport.TransportConstants.MAX_CLOCK_DIFFERENCE;
|
||||||
@@ -38,7 +38,7 @@ public class BdfMessageValidatorTest extends ValidatorTestCase {
|
|||||||
private final Metadata meta = new Metadata();
|
private final Metadata meta = new Metadata();
|
||||||
|
|
||||||
public BdfMessageValidatorTest() {
|
public BdfMessageValidatorTest() {
|
||||||
context.setImposteriser(ByteBuddyClassImposteriser.INSTANCE);
|
context.setImposteriser(ClassImposteriser.INSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = InvalidMessageException.class)
|
@Test(expected = InvalidMessageException.class)
|
||||||
|
|||||||
@@ -8,15 +8,18 @@ import org.briarproject.bramble.api.contact.PendingContactState;
|
|||||||
import org.briarproject.bramble.api.crypto.KeyPair;
|
import org.briarproject.bramble.api.crypto.KeyPair;
|
||||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||||
import org.briarproject.bramble.api.db.DatabaseComponent;
|
import org.briarproject.bramble.api.db.DatabaseComponent;
|
||||||
|
import org.briarproject.bramble.api.db.DbException;
|
||||||
import org.briarproject.bramble.api.db.NoSuchContactException;
|
import org.briarproject.bramble.api.db.NoSuchContactException;
|
||||||
import org.briarproject.bramble.api.db.Transaction;
|
import org.briarproject.bramble.api.db.Transaction;
|
||||||
import org.briarproject.bramble.api.identity.Author;
|
import org.briarproject.bramble.api.identity.Author;
|
||||||
import org.briarproject.bramble.api.identity.AuthorId;
|
import org.briarproject.bramble.api.identity.AuthorId;
|
||||||
|
import org.briarproject.bramble.api.identity.AuthorInfo;
|
||||||
import org.briarproject.bramble.api.identity.IdentityManager;
|
import org.briarproject.bramble.api.identity.IdentityManager;
|
||||||
import org.briarproject.bramble.api.identity.LocalAuthor;
|
import org.briarproject.bramble.api.identity.LocalAuthor;
|
||||||
import org.briarproject.bramble.api.transport.KeyManager;
|
import org.briarproject.bramble.api.transport.KeyManager;
|
||||||
import org.briarproject.bramble.test.BrambleMockTestCase;
|
import org.briarproject.bramble.test.BrambleMockTestCase;
|
||||||
import org.briarproject.bramble.test.DbExpectations;
|
import org.briarproject.bramble.test.DbExpectations;
|
||||||
|
import org.jmock.Expectations;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@@ -28,6 +31,10 @@ import static java.util.Collections.singletonList;
|
|||||||
import static org.briarproject.bramble.api.contact.HandshakeLinkConstants.BASE32_LINK_BYTES;
|
import static org.briarproject.bramble.api.contact.HandshakeLinkConstants.BASE32_LINK_BYTES;
|
||||||
import static org.briarproject.bramble.api.contact.PendingContactState.WAITING_FOR_CONNECTION;
|
import static org.briarproject.bramble.api.contact.PendingContactState.WAITING_FOR_CONNECTION;
|
||||||
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
|
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
|
||||||
|
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.OURSELVES;
|
||||||
|
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.UNKNOWN;
|
||||||
|
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.UNVERIFIED;
|
||||||
|
import static org.briarproject.bramble.api.identity.AuthorInfo.Status.VERIFIED;
|
||||||
import static org.briarproject.bramble.test.TestUtils.getAgreementPrivateKey;
|
import static org.briarproject.bramble.test.TestUtils.getAgreementPrivateKey;
|
||||||
import static org.briarproject.bramble.test.TestUtils.getAgreementPublicKey;
|
import static org.briarproject.bramble.test.TestUtils.getAgreementPublicKey;
|
||||||
import static org.briarproject.bramble.test.TestUtils.getAuthor;
|
import static org.briarproject.bramble.test.TestUtils.getAuthor;
|
||||||
@@ -39,6 +46,7 @@ import static org.briarproject.bramble.test.TestUtils.getSecretKey;
|
|||||||
import static org.briarproject.bramble.util.StringUtils.getRandomBase32String;
|
import static org.briarproject.bramble.util.StringUtils.getRandomBase32String;
|
||||||
import static org.briarproject.bramble.util.StringUtils.getRandomString;
|
import static org.briarproject.bramble.util.StringUtils.getRandomString;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class ContactManagerImplTest extends BrambleMockTestCase {
|
public class ContactManagerImplTest extends BrambleMockTestCase {
|
||||||
@@ -204,6 +212,75 @@ public class ContactManagerImplTest extends BrambleMockTestCase {
|
|||||||
assertTrue(contactManager.contactExists(remote.getId(), local));
|
assertTrue(contactManager.contactExists(remote.getId(), local));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetAuthorInfo() throws Exception {
|
||||||
|
Transaction txn = new Transaction(null, true);
|
||||||
|
|
||||||
|
context.checking(new DbExpectations() {{
|
||||||
|
oneOf(identityManager).getLocalAuthor(txn);
|
||||||
|
will(returnValue(localAuthor));
|
||||||
|
oneOf(db).getContactsByAuthorId(txn, remote.getId());
|
||||||
|
will(returnValue(singletonList(contact)));
|
||||||
|
}});
|
||||||
|
|
||||||
|
AuthorInfo authorInfo =
|
||||||
|
contactManager.getAuthorInfo(txn, remote.getId());
|
||||||
|
assertEquals(UNVERIFIED, authorInfo.getStatus());
|
||||||
|
assertEquals(contact.getAlias(), authorInfo.getAlias());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetAuthorInfoTransaction() throws DbException {
|
||||||
|
Transaction txn = new Transaction(null, true);
|
||||||
|
|
||||||
|
// check unknown author
|
||||||
|
context.checking(new Expectations() {{
|
||||||
|
oneOf(identityManager).getLocalAuthor(txn);
|
||||||
|
will(returnValue(localAuthor));
|
||||||
|
oneOf(db).getContactsByAuthorId(txn, remote.getId());
|
||||||
|
will(returnValue(emptyList()));
|
||||||
|
}});
|
||||||
|
|
||||||
|
AuthorInfo authorInfo =
|
||||||
|
contactManager.getAuthorInfo(txn, remote.getId());
|
||||||
|
assertEquals(UNKNOWN, authorInfo.getStatus());
|
||||||
|
assertNull(authorInfo.getAlias());
|
||||||
|
|
||||||
|
// check unverified contact
|
||||||
|
checkAuthorInfoContext(txn, remote.getId(), singletonList(contact));
|
||||||
|
authorInfo = contactManager.getAuthorInfo(txn, remote.getId());
|
||||||
|
assertEquals(UNVERIFIED, authorInfo.getStatus());
|
||||||
|
assertEquals(contact.getAlias(), authorInfo.getAlias());
|
||||||
|
|
||||||
|
// check verified contact
|
||||||
|
Contact verified = getContact(remote, local, true);
|
||||||
|
checkAuthorInfoContext(txn, remote.getId(), singletonList(verified));
|
||||||
|
authorInfo = contactManager.getAuthorInfo(txn, remote.getId());
|
||||||
|
assertEquals(VERIFIED, authorInfo.getStatus());
|
||||||
|
assertEquals(verified.getAlias(), authorInfo.getAlias());
|
||||||
|
|
||||||
|
// check ourselves
|
||||||
|
context.checking(new Expectations() {{
|
||||||
|
oneOf(identityManager).getLocalAuthor(txn);
|
||||||
|
will(returnValue(localAuthor));
|
||||||
|
never(db).getContactsByAuthorId(txn, remote.getId());
|
||||||
|
}});
|
||||||
|
|
||||||
|
authorInfo = contactManager.getAuthorInfo(txn, localAuthor.getId());
|
||||||
|
assertEquals(OURSELVES, authorInfo.getStatus());
|
||||||
|
assertNull(authorInfo.getAlias());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkAuthorInfoContext(Transaction txn, AuthorId authorId,
|
||||||
|
Collection<Contact> contacts) throws DbException {
|
||||||
|
context.checking(new Expectations() {{
|
||||||
|
oneOf(identityManager).getLocalAuthor(txn);
|
||||||
|
will(returnValue(localAuthor));
|
||||||
|
oneOf(db).getContactsByAuthorId(txn, authorId);
|
||||||
|
will(returnValue(contacts));
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetHandshakeLink() throws Exception {
|
public void testGetHandshakeLink() throws Exception {
|
||||||
Transaction txn = new Transaction(null, true);
|
Transaction txn = new Transaction(null, true);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package org.briarproject.bramble.crypto;
|
|||||||
import org.briarproject.bramble.test.BrambleTestCase;
|
import org.briarproject.bramble.test.BrambleTestCase;
|
||||||
import org.briarproject.bramble.util.StringUtils;
|
import org.briarproject.bramble.util.StringUtils;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.bouncycastle.crypto.digests.Blake2bDigest;
|
import org.spongycastle.crypto.digests.Blake2bDigest;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
package org.briarproject.bramble.crypto;
|
||||||
|
|
||||||
|
import org.briarproject.bramble.test.BrambleTestCase;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.spongycastle.asn1.teletrust.TeleTrusTNamedCurves;
|
||||||
|
import org.spongycastle.asn1.x9.X9ECParameters;
|
||||||
|
import org.spongycastle.crypto.AsymmetricCipherKeyPair;
|
||||||
|
import org.spongycastle.crypto.agreement.ECDHCBasicAgreement;
|
||||||
|
import org.spongycastle.crypto.generators.ECKeyPairGenerator;
|
||||||
|
import org.spongycastle.crypto.params.ECDomainParameters;
|
||||||
|
import org.spongycastle.crypto.params.ECKeyGenerationParameters;
|
||||||
|
import org.spongycastle.crypto.params.ECPrivateKeyParameters;
|
||||||
|
import org.spongycastle.crypto.params.ECPublicKeyParameters;
|
||||||
|
import org.spongycastle.math.ec.ECCurve;
|
||||||
|
import org.spongycastle.math.ec.ECPoint;
|
||||||
|
import org.spongycastle.math.ec.MontgomeryLadderMultiplier;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
public class EllipticCurveMultiplicationTest extends BrambleTestCase {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMultiplierProducesSameResultsAsDefault() throws Exception {
|
||||||
|
// Instantiate the default implementation of the curve
|
||||||
|
X9ECParameters defaultX9Parameters =
|
||||||
|
TeleTrusTNamedCurves.getByName("brainpoolp256r1");
|
||||||
|
ECCurve defaultCurve = defaultX9Parameters.getCurve();
|
||||||
|
ECPoint defaultG = defaultX9Parameters.getG();
|
||||||
|
BigInteger defaultN = defaultX9Parameters.getN();
|
||||||
|
BigInteger defaultH = defaultX9Parameters.getH();
|
||||||
|
ECDomainParameters defaultParameters = new ECDomainParameters(
|
||||||
|
defaultCurve, defaultG, defaultN, defaultH);
|
||||||
|
// Instantiate an implementation using the Montgomery ladder multiplier
|
||||||
|
ECDomainParameters montgomeryParameters =
|
||||||
|
constantTime(defaultParameters);
|
||||||
|
// Generate two key pairs with each set of parameters, using the same
|
||||||
|
// deterministic PRNG for both sets of parameters
|
||||||
|
byte[] seed = new byte[32];
|
||||||
|
new SecureRandom().nextBytes(seed);
|
||||||
|
// Montgomery ladder multiplier
|
||||||
|
SecureRandom random = new PseudoSecureRandom(seed);
|
||||||
|
ECKeyGenerationParameters montgomeryGeneratorParams =
|
||||||
|
new ECKeyGenerationParameters(montgomeryParameters, random);
|
||||||
|
ECKeyPairGenerator montgomeryGenerator = new ECKeyPairGenerator();
|
||||||
|
montgomeryGenerator.init(montgomeryGeneratorParams);
|
||||||
|
AsymmetricCipherKeyPair montgomeryKeyPair1 =
|
||||||
|
montgomeryGenerator.generateKeyPair();
|
||||||
|
ECPrivateKeyParameters montgomeryPrivate1 =
|
||||||
|
(ECPrivateKeyParameters) montgomeryKeyPair1.getPrivate();
|
||||||
|
ECPublicKeyParameters montgomeryPublic1 =
|
||||||
|
(ECPublicKeyParameters) montgomeryKeyPair1.getPublic();
|
||||||
|
AsymmetricCipherKeyPair montgomeryKeyPair2 =
|
||||||
|
montgomeryGenerator.generateKeyPair();
|
||||||
|
ECPrivateKeyParameters montgomeryPrivate2 =
|
||||||
|
(ECPrivateKeyParameters) montgomeryKeyPair2.getPrivate();
|
||||||
|
ECPublicKeyParameters montgomeryPublic2 =
|
||||||
|
(ECPublicKeyParameters) montgomeryKeyPair2.getPublic();
|
||||||
|
// Default multiplier
|
||||||
|
random = new PseudoSecureRandom(seed);
|
||||||
|
ECKeyGenerationParameters defaultGeneratorParams =
|
||||||
|
new ECKeyGenerationParameters(defaultParameters, random);
|
||||||
|
ECKeyPairGenerator defaultGenerator = new ECKeyPairGenerator();
|
||||||
|
defaultGenerator.init(defaultGeneratorParams);
|
||||||
|
AsymmetricCipherKeyPair defaultKeyPair1 =
|
||||||
|
defaultGenerator.generateKeyPair();
|
||||||
|
ECPrivateKeyParameters defaultPrivate1 =
|
||||||
|
(ECPrivateKeyParameters) defaultKeyPair1.getPrivate();
|
||||||
|
ECPublicKeyParameters defaultPublic1 =
|
||||||
|
(ECPublicKeyParameters) defaultKeyPair1.getPublic();
|
||||||
|
AsymmetricCipherKeyPair defaultKeyPair2 =
|
||||||
|
defaultGenerator.generateKeyPair();
|
||||||
|
ECPrivateKeyParameters defaultPrivate2 =
|
||||||
|
(ECPrivateKeyParameters) defaultKeyPair2.getPrivate();
|
||||||
|
ECPublicKeyParameters defaultPublic2 =
|
||||||
|
(ECPublicKeyParameters) defaultKeyPair2.getPublic();
|
||||||
|
// The key pairs generated with both sets of parameters should be equal
|
||||||
|
assertEquals(montgomeryPrivate1.getD(), defaultPrivate1.getD());
|
||||||
|
assertEquals(montgomeryPublic1.getQ(), defaultPublic1.getQ());
|
||||||
|
assertEquals(montgomeryPrivate2.getD(), defaultPrivate2.getD());
|
||||||
|
assertEquals(montgomeryPublic2.getQ(), defaultPublic2.getQ());
|
||||||
|
// OK, all of the above was just sanity checks - now for the test!
|
||||||
|
ECDHCBasicAgreement agreement = new ECDHCBasicAgreement();
|
||||||
|
agreement.init(montgomeryPrivate1);
|
||||||
|
BigInteger sharedSecretMontgomeryMontgomery =
|
||||||
|
agreement.calculateAgreement(montgomeryPublic2);
|
||||||
|
agreement.init(montgomeryPrivate1);
|
||||||
|
BigInteger sharedSecretMontgomeryDefault =
|
||||||
|
agreement.calculateAgreement(defaultPublic2);
|
||||||
|
agreement.init(defaultPrivate1);
|
||||||
|
BigInteger sharedSecretDefaultMontgomery =
|
||||||
|
agreement.calculateAgreement(montgomeryPublic2);
|
||||||
|
agreement.init(defaultPrivate1);
|
||||||
|
BigInteger sharedSecretDefaultDefault =
|
||||||
|
agreement.calculateAgreement(defaultPublic2);
|
||||||
|
// Shared secrets calculated with different multipliers should be equal
|
||||||
|
assertEquals(sharedSecretMontgomeryMontgomery,
|
||||||
|
sharedSecretMontgomeryDefault);
|
||||||
|
assertEquals(sharedSecretMontgomeryMontgomery,
|
||||||
|
sharedSecretDefaultMontgomery);
|
||||||
|
assertEquals(sharedSecretMontgomeryMontgomery,
|
||||||
|
sharedSecretDefaultDefault);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ECDomainParameters constantTime(ECDomainParameters in) {
|
||||||
|
ECCurve curve = in.getCurve().configure().setMultiplier(
|
||||||
|
new MontgomeryLadderMultiplier()).create();
|
||||||
|
BigInteger x = in.getG().getAffineXCoord().toBigInteger();
|
||||||
|
BigInteger y = in.getG().getAffineYCoord().toBigInteger();
|
||||||
|
ECPoint g = curve.createPoint(x, y);
|
||||||
|
return new ECDomainParameters(curve, g, in.getN(), in.getH());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,26 +3,30 @@ package org.briarproject.bramble.crypto;
|
|||||||
import net.i2p.crypto.eddsa.EdDSASecurityProvider;
|
import net.i2p.crypto.eddsa.EdDSASecurityProvider;
|
||||||
import net.i2p.crypto.eddsa.KeyPairGenerator;
|
import net.i2p.crypto.eddsa.KeyPairGenerator;
|
||||||
|
|
||||||
import org.bouncycastle.asn1.sec.SECNamedCurves;
|
import org.spongycastle.asn1.sec.SECNamedCurves;
|
||||||
import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves;
|
import org.spongycastle.asn1.teletrust.TeleTrusTNamedCurves;
|
||||||
import org.bouncycastle.asn1.x9.X9ECParameters;
|
import org.spongycastle.asn1.x9.X9ECParameters;
|
||||||
import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
|
import org.spongycastle.crypto.AsymmetricCipherKeyPair;
|
||||||
import org.bouncycastle.crypto.BasicAgreement;
|
import org.spongycastle.crypto.BasicAgreement;
|
||||||
import org.bouncycastle.crypto.Digest;
|
import org.spongycastle.crypto.Digest;
|
||||||
import org.bouncycastle.crypto.agreement.ECDHBasicAgreement;
|
import org.spongycastle.crypto.agreement.ECDHBasicAgreement;
|
||||||
import org.bouncycastle.crypto.agreement.ECDHCBasicAgreement;
|
import org.spongycastle.crypto.agreement.ECDHCBasicAgreement;
|
||||||
import org.bouncycastle.crypto.digests.Blake2bDigest;
|
import org.spongycastle.crypto.digests.Blake2bDigest;
|
||||||
import org.bouncycastle.crypto.generators.ECKeyPairGenerator;
|
import org.spongycastle.crypto.generators.ECKeyPairGenerator;
|
||||||
import org.bouncycastle.crypto.params.ECDomainParameters;
|
import org.spongycastle.crypto.params.ECDomainParameters;
|
||||||
import org.bouncycastle.crypto.params.ECKeyGenerationParameters;
|
import org.spongycastle.crypto.params.ECKeyGenerationParameters;
|
||||||
import org.bouncycastle.crypto.params.ParametersWithRandom;
|
import org.spongycastle.crypto.params.ParametersWithRandom;
|
||||||
import org.bouncycastle.crypto.signers.DSADigestSigner;
|
import org.spongycastle.crypto.signers.DSADigestSigner;
|
||||||
import org.bouncycastle.crypto.signers.DSAKCalculator;
|
import org.spongycastle.crypto.signers.DSAKCalculator;
|
||||||
import org.bouncycastle.crypto.signers.ECDSASigner;
|
import org.spongycastle.crypto.signers.ECDSASigner;
|
||||||
import org.bouncycastle.crypto.signers.HMacDSAKCalculator;
|
import org.spongycastle.crypto.signers.HMacDSAKCalculator;
|
||||||
|
import org.spongycastle.math.ec.ECCurve;
|
||||||
|
import org.spongycastle.math.ec.ECPoint;
|
||||||
|
import org.spongycastle.math.ec.MontgomeryLadderMultiplier;
|
||||||
import org.whispersystems.curve25519.Curve25519;
|
import org.whispersystems.curve25519.Curve25519;
|
||||||
import org.whispersystems.curve25519.Curve25519KeyPair;
|
import org.whispersystems.curve25519.Curve25519KeyPair;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.security.KeyPair;
|
import java.security.KeyPair;
|
||||||
import java.security.Provider;
|
import java.security.Provider;
|
||||||
@@ -51,12 +55,14 @@ public class EllipticCurvePerformanceTest {
|
|||||||
for (String name : SEC_NAMES) {
|
for (String name : SEC_NAMES) {
|
||||||
ECDomainParameters params =
|
ECDomainParameters params =
|
||||||
convertParams(SECNamedCurves.getByName(name));
|
convertParams(SECNamedCurves.getByName(name));
|
||||||
runTest(name, params);
|
runTest(name + " default", params);
|
||||||
|
runTest(name + " constant", constantTime(params));
|
||||||
}
|
}
|
||||||
for (String name : BRAINPOOL_NAMES) {
|
for (String name : BRAINPOOL_NAMES) {
|
||||||
ECDomainParameters params =
|
ECDomainParameters params =
|
||||||
convertParams(TeleTrusTNamedCurves.getByName(name));
|
convertParams(TeleTrusTNamedCurves.getByName(name));
|
||||||
runTest(name, params);
|
runTest(name + " default", params);
|
||||||
|
runTest(name + " constant", constantTime(params));
|
||||||
}
|
}
|
||||||
runCurve25519Test();
|
runCurve25519Test();
|
||||||
runEd25519Test();
|
runEd25519Test();
|
||||||
@@ -187,4 +193,13 @@ public class EllipticCurvePerformanceTest {
|
|||||||
return new ECDomainParameters(in.getCurve(), in.getG(), in.getN(),
|
return new ECDomainParameters(in.getCurve(), in.getG(), in.getN(),
|
||||||
in.getH());
|
in.getH());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ECDomainParameters constantTime(ECDomainParameters in) {
|
||||||
|
ECCurve curve = in.getCurve().configure().setMultiplier(
|
||||||
|
new MontgomeryLadderMultiplier()).create();
|
||||||
|
BigInteger x = in.getG().getAffineXCoord().toBigInteger();
|
||||||
|
BigInteger y = in.getG().getAffineYCoord().toBigInteger();
|
||||||
|
ECPoint g = curve.createPoint(x, y);
|
||||||
|
return new ECDomainParameters(curve, g, in.getN(), in.getH());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import org.briarproject.bramble.api.crypto.PrivateKey;
|
|||||||
import org.briarproject.bramble.api.crypto.PublicKey;
|
import org.briarproject.bramble.api.crypto.PublicKey;
|
||||||
import org.briarproject.bramble.test.BrambleTestCase;
|
import org.briarproject.bramble.test.BrambleTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.bouncycastle.crypto.CryptoException;
|
import org.spongycastle.crypto.CryptoException;
|
||||||
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user