From 24e4efd7c28c28501db82c55f58c1ba931c236a3 Mon Sep 17 00:00:00 2001 From: Srie Teja Date: Wed, 6 Jul 2022 14:02:05 +0530 Subject: [PATCH 01/14] first commit --- at_client/lib/src/manager/monitor.dart | 6 +++--- at_client/lib/src/preference/at_client_preference.dart | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/at_client/lib/src/manager/monitor.dart b/at_client/lib/src/manager/monitor.dart index 98630d9e4..25bed494d 100644 --- a/at_client/lib/src/manager/monitor.dart +++ b/at_client/lib/src/manager/monitor.dart @@ -278,7 +278,7 @@ class Monitor { //2. create a connection to secondary server var outboundConnection = - await _monitorOutboundConnectionFactory.createConnection(secondaryUrl); + await _monitorOutboundConnectionFactory.createConnection(secondaryUrl, decryptPackets: _preference.decryptPackets); return outboundConnection; } @@ -408,12 +408,12 @@ class MonitorConnectivityChecker { } class MonitorOutboundConnectionFactory { - Future createConnection(String secondaryUrl) async { + Future createConnection(String secondaryUrl, {decryptPackets = false}) async { var secondaryInfo = _getSecondaryInfo(secondaryUrl); var host = secondaryInfo[0]; var port = secondaryInfo[1]; - var secureSocket = await SecureSocket.connect(host, int.parse(port)); + var secureSocket = await SecureSocketUtil.createSecureContext(host, int.parse(port), decryptPackets: decryptPackets); return OutboundConnectionImpl(secureSocket); } diff --git a/at_client/lib/src/preference/at_client_preference.dart b/at_client/lib/src/preference/at_client_preference.dart index 2ec2add49..a77ac8ec6 100644 --- a/at_client/lib/src/preference/at_client_preference.dart +++ b/at_client/lib/src/preference/at_client_preference.dart @@ -61,6 +61,10 @@ class AtClientPreference { int fileEncryptionChunkSize = 4096; Duration monitorHeartbeatInterval = Duration(seconds: 10); + + ///[OptionalParameter] when set to true logs TLS Keys to file. + bool decryptPackets = false; + } @Deprecated("Use SyncService") From bb633565d9038ffceac8bb12af65d9c7498458cf Mon Sep 17 00:00:00 2001 From: Srie Teja Date: Wed, 6 Jul 2022 16:50:51 +0530 Subject: [PATCH 02/14] at_lookup dependency override --- at_client/pubspec.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/at_client/pubspec.yaml b/at_client/pubspec.yaml index 1be50bf27..661cbe8f9 100644 --- a/at_client/pubspec.yaml +++ b/at_client/pubspec.yaml @@ -32,6 +32,12 @@ dependencies: at_utils: ^3.0.10 meta: ^1.7.0 +dependency_overrides: + at_lookup: + git: + url: https://github.com/atsign-foundation/at_libraries.git + path: at_lookup + branch: sec_context dev_dependencies: test: ^1.17.2 at_demo_data: ^0.0.3+1 From 0173a35b32368a24d900901c1004315c9fc9128b Mon Sep 17 00:00:00 2001 From: Srie Teja Date: Mon, 11 Jul 2022 00:34:33 +0530 Subject: [PATCH 03/14] added new fields to at_client_preference.dart --- at_client/lib/src/manager/monitor.dart | 8 +++++--- at_client/lib/src/preference/at_client_preference.dart | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/at_client/lib/src/manager/monitor.dart b/at_client/lib/src/manager/monitor.dart index 25bed494d..fa4b1e72f 100644 --- a/at_client/lib/src/manager/monitor.dart +++ b/at_client/lib/src/manager/monitor.dart @@ -9,11 +9,12 @@ import 'package:at_client/src/preference/monitor_preference.dart'; import 'package:at_client/src/response/default_response_parser.dart'; import 'package:at_client/src/util/network_util.dart'; import 'package:at_commons/at_builders.dart'; -import 'package:at_commons/at_commons.dart'; import 'package:at_lookup/at_lookup.dart'; +// import 'package:at_lookup/src/util/secure_socket_util.dart'; import 'package:at_utils/at_logger.dart'; import 'package:crypton/crypton.dart'; + /// /// A [Monitor] object is used to receive notifications from the secondary server. /// @@ -408,12 +409,13 @@ class MonitorConnectivityChecker { } class MonitorOutboundConnectionFactory { - Future createConnection(String secondaryUrl, {decryptPackets = false}) async { + Future createConnection(String secondaryUrl, {decryptPackets = false, pathToCerts, tlsKeysSavePath}) async { var secondaryInfo = _getSecondaryInfo(secondaryUrl); var host = secondaryInfo[0]; var port = secondaryInfo[1]; - var secureSocket = await SecureSocketUtil.createSecureContext(host, int.parse(port), decryptPackets: decryptPackets); + var secureSocketUtil = SecureSocketUtil(decryptPackets, pathToCerts, tlsKeysSavePath); + SecureSocket secureSocket = await secureSocketUtil.createSecureContext(host, int.parse(port)); return OutboundConnectionImpl(secureSocket); } diff --git a/at_client/lib/src/preference/at_client_preference.dart b/at_client/lib/src/preference/at_client_preference.dart index a77ac8ec6..ead5395c7 100644 --- a/at_client/lib/src/preference/at_client_preference.dart +++ b/at_client/lib/src/preference/at_client_preference.dart @@ -65,6 +65,12 @@ class AtClientPreference { ///[OptionalParameter] when set to true logs TLS Keys to file. bool decryptPackets = false; + ///[OptionalParameter] location where the TLS keys will be saved when [decryptPackets] is set to true + String? tlsKeysSavePath; + + ///[OptionalParameter] path to trusted certificates. Required to create security context. + String? pathToCerts; + } @Deprecated("Use SyncService") From da6b03a686ba52f2a2241d643f7c01822e102577 Mon Sep 17 00:00:00 2001 From: Srie Teja Date: Mon, 11 Jul 2022 01:28:23 +0530 Subject: [PATCH 04/14] passing additional fields to AtLookupImpl const --- at_client/lib/src/client/remote_secondary.dart | 6 +++++- at_client/lib/src/manager/monitor.dart | 7 +++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/at_client/lib/src/client/remote_secondary.dart b/at_client/lib/src/client/remote_secondary.dart index 635bdc638..c14562a7f 100644 --- a/at_client/lib/src/client/remote_secondary.dart +++ b/at_client/lib/src/client/remote_secondary.dart @@ -27,7 +27,11 @@ class RemoteSecondary implements Secondary { _preference = preference; privateKey ??= preference.privateKey; atLookUp = AtLookupImpl(atSign, preference.rootDomain, preference.rootPort, - privateKey: privateKey, cramSecret: preference.cramSecret); + privateKey: privateKey, + cramSecret: preference.cramSecret, + decryptPackets: preference.decryptPackets, + tlsKeysSavePath: preference.tlsKeysSavePath, + pathToCerts: preference.pathToCerts); } /// Executes the command returned by [VerbBuilder] build command on a remote secondary server. diff --git a/at_client/lib/src/manager/monitor.dart b/at_client/lib/src/manager/monitor.dart index fa4b1e72f..1967b5f7b 100644 --- a/at_client/lib/src/manager/monitor.dart +++ b/at_client/lib/src/manager/monitor.dart @@ -279,7 +279,7 @@ class Monitor { //2. create a connection to secondary server var outboundConnection = - await _monitorOutboundConnectionFactory.createConnection(secondaryUrl, decryptPackets: _preference.decryptPackets); + await _monitorOutboundConnectionFactory.createConnection(secondaryUrl, decryptPackets: _preference.decryptPackets, pathToCerts: _preference.pathToCerts, tlsKeysSavePath: _preference.tlsKeysSavePath); return outboundConnection; } @@ -409,13 +409,12 @@ class MonitorConnectivityChecker { } class MonitorOutboundConnectionFactory { - Future createConnection(String secondaryUrl, {decryptPackets = false, pathToCerts, tlsKeysSavePath}) async { + Future createConnection(String secondaryUrl, {decryptPackets, pathToCerts, tlsKeysSavePath}) async { var secondaryInfo = _getSecondaryInfo(secondaryUrl); var host = secondaryInfo[0]; var port = secondaryInfo[1]; - var secureSocketUtil = SecureSocketUtil(decryptPackets, pathToCerts, tlsKeysSavePath); - SecureSocket secureSocket = await secureSocketUtil.createSecureContext(host, int.parse(port)); + SecureSocket secureSocket = await SecureSocketUtil.createSecureContext(host, port, decryptPackets, pathToCerts, tlsKeysSavePath); return OutboundConnectionImpl(secureSocket); } From f6712efe98bb452071522f41b73207fe9ac9aa93 Mon Sep 17 00:00:00 2001 From: srieteja Date: Mon, 11 Jul 2022 17:32:11 +0530 Subject: [PATCH 05/14] using dependency override for at_lookup --- at_client/lib/src/manager/monitor.dart | 13 ++++++++----- at_client/pubspec.yaml | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/at_client/lib/src/manager/monitor.dart b/at_client/lib/src/manager/monitor.dart index 1967b5f7b..f1b554e56 100644 --- a/at_client/lib/src/manager/monitor.dart +++ b/at_client/lib/src/manager/monitor.dart @@ -10,11 +10,9 @@ import 'package:at_client/src/response/default_response_parser.dart'; import 'package:at_client/src/util/network_util.dart'; import 'package:at_commons/at_builders.dart'; import 'package:at_lookup/at_lookup.dart'; -// import 'package:at_lookup/src/util/secure_socket_util.dart'; import 'package:at_utils/at_logger.dart'; import 'package:crypton/crypton.dart'; - /// /// A [Monitor] object is used to receive notifications from the secondary server. /// @@ -279,7 +277,10 @@ class Monitor { //2. create a connection to secondary server var outboundConnection = - await _monitorOutboundConnectionFactory.createConnection(secondaryUrl, decryptPackets: _preference.decryptPackets, pathToCerts: _preference.pathToCerts, tlsKeysSavePath: _preference.tlsKeysSavePath); + await _monitorOutboundConnectionFactory.createConnection(secondaryUrl, + decryptPackets: _preference.decryptPackets, + pathToCerts: _preference.pathToCerts, + tlsKeysSavePath: _preference.tlsKeysSavePath); return outboundConnection; } @@ -409,12 +410,14 @@ class MonitorConnectivityChecker { } class MonitorOutboundConnectionFactory { - Future createConnection(String secondaryUrl, {decryptPackets, pathToCerts, tlsKeysSavePath}) async { + Future createConnection(String secondaryUrl, + {decryptPackets, pathToCerts, tlsKeysSavePath}) async { var secondaryInfo = _getSecondaryInfo(secondaryUrl); var host = secondaryInfo[0]; var port = secondaryInfo[1]; - SecureSocket secureSocket = await SecureSocketUtil.createSecureContext(host, port, decryptPackets, pathToCerts, tlsKeysSavePath); + SecureSocket secureSocket = await SecureSocketUtil.createSecureSocket( + host, port, decryptPackets, pathToCerts, tlsKeysSavePath); return OutboundConnectionImpl(secureSocket); } diff --git a/at_client/pubspec.yaml b/at_client/pubspec.yaml index 661cbe8f9..98b7494e2 100644 --- a/at_client/pubspec.yaml +++ b/at_client/pubspec.yaml @@ -37,7 +37,7 @@ dependency_overrides: git: url: https://github.com/atsign-foundation/at_libraries.git path: at_lookup - branch: sec_context + ref: sec_socket_util dev_dependencies: test: ^1.17.2 at_demo_data: ^0.0.3+1 From 62071277af7fcf8c0061f674c448fec443d116ab Mon Sep 17 00:00:00 2001 From: srieteja Date: Mon, 11 Jul 2022 17:54:34 +0530 Subject: [PATCH 06/14] using dependency override for at_lookup in e2e tests --- at_end2end_test/pubspec.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/at_end2end_test/pubspec.yaml b/at_end2end_test/pubspec.yaml index 6d3ec0e90..d63d74fb9 100644 --- a/at_end2end_test/pubspec.yaml +++ b/at_end2end_test/pubspec.yaml @@ -17,6 +17,12 @@ dependency_overrides: path: at_commons ref: trunk + at_lookup: + git: + url: https://github.com/atsign-foundation/at_libraries.git + path: at_lookup + ref: sec_socket_util + dev_dependencies: pedantic: ^1.10.0 test: ^1.16.0 From e4535039485273d7f2f95695d976911979fa9a18 Mon Sep 17 00:00:00 2001 From: srieteja Date: Thu, 14 Jul 2022 14:48:33 +0530 Subject: [PATCH 07/14] modifications to unit tests --- at_client/test/monitor_test.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/at_client/test/monitor_test.dart b/at_client/test/monitor_test.dart index e9213c853..4a081107e 100644 --- a/at_client/test/monitor_test.dart +++ b/at_client/test/monitor_test.dart @@ -45,9 +45,13 @@ void main() { var fakeSecondaryUrl = "monitor_test:12345"; var fakePrivateKey = 'MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCDVMetuYSlcwNdS1yLgYE1oBEXaCFZjPq0Lk9w7yjKOqKgPCWnuVVly5+GBkYPYN3mPXbi/LHy3SqVM/8s5srxa+C8s5jk2pQI6BgG/RW59XM6vrGuw0pUQoL0bMyQxtR8XAFVgd54iDcgp4ZPLEH6odAgBraAtkIEpfwSwtMaWJCaS/Yn3q6ZoVOxL+O7DHD2dJWmwwjAJyDqEDeeNVuNHWnmj2ZneVXDnsY4fOR3IZdcGArM28FFcFIM6Q0K6XGiLGvJ2pYPywtzwARFChYJTBJYhNNLRgT+MUvx8fbNa6mMnnXQmagh/YvYwmyIUVQK1EhFNZIgezX9xdmIgS+FAgMBAAECggEAEq0z2FjRrFW23MWi25QHNAEXbSS52WpbHNSZJ45bVqcQCYmEMV4B7wAOJ5kszXMRG3USOyWEiO066Q0D9Pa9VafpxewkiicrdjjLcfL76/4j7O7BhgDvyRvMU8ZFMTGVdjn/VpGpeaqlbFdmmkvI9kOcvXE28wb4TIDuYBykuNI6twRqiaVd1LkKg9yoF0DGfSp8OHGWm/wz5wwnNYT6ofTbgV3gSGKOrLf4rC1swHh1VoNXiaYKQQFo2j23vGznC+hVJy8kAkSTMvRy4+SrZ+0MtYrNt0CI9n4hw79BNzwAd0kfJ5WCsYL6MaF8Giyym3Wl77KoiriwRF7cGCEnAQKBgQDWD+l1b6D8QCmrzxI1iZRoehfdlIlNviTxNks4yaDQ/tu6TC/3ySsRhKvwj7BqFYj2A6ULafeh08MfxpG0MfmJ+aJypC+MJixu/z/OXhQsscnR6avQtVLi9BIZV3EweyaD/yN/PB7IVLuhz6E6BV8kfNDb7UFZzrSSlvm1YzIdvQKBgQCdD5KVbcA88xkv/SrBpJcUME31TIR4DZPg8fSB+IDCnogSwXLxofadezH47Igc1CifLSQp4Rb+8sjVOTIoAXZKvW557fSQk3boR3aZ4CkheDznzjq0vY0qot4llkzHdiogaIUdPDwvYBwERzc73CO3We1pHs36bIz70Z3DRF5BaQKBgQC295jUARs4IVu899yXmEYa2yklAz4tDjajWoYHPwhPO1fysAZcJD3E1oLkttzSgB+2MD1VOTkpwEhLE74cqI6jqZV5qe7eOw7FvTT7npxd64UXAEUUurfjNz11HbGo/8pXDrB3o5qoHwzV7RPg9RByrqETKoMuUSk1FwjPSr9efQKBgAdC7w4Fkvu+aY20cMOfLnT6fsA2l3FNf2bJCPrxWFKnLbdgRkYxrMs/JOJTXT+n93DUj3V4OK3036AsEsuStbti4ra0b7g3eSnoE+2tVXl8q6Qz/rbYhKxR919ZgZc/OVdiPbVKUaYHFYSFHmKgHO6fM8DGcdOALUx/NoIOqSTxAoGBALUdiw8iyI98TFgmbSYjUj5id4MrYKXaR7ndS/SQFOBfJWVH09t5bTxXjKxKsK914/bIqEI71aussf5daOHhC03LdZIQx0ZcCdb2gL8vHNTQoqX75bLRN7J+zBKlwWjjrbhZCMLE/GtAJQNbpJ7jOrVeDwMAF8pK+Put9don44Gx'; - + var fakeCertsLocation = '/home/ubuntu/Desktop/cert.pem'; + var fakeTlsKeysSavePath = '/home/ubuntu/Desktop/cert.pem'; AtClientPreference atClientPreference = AtClientPreference(); atClientPreference.privateKey = fakePrivateKey; + atClientPreference.decryptPackets = true; + atClientPreference.tlsKeysSavePath = fakeTlsKeysSavePath; + atClientPreference.pathToCerts = fakeCertsLocation; group('Monitor constructor and start tests', () { setUp(() { @@ -68,7 +72,11 @@ void main() { when(() => mockOutboundConnection.getSocket()) .thenAnswer((_) => mockSocket); when(() => mockMonitorOutboundConnectionFactory.createConnection( - fakeSecondaryUrl)).thenAnswer((_) async => mockOutboundConnection); + fakeSecondaryUrl, + decryptPackets: true, + tlsKeysSavePath: fakeTlsKeysSavePath, + pathToCerts: fakeCertsLocation)) + .thenAnswer((_) async => mockOutboundConnection); when(() => mockSocket.listen(any(), onError: any(named: "onError"), onDone: any(named: "onDone"))).thenAnswer((Invocation invocation) { From e6ea2de1b93b575a26850ca855d35664fd4d4c43 Mon Sep 17 00:00:00 2001 From: srieteja Date: Thu, 14 Jul 2022 14:59:42 +0530 Subject: [PATCH 08/14] at_lookup dependency override for func-tests --- at_functional_test/pubspec.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/at_functional_test/pubspec.yaml b/at_functional_test/pubspec.yaml index 5c065723c..fd7724b32 100644 --- a/at_functional_test/pubspec.yaml +++ b/at_functional_test/pubspec.yaml @@ -17,6 +17,12 @@ dependency_overrides: path: at_commons ref: trunk + at_lookup: + git: + url: https://github.com/atsign-foundation/at_libraries.git + path: at_lookup + ref: sec_socket_util + dev_dependencies: test: ^1.17.2 lints: ^1.0.1 From e5fdc8b0f7325b32ced78cb9724a53d2230030d9 Mon Sep 17 00:00:00 2001 From: srieteja Date: Fri, 22 Jul 2022 02:48:27 +0530 Subject: [PATCH 09/14] setting decryptPackets to true --- at_functional_test/test/test_utils.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/at_functional_test/test/test_utils.dart b/at_functional_test/test/test_utils.dart index c9303865a..7013b83cd 100644 --- a/at_functional_test/test/test_utils.dart +++ b/at_functional_test/test/test_utils.dart @@ -10,6 +10,7 @@ class TestUtils { preference.isLocalStoreRequired = true; preference.privateKey = demo_credentials.pkamPrivateKeyMap[atsign]; preference.rootDomain = 'vip.ve.atsign.zone'; + preference.decryptPackets = true; return preference; } } From 6e9d8e7e3ab1b8f26ffb67c00006e761efcaf294 Mon Sep 17 00:00:00 2001 From: srieteja Date: Fri, 22 Jul 2022 02:56:48 +0530 Subject: [PATCH 10/14] providing a directory to save tlsKeysFile in func_tests --- at_functional_test/test/test_utils.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/at_functional_test/test/test_utils.dart b/at_functional_test/test/test_utils.dart index 7013b83cd..cbd2617cb 100644 --- a/at_functional_test/test/test_utils.dart +++ b/at_functional_test/test/test_utils.dart @@ -11,6 +11,7 @@ class TestUtils { preference.privateKey = demo_credentials.pkamPrivateKeyMap[atsign]; preference.rootDomain = 'vip.ve.atsign.zone'; preference.decryptPackets = true; + preference.tlsKeysSavePath = 'test/tlsKeysFile'; return preference; } } From 7df952ca51fce4588e6d690ef701c1ceaacef1f4 Mon Sep 17 00:00:00 2001 From: srieteja Date: Fri, 22 Jul 2022 15:29:21 +0530 Subject: [PATCH 11/14] adding a cert to func_tests to test SecureSocketutil --- at_functional_test/test/testData/cert.pem | 30 +++++++++++++++++++++++ at_functional_test/test/test_utils.dart | 1 + 2 files changed, 31 insertions(+) create mode 100644 at_functional_test/test/testData/cert.pem diff --git a/at_functional_test/test/testData/cert.pem b/at_functional_test/test/testData/cert.pem new file mode 100644 index 000000000..1eb04b0a9 --- /dev/null +++ b/at_functional_test/test/testData/cert.pem @@ -0,0 +1,30 @@ +-----BEGIN CERTIFICATE----- +MIIFLDCCBBSgAwIBAgISBAAOlxS2nBvkxSahxke0Vb4dMA0GCSqGSIb3DQEBCwUA +MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD +EwJSMzAeFw0yMjA3MTUwNjQxMTFaFw0yMjEwMTMwNjQxMTBaMB0xGzAZBgNVBAMT +EnZpcC52ZS5hdHNpZ24uem9uZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAL6sK1lj/xk61tqJbU+BjKLFcXmCrpidsgOjTuIaNyGzlA2A9ct9Paoh5cQ5 +jVlDptOaCq7YJ1B0OmO13nPPRkMNkm/cleQh3L0KOESSriSr+wOzs2nXxHas+7US +U3bU5aRotvptozifQcgAUJKVgKBgicG2yJlDDJK1R6ZyifnHRmiOX/7z/06ecD2d +KW3ujOfL+PLJtJXELdklHXw4vrXMAyw+p+2BL26sX5L0QWuBZGYwyoGnesQaOgiG +xOomxES8kM7dUiU8h2B07V9Lc0BxPz7M/xekyKOnd8VbxTSpfpE9T7lQN+ZP3Mvg +S5t8o6UEasq7Ln1JwC/z6W8oAp8CAwEAAaOCAk8wggJLMA4GA1UdDwEB/wQEAwIF +oDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAd +BgNVHQ4EFgQU7ksCkNm7UkeELC1L1V7c/Cgt+EkwHwYDVR0jBBgwFoAUFC6zF7dY +VsuuUAlA5h+vnYsUwsYwVQYIKwYBBQUHAQEESTBHMCEGCCsGAQUFBzABhhVodHRw +Oi8vcjMuby5sZW5jci5vcmcwIgYIKwYBBQUHMAKGFmh0dHA6Ly9yMy5pLmxlbmNy +Lm9yZy8wHQYDVR0RBBYwFIISdmlwLnZlLmF0c2lnbi56b25lMEwGA1UdIARFMEMw +CAYGZ4EMAQIBMDcGCysGAQQBgt8TAQEBMCgwJgYIKwYBBQUHAgEWGmh0dHA6Ly9j +cHMubGV0c2VuY3J5cHQub3JnMIIBBgYKKwYBBAHWeQIEAgSB9wSB9ADyAHcAQcjK +sd8iRkoQxqE6CUKHXk4xixsD6+tLx2jwkGKWBvYAAAGCAM3tnwAABAMASDBGAiEA +tqW+egsIjkdyQjt1LfSA85xbXfxf2eH2zhSp9HJBmIUCIQDFLbp7V+023Dgh7L+Z +NoE7aq6XcAq0/KAQDLwbRPALGwB3AEalVet1+pEgMLWiiWn0830RLEF0vv1JuIWr +8vxw/m1HAAABggDN7bUAAAQDAEgwRgIhAMrqNRh7iwgocoGh1N/ds1RZG0dc9aFR +g0wZvO69DkdhAiEAxaEaPU/a1DVYbFrPYaMTWVBLMFYb/LvUxFS++rhC2BMwDQYJ +KoZIhvcNAQELBQADggEBAGD5bM5L4I43fCpzXze9L1bhAUKDskxgADaACI2s/Ri4 +BvyoDBkk2Qyut6WlOXS1f0QwCr7GS9KEihETKbR+rRypVBM5VKSNkHbH3C451LwC +WnhizWBqDpcNBWGe1CjvG9ouRpuBbrCqh6OoJuABfULmejN9nPynA2EpiOFJEGg5 +MfR+PuQ8i7qNOzIHaPfjnDHU4ld//qSnO4H6mP7miOqm3iWTxPeMqKslcyEdjDdB +ReHQB8lkdZ+N/i1ecvAbbzjn68NvMm9bo9B9nT2LNr1HEJj3KF10R2DvFIz3GyOP +S9ffV+eYSxNCS/TlPOggYi/z1a2Xs0Kwe4spm+DQ8lY= +-----END CERTIFICATE----- diff --git a/at_functional_test/test/test_utils.dart b/at_functional_test/test/test_utils.dart index cbd2617cb..859f80555 100644 --- a/at_functional_test/test/test_utils.dart +++ b/at_functional_test/test/test_utils.dart @@ -11,6 +11,7 @@ class TestUtils { preference.privateKey = demo_credentials.pkamPrivateKeyMap[atsign]; preference.rootDomain = 'vip.ve.atsign.zone'; preference.decryptPackets = true; + preference.pathToCerts = 'test/testData/cert.pem'; preference.tlsKeysSavePath = 'test/tlsKeysFile'; return preference; } From d8ab8a794553f9803b005e47c19db0c4f1905dba Mon Sep 17 00:00:00 2001 From: Srie Teja Date: Mon, 25 Jul 2022 14:19:58 +0530 Subject: [PATCH 12/14] removing dependency overrides for at_lookup --- at_client/pubspec.yaml | 16 ++++++++-------- at_end2end_test/pubspec.yaml | 10 +++++----- at_functional_test/pubspec.yaml | 10 +++++----- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/at_client/pubspec.yaml b/at_client/pubspec.yaml index 3419a8df1..582a48961 100644 --- a/at_client/pubspec.yaml +++ b/at_client/pubspec.yaml @@ -25,19 +25,19 @@ dependencies: async: ^2.8.2 at_persistence_spec: ^2.0.6 at_persistence_secondary_server: ^3.0.29 - at_lookup: ^3.0.27 + at_lookup: ^3.0.28 at_utf7: ^1.0.0 at_base2e15: ^1.0.0 - at_commons: ^3.0.19 + at_commons: ^3.0.20 at_utils: ^3.0.10 meta: ^1.7.0 -dependency_overrides: - at_lookup: - git: - url: https://github.com/atsign-foundation/at_libraries.git - path: at_lookup - ref: sec_socket_util +#dependency_overrides: +# at_lookup: +# git: +# url: https://github.com/atsign-foundation/at_libraries.git +# path: at_lookup +# ref: sec_socket_util # at_persistence_spec: # git: # url: https://github.com/atsign-foundation/at_server.git diff --git a/at_end2end_test/pubspec.yaml b/at_end2end_test/pubspec.yaml index d63d74fb9..f935dc4b9 100644 --- a/at_end2end_test/pubspec.yaml +++ b/at_end2end_test/pubspec.yaml @@ -17,11 +17,11 @@ dependency_overrides: path: at_commons ref: trunk - at_lookup: - git: - url: https://github.com/atsign-foundation/at_libraries.git - path: at_lookup - ref: sec_socket_util +# at_lookup: +# git: +# url: https://github.com/atsign-foundation/at_libraries.git +# path: at_lookup +# ref: sec_socket_util dev_dependencies: pedantic: ^1.10.0 diff --git a/at_functional_test/pubspec.yaml b/at_functional_test/pubspec.yaml index fd7724b32..db203da1c 100644 --- a/at_functional_test/pubspec.yaml +++ b/at_functional_test/pubspec.yaml @@ -17,11 +17,11 @@ dependency_overrides: path: at_commons ref: trunk - at_lookup: - git: - url: https://github.com/atsign-foundation/at_libraries.git - path: at_lookup - ref: sec_socket_util +# at_lookup: +# git: +# url: https://github.com/atsign-foundation/at_libraries.git +# path: at_lookup +# ref: sec_socket_util dev_dependencies: test: ^1.17.2 From 14e6570e2739e3989850f4d8d18801275ae27e9e Mon Sep 17 00:00:00 2001 From: srieteja Date: Mon, 25 Jul 2022 14:44:09 +0530 Subject: [PATCH 13/14] refactoring code to use SecureSocketConfig --- at_client/lib/src/client/remote_secondary.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/at_client/lib/src/client/remote_secondary.dart b/at_client/lib/src/client/remote_secondary.dart index c14562a7f..790e59e8c 100644 --- a/at_client/lib/src/client/remote_secondary.dart +++ b/at_client/lib/src/client/remote_secondary.dart @@ -26,12 +26,14 @@ class RemoteSecondary implements Secondary { _atSign = AtUtils.formatAtSign(atSign)!; _preference = preference; privateKey ??= preference.privateKey; + SecureSocketConfig secureSocketConfig = SecureSocketConfig(); + secureSocketConfig.decryptPackets = preference.decryptPackets; + secureSocketConfig.pathToCerts = preference.pathToCerts; + secureSocketConfig.tlsKeysSavePath = preference.tlsKeysSavePath; atLookUp = AtLookupImpl(atSign, preference.rootDomain, preference.rootPort, privateKey: privateKey, cramSecret: preference.cramSecret, - decryptPackets: preference.decryptPackets, - tlsKeysSavePath: preference.tlsKeysSavePath, - pathToCerts: preference.pathToCerts); + secureSocketConfig: secureSocketConfig); } /// Executes the command returned by [VerbBuilder] build command on a remote secondary server. From ace158247c0dd9de8c1c9659cb822eed06bf1b01 Mon Sep 17 00:00:00 2001 From: srieteja Date: Mon, 25 Jul 2022 14:47:00 +0530 Subject: [PATCH 14/14] refactoring code to use SecureSocketConfig --- at_client/lib/src/manager/monitor.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/at_client/lib/src/manager/monitor.dart b/at_client/lib/src/manager/monitor.dart index f1b554e56..8807155b6 100644 --- a/at_client/lib/src/manager/monitor.dart +++ b/at_client/lib/src/manager/monitor.dart @@ -416,8 +416,13 @@ class MonitorOutboundConnectionFactory { var host = secondaryInfo[0]; var port = secondaryInfo[1]; + SecureSocketConfig secureSocketConfig = SecureSocketConfig(); + secureSocketConfig.decryptPackets = decryptPackets; + secureSocketConfig.pathToCerts = pathToCerts; + secureSocketConfig.tlsKeysSavePath = tlsKeysSavePath; + SecureSocket secureSocket = await SecureSocketUtil.createSecureSocket( - host, port, decryptPackets, pathToCerts, tlsKeysSavePath); + host, port, secureSocketConfig); return OutboundConnectionImpl(secureSocket); }