diff --git a/.gitignore b/.gitignore index bd9bd76..2c62699 100644 --- a/.gitignore +++ b/.gitignore @@ -2,14 +2,8 @@ __pycache__ .venv -# DB Passwords -db_password.txt -db_root_password.txt - -# provider portal -provider_portal/db_data +provider_portal/db_data/mysql +provider_portal/db_data/influx/db +provider_portal/db_data/influx/config/influx-configs provider_portal/provider_portal.log -provider_portal/config/.DS_Store -provider_portal/config/certificates/.DS_Store -smart_meter/config/certificates/.DS_Store -provider_portal/config/certificates/root_ca/ca-private-key.pem + diff --git a/admin_cli/config/certificates/root_ca/ca-public-key.pem b/admin_cli/config/certificates/root_ca/ca-public-key.pem index 9898021..e904bd3 100644 --- a/admin_cli/config/certificates/root_ca/ca-public-key.pem +++ b/admin_cli/config/certificates/root_ca/ca-public-key.pem @@ -1,20 +1,20 @@ -----BEGIN CERTIFICATE----- -MIIDPzCCAiegAwIBAgIUI2J0uBvro8SeX9dpLsvQKegnn6EwDQYJKoZIhvcNAQEL -BQAwTzELMAkGA1UEBhMCREUxDzANBgNVBAgMBkJlcmxpbjEPMA0GA1UEBwwGQmVy -bGluMQ8wDQYDVQQKDAZUcnVzdHkxDTALBgNVBAMMBE1haW4wHhcNMjMxMTA0MjA1 -MjEzWhcNMjMxMjA0MjA1MjEzWjBPMQswCQYDVQQGEwJERTEPMA0GA1UECAwGQmVy -bGluMQ8wDQYDVQQHDAZCZXJsaW4xDzANBgNVBAoMBlRydXN0eTENMAsGA1UEAwwE -TWFpbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOcZn7l0GHsaKcK2 -RyuS34LTqb8OHmOkktD6YL0Uz2c1jItmP+mzrvhMKfAsUMsivO+rDPVFoZ87gA1j -zE1heAGAELXKcMWt2MR4lu7bSJRu76IojhdUtM/3S0Nz0fjV93AeizY08g+7/d7P -FLHAPnnSqe8yfu8Mx7PVcFNyz38AW1g5aNDbghKxBfcmhu+phO8DCCO05+3SWVA1 -2+HHGl4uyTEkIPa0aG175E5/CFdpRATInfRIDN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EtPyLbQCy1B7QRnj4VCD2dqo2gZ +Fmb44YG6gRRnh8XaA7DtqO51SDLzwvDpF3J+Nkt+QovJS3OVEKdCyMvGoD6gecOj +so3qjpG5aw/PAgMBAAGjUzBRMB0GA1UdDgQWBBRul5FcVlOrExafpMQehnbgE6ij +/jAfBgNVHSMEGDAWgBRul5FcVlOrExafpMQehnbgE6ij/jAPBgNVHRMBAf8EBTAD +AQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAawrPdL8P1zGLmqrFTIFKa2KzOCcBEPT7p +m2x2mwjiWfqA01jqmnAwit+dgYxB2D0kNoFsBgZYZfMpIa/4gbWCjyar9w51x8MZ +Yqkx0cA5Tbie1oGVldxup8nA/5sHeQzOksOT5KmeB+Cr58tegg2h3GgbdKtBEEe9 +EBvkGbI8giPu+/RQu1OO+fBL+O2OUVe8Wy2THbdr7chWtUJZe5LJlsV2EZfaGz6V +asz/un0eHDUQCYtTlSZYo9z2trZlWUEjV2aX3x1XxYo+6rzZ7rXxnPhK1cwBwgQy +X7mQEbIwvrD4g5wOleXErTpHFTsuEEMpfLgw2GHzl3rDbHfojaSg -----END CERTIFICATE----- diff --git a/compose.yml b/compose.yml index 7e63240..4214dac 100644 --- a/compose.yml +++ b/compose.yml @@ -3,6 +3,8 @@ services: provider_portal: build: ./provider_portal container_name: provider_portal + ports: + - 8100:8100 volumes: - ./provider_portal:/app/provider_portal - ./smart_meter/config/certificates/smartmeter_certificates:/app/smart_meter/config/certificates/smartmeter_certificates @@ -29,6 +31,8 @@ services: security_opt: - no-new-privileges:true restart: unless-stopped + ports: + - 8086:8086 environment: DOCKER_INFLUXDB_INIT_MODE: "setup" DOCKER_INFLUXDB_INIT_USERNAME: "admin" diff --git a/provider_portal/app/api/customer_api/customer_api.py b/provider_portal/app/api/customer_api/customer_api.py index 1d51717..c7b5639 100644 --- a/provider_portal/app/api/customer_api/customer_api.py +++ b/provider_portal/app/api/customer_api/customer_api.py @@ -102,22 +102,27 @@ def get_meter_measurements(self, start_time, end_time, data_interval, meter_UID) Raises: ValueError: If the specified time range is in the future or exceeds the maximum data points allowed. """ - # Check if end_time is in the future - current_time = datetime.now(timezone(timedelta(hours=1))) - if datetime.fromisoformat(end_time.replace(" ", "+")) > current_time: - raise ValueError("error_no_data") - - # Check the number of data points based on the specified time range and data interval - time_diff = datetime.fromisoformat(end_time.replace(" ", "+")) - datetime.fromisoformat( - start_time.replace(" ", "+")) - num_data_points = int(time_diff.total_seconds() / int(data_interval)) - - if num_data_points > 3600: - raise ValueError("error_over_maximum") - - converted_start_time = start_time.replace(" ", "+") - converted_end_time = end_time.replace(" ", "+") - converted_data_interval = data_interval + "s" + try: + # Check if end_time is in the future + current_time = datetime.now(timezone(timedelta(hours=1))) + if datetime.fromisoformat(end_time.replace(" ", "+")) > current_time: + raise ValueError("error_no_data") + + # Check the number of data points based on the specified time range and data interval + time_diff = datetime.fromisoformat(end_time.replace(" ", "+")) - datetime.fromisoformat( + start_time.replace(" ", "+")) + num_data_points = int(time_diff.total_seconds() / int(data_interval)) + + if num_data_points > 3600: + raise ValueError("error_over_maximum") + + converted_start_time = start_time.replace(" ", "+") + converted_end_time = end_time.replace(" ", "+") + converted_data_interval = data_interval + "s" + except Exception as err: + logger.error(f"An exception occurred while decoding time format") + raise ValueError("error_decoding") + influxdb = InfluxDB() reading = influxdb.read(start_time=converted_start_time, end_time=converted_end_time, diff --git a/provider_portal/app/api/customer_api/response.py b/provider_portal/app/api/customer_api/response.py index 9fa6cff..6f5f4d8 100644 --- a/provider_portal/app/api/customer_api/response.py +++ b/provider_portal/app/api/customer_api/response.py @@ -5,7 +5,7 @@ class Response: # Define messages and their corresponding HTTP status codes MESSAGES = { "success_create_meter": ("Smart Meter wurde erfolgreich angelegt.", 201), - "success_delete_meter": ("Smart Meter wurde erfolgreich gelöscht.", 200), + "success_delete_meter": ("Smart Meter wurde erfolgreich geloescht.", 200), "error_create_meter": ("Smart Meter konnte nicht angelegt werden. Die Kombination von Meter UID und Customer UID existiert bereits.", 409), "error_meter_customer_combination": ("Die Kombination von Meter UID und Customer UID existiert nicht.", 404), diff --git a/provider_portal/app/api/customer_api/routes.py b/provider_portal/app/api/customer_api/routes.py index bbc1153..53c8aac 100644 --- a/provider_portal/app/api/customer_api/routes.py +++ b/provider_portal/app/api/customer_api/routes.py @@ -52,6 +52,8 @@ def create_meter(): try: # Extract API key from headers api_key = request.headers['Authorization'] + if "Bearer " in api_key: + api_key = api_key.replace("Bearer ", "") # Extract data from the request body data = json.loads(request.data) @@ -100,6 +102,8 @@ def meter_measurements(): try: # Extract API key from headers api_key = request.headers['Authorization'] + if "Bearer " in api_key: + api_key = api_key.replace("Bearer ", "") # Extract data from the request query parameters customer_UID = request.args.get('customerUID') @@ -113,9 +117,10 @@ def meter_measurements(): api = CustomerAPI(customer_UID=customer_UID, api_key=api_key) auth_status = api.authenticate_customer_portal() else: + logger.error(f"An error while authenticating has occurred") raise ValueError("error_decoding") except Exception as err: - logger.error(f"An error has occurred within the get measurements: {err}") + logger.error(f"An error has occurred within the get measurements, while validation: {err}") res = {"message": "error_decoding"} return Response(dict=res).create_response() @@ -152,6 +157,8 @@ def delete_meter(): try: # Extract API key from headers api_key = request.headers['Authorization'] + if "Bearer " in api_key: + api_key = api_key.replace("Bearer ", "") # Extract data from the request body data = json.loads(request.data) diff --git a/provider_portal/config/certificates/root_ca/ca-private-key.pem b/provider_portal/config/certificates/root_ca/ca-private-key.pem index 97e90e9..e36adfe 100644 --- a/provider_portal/config/certificates/root_ca/ca-private-key.pem +++ b/provider_portal/config/certificates/root_ca/ca-private-key.pem @@ -1,27 +1,28 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAsq2n0SfZdIUbUsYue6xgRQaxtfsIxoAqbrCMGuL1GMqDBswQ -a/WtIRkPX+Mf2LLFv08I0vPJjUU/WvkgsT5SMzkn9t7RdeHZaMdZvJCp3m8hWAGd -MYkiuLNo9iVrAGkfsmHDiA1iaFwtMvuyhHFzQ9FdnVTwF6QD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H +7xy+rwtUHR7Y27OazRqlacvB8OZmUBPoxPSCcebm59KfohyU736dzNCOjVn97HAA +AlipJKU8yJkNzXhQxVp9CNxER8OdyKYrkGTJiHLYzQKBgQC+ptaTcg3bOqdTsNek +cCLHieYeTW3jleuzay3iHSSGutYNCY8fk7yIz+nA3SAjTUXEmCARb7JNYuiAem6X +IlsQaXGhqqS0nu4cM4h2hj0dQaEyqodVHzfh95ZMwHGMZ+gJaj+z3h0mrIwVnngO +BD6VPGMs3a/kTWwy1h6ojVYIhQKBgQD2pTSIIlwE7lkIaX9PbsDtgqWgzAKnfUxU +HVgJ6sCwfSSMo2j0SMK1Sh24xQNR41gt2VpMVjVod4wv4hOpfFXzHx4UrDQd3kq8 +nqDFLpqdqH6W0LtmScK1SuU8qbdvqi5rvJ2rrE6VQKhJT67zTRD1+sEXeq4h6sSW +iKkOut4RQwKBgCkvBxkwwReDcxPcFqkZ5Blwi3ouRbes8g5+75lxrCtCfuywDO/I +TSjMqPUVj1Sw44pVRlAd7clTvV/LksopDLzd2kMPBqdR0aPb6fWYh+ki/Txho/xa +UwsIHbqUs7Kd23z1K6+iIm/xRA2DfvGgLxizw8S0WsOZie7tXBAS/+u1AoGBAPUG +7KgtkkMn0nVj8SElgy6xcv/KjPx9ot2RhUvc1m6+9Bdvo63DtwNJTTupJYItnAV4 +f5eEsWxGD5PmQehHaE+uY0DgTqo5kv/NiyQ5B0uG/7OuS+3zayaV8CSS6nRZmeJY +MD9DX5Iw+L5UFhcJQcdMxJUhwGpbg8+UlnbWuBRnAoGBAIEIbGg91hDmO/QbUn30 +xJwRSv6VQp5MtZHegrZnT++USLg3cdzRKJxP2WFrWj/Wn6aOmSFj3MYclFCdta8t +2rXLsxWZ/UAxUJvZwh2mwzGGYyiN0bp2FSeWKyGRz1wZug8NNja4PaGAXOBOGwRR +v6rgo8oGOM/dmckwICrjYbji +-----END PRIVATE KEY----- diff --git a/provider_portal/config/certificates/root_ca/ca-public-key.pem b/provider_portal/config/certificates/root_ca/ca-public-key.pem index 76214f9..e904bd3 100644 --- a/provider_portal/config/certificates/root_ca/ca-public-key.pem +++ b/provider_portal/config/certificates/root_ca/ca-public-key.pem @@ -1,20 +1,20 @@ -----BEGIN CERTIFICATE----- -MIIDPzCCAiegAwIBAgIUPOtMpGmLZPaTOF+bI565c8FeV+4wDQYJKoZIhvcNAQEL -BQAwTzELMAkGA1UEBhMCREUxDzANBgNVBAgMBkJlcmxpbjEPMA0GA1UEBwwGQmVy -bGluMQ8wDQYDVQQKDAZUcnVzdHkxDTALBgNVBAMMBE1haW4wHhcNMjMxMTA0MjAz -ODIwWhcNMjMxMjA0MjAzODIwWjBPMQswCQYDVQQGEwJERTEPMA0GA1UECAwGQmVy -bGluMQ8wDQYDVQQHDAZCZXJsaW4xDzANBgNVBAoMBlRydXN0eTENMAsGA1UEAwwE -TWFpbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALKtp9En2XSFG1LG -LnusYEUGsbX7CMaAKm6wjBri9RjKgwbMEGv1rSEZD1/jH9iyxb9PCNLzyY1FP1r5 -ILE+UjM5J/be0XXh2WjHWbyQqd5vIVgBnTGJIrizaPYlawBpH7Jhw4gNYmhcLTL7 -soRxc0PRXZ1U8BekAzgz0uuSZb23rtEZtq3XtcyITmFHHz1/vuDOhIZAfx1tzUA+ -U6u+pGwIinUquSwm09EFOOQsN8a9SmQ2cu4mHmI7gGR8KGWzzAGjH8PNd8v28GmO -pSXjsQ+VaSH8Ck4fU0C4mVUhIh1QgXl40R+DW9wd4xQ3VjfVWmw0Zli7gA+D3iJB -/8HyHd0CAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC -AQEAdkJ9hLdkdFv1K8Hk7zkQxl78MxuI2XB1rUTfn3QLFWMvSXbrBYudxNk6wTIb -Jnmrm1LwBfhIv3GAtu5GnvheXpydozieelFRLe6tPwbM5P90GUe0xqEfbX0RWsRH -AAhNXUvKI7A0/rf8/y2G6goxX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dgYxB2D0kNoFsBgZYZfMpIa/4gbWCjyar9w51x8MZ +Yqkx0cA5Tbie1oGVldxup8nA/5sHeQzOksOT5KmeB+Cr58tegg2h3GgbdKtBEEe9 +EBvkGbI8giPu+/RQu1OO+fBL+O2OUVe8Wy2THbdr7chWtUJZe5LJlsV2EZfaGz6V +asz/un0eHDUQCYtTlSZYo9z2trZlWUEjV2aX3x1XxYo+6rzZ7rXxnPhK1cwBwgQy +X7mQEbIwvrD4g5wOleXErTpHFTsuEEMpfLgw2GHzl3rDbHfojaSg -----END CERTIFICATE----- diff --git a/provider_portal/config/certificates/server_certificates/server-private-key.pem b/provider_portal/config/certificates/server_certificates/server-private-key.pem index c29dc72..0aaeb35 100644 --- a/provider_portal/config/certificates/server_certificates/server-private-key.pem +++ b/provider_portal/config/certificates/server_certificates/server-private-key.pem @@ -1,27 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAxqR3Z7Fu31/S5QQlJm2QKMDRZmK6+4RJpeSNA3D/dKk6WU/I -WYPRL5xThMSbWmjm0IdwncsczyUVbVCwoD0QedZKQt7fsQPpth+mnTYdbISRD2CY -j1DMhvxJHSmgNk5UoZLRbfrYOzGXeTjWP/Y57HPu6fRWkEPHbvZbXFMDUtfTbBVo -Xzv3LflKO0wlWKI+Djwxs9rDrcRMPfijkO+9FDTyt44fZcpLd0B6FJiOaYAjtuk9 -nKVCAcaQet7q1z+lb0wsmOp/kZIy75fdhQKl6UFxMQORsKSAt3EIwdk9+vQNTWNW -sFJzO0NhHJj824rhyuCMGKvmP49cHnGIjcS+gQIDAQABAoIBAC9bNjw6SLxoE9cV -TeYDaMLOdR17nCgqOYSbICMZ5Uziq05vfswYaN543lBgrsi3CY/dOjPkIFIh/SG6 -guEwraTeOYYHrDx/OlB46ze/lvQwBoUr+jLwiFIGA0g4jEFmGzcJ0XPuwW4bPIlh -y3IkOVrtqJ+N6LUr83e4s78m6zvsXKsNexC+Vdv3zlhBL2eFRQht85krGb6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A1ARBBekeu +DbCWR7oUMNK0oqmJG84J2xhlGB9qm0dXafH/JljxQvtCTvdnMfNEh1bSE2gR8hM3 +Ehe5KT5hiWzl5FZOW1TBS1Xv8Qc1snfBxVMioM50vkNtN23/U1w2QhcGEgSnrWEW +j9QQY8xlL2PQ6zLvVEysgwKBgF4Vr6fTZk9IVxNC1wu6MkEVJSv/x1/wOkOZsWg6 +Be3R/hDBeU+XnSam6OmKjiSOQLcEQ9XDfI4JSobCYcd4Fe9nCy8s6Qxpw2KNLye7 +x2mCLZmdPYzzXvLXlgHSc88RKGqJ/1C2Wz2LXNC+SpyZR+Y5aVmix7pwmDRSe2Hi +TQPDAoGALE1LRyYTgEUkM/jKaBuX08XP4zAZkAGdcH9eNKw/uIlHGSqO7tAw9bDC ++9evBkVPvbyxEPr3O9haE/8fqk3Zsphgy5WI7uMb2zKnAuOEiZcKLv91JlGl3kdZ +JsmuRXYPedInimesflgXrJr+6AFB1aWzQzmtZLKNxpiuzA4k03E= -----END RSA PRIVATE KEY----- diff --git a/provider_portal/config/certificates/server_certificates/server-public-key.pem b/provider_portal/config/certificates/server_certificates/server-public-key.pem index 6bdc3c4..80c62ce 100644 --- a/provider_portal/config/certificates/server_certificates/server-public-key.pem +++ b/provider_portal/config/certificates/server_certificates/server-public-key.pem @@ -1,20 +1,21 @@ -----BEGIN CERTIFICATE----- -MIIDQTCCAimgAwIBAgIUCcgu/1ZotBvZY+wp6A7BlBwpcRcwDQYJKoZIhvcNAQEL -BQAwTzELMAkGA1UEBhMCREUxDzANBgNVBAgMBkJlcmxpbjEPMA0GA1UEBwwGQmVy -bGluMQ8wDQYDVQQKDAZUcnVzdHkxDTALBgNVBAMMBE1haW4wHhcNMjMxMTA1MTUx -MDEwWhcNMjgxMDA5MTUxMDEwWjBRMQswCQYDVQQGEwJERTEPMA0GA1UECAwGQmVy -bGluMQ8wDQYDVQQHDAZCZXJsaW4xDzANBgNVBAoMBlRydXN0eTEPMA0GA1UEAwwG -U2VydmVyMII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J1c3R5MRgwFgYDVQQDDA9zYmQuamtyaXN0b2YuZGUwggEiMA0G +CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDiWE2Tbtvy32v8phz9CGWigiYN36mh +79XeVjbwTb2yxKUzSLXUm7guAp+CAm2edSwf6RB6ulpPVVrBYtPc9eDtrFQC6+9k +EqGbt23ITZCqpyTeZSd5xpNyYmeWYZHZZVb4Mx6MviM3sLkVq9LYePz8R/wWAFSv +KPip/gepugA5JjFCUglYQfbjc21JrNAD7ThkPtjPMlYaESJha5o4MLCthqXOE04r +LUZfpUGFGDeBi18yZVcnMU+r0/yz4WvjFWJkScfYYhYfxZCwsiIovKhZyiM/gM7Q ++7RxfvEpn/xwgZaBqpPxXleO2bQzjMnmvCvXiL/dHExX8R6I65ECGz4lAgMBAAGj +RDBCMEAGA1UdEQQ5MDeCD3NiZC5qa3Jpc3RvZi5kZYISc2JkLmFsZXgtZGl4b24u +ZGV2hwSAjFm9hwR/AAABhwQKAAEKMA0GCSqGSIb3DQEBCwUAA4IBAQCRyqtmipGq +vD94hMZBXkapzXLbn7rXLy65DnY3y0yczAIKB/b1A3VqB95wr9czMmk1Xra+2Yxo +/9CCiFO47VQHivToSMmzPPVVC0js+HWjKkbJhFPyTCuRN8Vh474Onn3l1py4BKpa +NeEQ1IUv2lWFoH0vZb/1IMMfM/EaJ/UMceGCA/v77abv3LfSod9acMFz5ZaKe1KB +Bac0vdcFn+dySg8hEN4QzfSnHhf2Jbqm8O69sB4vur9NzOCEuOy/uKvL1ubOfWPG +CK4rgF/OL5jY3D6hLvnIBjI9PjLguxCTx44xgcGG4d+I0CVKSpELvzMGVwZnJs51 +a8e8fsUj1ivl -----END CERTIFICATE----- diff --git a/provider_portal/run.py b/provider_portal/run.py index 22a8310..01c6c1f 100644 --- a/provider_portal/run.py +++ b/provider_portal/run.py @@ -71,15 +71,15 @@ def run_app(app, host, port, ssl_context): insert_users_from_file(mysql_db) # Threaded Flask applications - smartmeter_thread = threading.Thread(target=run_app, args=(smartmeter_api_app, '10.0.1.10', 8080, ssl_context)) + smartmeter_thread = threading.Thread(target=run_app, args=(smartmeter_api_app, '0.0.0.0', 8080, ssl_context)) smartmeter_thread.start() provider_thread = threading.Thread(target=run_app, args=( - customer_api_app, '10.0.1.10', 443, (config.CertificateConfig.SERVER_CERT, config.CertificateConfig.SERVER_KEY))) + customer_api_app, '0.0.0.0', 8100, (config.CertificateConfig.SERVER_CERT, config.CertificateConfig.SERVER_KEY))) provider_thread.start() admin_thread = threading.Thread(target=run_app, args=( - admin_api_app, '10.0.1.10', 8090, (config.CertificateConfig.SERVER_CERT, config.CertificateConfig.SERVER_KEY))) + admin_api_app, '0.0.0.0', 8090, (config.CertificateConfig.SERVER_CERT, config.CertificateConfig.SERVER_KEY))) admin_thread.start() # Wait for all threads to finish diff --git a/smart_meter/config/certificates/root_ca/ca-public-key.pem b/smart_meter/config/certificates/root_ca/ca-public-key.pem index 9898021..e904bd3 100644 --- a/smart_meter/config/certificates/root_ca/ca-public-key.pem +++ b/smart_meter/config/certificates/root_ca/ca-public-key.pem @@ -1,20 +1,20 @@ -----BEGIN CERTIFICATE----- -MIIDPzCCAiegAwIBAgIUI2J0uBvro8SeX9dpLsvQKegnn6EwDQYJKoZIhvcNAQEL -BQAwTzELMAkGA1UEBhMCREUxDzANBgNVBAgMBkJlcmxpbjEPMA0GA1UEBwwGQmVy -bGluMQ8wDQYDVQQKDAZUcnVzdHkxDTALBgNVBAMMBE1haW4wHhcNMjMxMTA0MjA1 -MjEzWhcNMjMxMjA0MjA1MjEzWjBPMQswCQYDVQQGEwJERTEPMA0GA1UECAwGQmVy -bGluMQ8wDQYDVQQHDAZCZXJsaW4xDzANBgNVBAoMBlRydXN0eTENMAsGA1UEAwwE -TWFpbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOcZn7l0GHsaKcK2 -RyuS34LTqb8OHmOkktD6YL0Uz2c1jItmP+mzrvhMKfAsUMsivO+rDPVFoZ87gA1j -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