diff --git a/DGCAVerifier/Services/GatewayConnection/GatewayConnection.swift b/DGCAVerifier/Services/GatewayConnection/GatewayConnection.swift index 7ee90ef..0f2f205 100644 --- a/DGCAVerifier/Services/GatewayConnection/GatewayConnection.swift +++ b/DGCAVerifier/Services/GatewayConnection/GatewayConnection.swift @@ -43,6 +43,7 @@ class GatewayConnection { var timer: Timer? private let certificateFilename: String + private let secondCertificateFilename: String private let certificateEvaluator: String static let shared = GatewayConnection() @@ -50,15 +51,21 @@ class GatewayConnection { private init() { baseUrl = Bundle.main.infoForKey("baseUrl")! certificateFilename = Bundle.main.infoForKey("certificateFilename")! + secondCertificateFilename = Bundle.main.infoForKey("secondCertificateFilename")! certificateEvaluator = Bundle.main.infoForKey("certificateEvaluator")! // Init certificate for pinning let filePath = Bundle.main.path(forResource: certificateFilename, ofType: nil)! let data = try! Data(contentsOf: URL(fileURLWithPath: filePath)) let certificate = SecCertificateCreateWithData(nil, data as CFData)! + + // Init certificate for pinning + let secondFilePath = Bundle.main.path(forResource: secondCertificateFilename, ofType: nil)! + let secondData = try! Data(contentsOf: URL(fileURLWithPath: secondFilePath)) + let secondCertificate = SecCertificateCreateWithData(nil, secondData as CFData)! // Init session - let evaluators = [certificateEvaluator: PinnedCertificatesTrustEvaluator(certificates: [certificate])] + let evaluators = [certificateEvaluator: PinnedCertificatesTrustEvaluator(certificates: [certificate, secondCertificate])] session = Session(interceptor: CustomHeaderInterceptor(), serverTrustManager: ServerTrustManager(evaluators: evaluators)) } diff --git a/DGCAVerifier/SupportingFiles/Plists/Info-Dev.plist b/DGCAVerifier/SupportingFiles/Plists/Info-Dev.plist index bb58f63..3db9fd9 100644 --- a/DGCAVerifier/SupportingFiles/Plists/Info-Dev.plist +++ b/DGCAVerifier/SupportingFiles/Plists/Info-Dev.plist @@ -83,5 +83,7 @@ $(certificateEvaluator) certificateFilename $(certificateFilename) + secondCertificateFilename + $(secondCertificateFilename) diff --git a/DGCAVerifier/SupportingFiles/Plists/Info.plist b/DGCAVerifier/SupportingFiles/Plists/Info.plist index 0b01f79..f3ce2d2 100644 --- a/DGCAVerifier/SupportingFiles/Plists/Info.plist +++ b/DGCAVerifier/SupportingFiles/Plists/Info.plist @@ -83,5 +83,7 @@ $(certificateEvaluator) certificateFilename $(certificateFilename) + secondCertificateFilename + $(secondCertificateFilename) diff --git a/DGCAVerifier/SupportingFiles/Resources/Certificates/get-dgc-gov-it-new.der b/DGCAVerifier/SupportingFiles/Resources/Certificates/get-dgc-gov-it-new.der new file mode 100644 index 0000000..012a90c Binary files /dev/null and b/DGCAVerifier/SupportingFiles/Resources/Certificates/get-dgc-gov-it-new.der differ diff --git a/DGCAVerifier/SupportingFiles/Resources/Certificates/testaka4-sogei-it-new.der b/DGCAVerifier/SupportingFiles/Resources/Certificates/testaka4-sogei-it-new.der new file mode 100644 index 0000000..8cf1921 Binary files /dev/null and b/DGCAVerifier/SupportingFiles/Resources/Certificates/testaka4-sogei-it-new.der differ diff --git a/DGCAVerifier/SupportingFiles/Resources/Configurations/Development.xcconfig b/DGCAVerifier/SupportingFiles/Resources/Configurations/Development.xcconfig index f61fb90..5899813 100644 --- a/DGCAVerifier/SupportingFiles/Resources/Configurations/Development.xcconfig +++ b/DGCAVerifier/SupportingFiles/Resources/Configurations/Development.xcconfig @@ -2,3 +2,4 @@ baseUrl = https:\/\/testaka4.sogei.it/v1/dgc/ certificateEvaluator = testaka4.sogei.it certificateFilename = testaka4-sogei-it.der +secondCertificateFilename = testaka4-sogei-it-new.der diff --git a/DGCAVerifier/SupportingFiles/Resources/Configurations/Production.xcconfig b/DGCAVerifier/SupportingFiles/Resources/Configurations/Production.xcconfig index c7914c3..aeb61f5 100644 --- a/DGCAVerifier/SupportingFiles/Resources/Configurations/Production.xcconfig +++ b/DGCAVerifier/SupportingFiles/Resources/Configurations/Production.xcconfig @@ -2,3 +2,4 @@ baseUrl = https:\/\/get.dgc.gov.it/v1/dgc/ certificateEvaluator = get.dgc.gov.it certificateFilename = get-dgc-gov-it.der +secondCertificateFilename = get-dgc-gov-it-new.der diff --git a/Verifier.xcodeproj/project.pbxproj b/Verifier.xcodeproj/project.pbxproj index 6f6fd4e..c0f0c52 100644 --- a/Verifier.xcodeproj/project.pbxproj +++ b/Verifier.xcodeproj/project.pbxproj @@ -278,6 +278,8 @@ 6B155168265BE463001D19E2 /* TestValidityCheck.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B155164265BE463001D19E2 /* TestValidityCheck.swift */; }; 6B155169265BE463001D19E2 /* Setting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B155165265BE463001D19E2 /* Setting.swift */; }; 6B24E85C266275920003808F /* get-dgc-gov-it.der in Resources */ = {isa = PBXBuildFile; fileRef = 6B24E85A2660E0030003808F /* get-dgc-gov-it.der */; }; + 6B2A88D22805F4C700139838 /* testaka4-sogei-it-new.der in Resources */ = {isa = PBXBuildFile; fileRef = 6B2A88D12805F4C500139838 /* testaka4-sogei-it-new.der */; }; + 6B5DC95128085B7C00B209E5 /* get-dgc-gov-it-new.der in Resources */ = {isa = PBXBuildFile; fileRef = 6B5DC95028085B7C00B209E5 /* get-dgc-gov-it-new.der */; }; 6B797DCF26D041AA00EB2873 /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = 6B797DCE26D041AA00EB2873 /* Realm */; }; 6B797DD126D041AA00EB2873 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 6B797DD026D041AA00EB2873 /* RealmSwift */; }; 6B797DD326D041ED00EB2873 /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = 6B797DD226D041ED00EB2873 /* Realm */; }; @@ -560,6 +562,8 @@ 6B155164265BE463001D19E2 /* TestValidityCheck.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestValidityCheck.swift; sourceTree = ""; }; 6B155165265BE463001D19E2 /* Setting.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Setting.swift; sourceTree = ""; }; 6B24E85A2660E0030003808F /* get-dgc-gov-it.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "get-dgc-gov-it.der"; sourceTree = ""; }; + 6B2A88D12805F4C500139838 /* testaka4-sogei-it-new.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "testaka4-sogei-it-new.der"; sourceTree = ""; }; + 6B5DC95028085B7C00B209E5 /* get-dgc-gov-it-new.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "get-dgc-gov-it-new.der"; sourceTree = ""; }; 6B797DD926D0528200EB2873 /* String+SHA256.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+SHA256.swift"; sourceTree = ""; }; 6B797DDC26D052B800EB2873 /* Data+SHA256.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Data+SHA256.swift"; sourceTree = ""; }; 6BA8B9DF266EB8E80060D767 /* VaccineValidityCheckTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VaccineValidityCheckTests.swift; sourceTree = ""; }; @@ -1136,6 +1140,8 @@ 65E282062697276400377913 /* Certificates */ = { isa = PBXGroup; children = ( + 6B5DC95028085B7C00B209E5 /* get-dgc-gov-it-new.der */, + 6B2A88D12805F4C500139838 /* testaka4-sogei-it-new.der */, 9F90C579265E284A00B2F992 /* testaka4-sogei-it.der */, 6B24E85A2660E0030003808F /* get-dgc-gov-it.der */, ); @@ -1634,6 +1640,7 @@ 65E281E42697259D00377913 /* VerificationViewController.xib in Resources */, 14EB429A275FAFFF006E9183 /* DebugView.xib in Resources */, 65E281E52697259D00377913 /* Roboto-Italic.ttf in Resources */, + 6B2A88D22805F4C700139838 /* testaka4-sogei-it-new.der in Resources */, 14CD25E427B2BA6B007DF2A4 /* HFBackViewController.xib in Resources */, 140B09D427B2D16F003A017F /* HeaderBar.xib in Resources */, 65E281E62697259D00377913 /* Roboto-MediumItalic.ttf in Resources */, @@ -1698,6 +1705,7 @@ 1410B20D271EAE6000F912BA /* PickerViewController.xib in Resources */, 9F4F3C612649D71F00F59BA2 /* Localizable.strings in Resources */, 65E7000F26AF75AD00715CCC /* ResultView.xib in Resources */, + 6B5DC95128085B7C00B209E5 /* get-dgc-gov-it-new.der in Resources */, 9F90C596265E591E00B2F992 /* TitilliumWeb-Bold.ttf in Resources */, 653F929026B007B5000BE8F5 /* HomeViewController.xib in Resources */, 90CDC6BA271EB48C00707836 /* SettingsCell.xib in Resources */, @@ -2150,7 +2158,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.3.0; + MARKETING_VERSION = 1.3.1; PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2174,7 +2182,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.3.0; + MARKETING_VERSION = 1.3.1; PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2261,7 +2269,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.3.0; + MARKETING_VERSION = 1.3.1; PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2286,7 +2294,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.3.0; + MARKETING_VERSION = 1.3.1; PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2417,7 +2425,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.3.0; + MARKETING_VERSION = 1.3.1; PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2442,7 +2450,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.3.0; + MARKETING_VERSION = 1.3.1; PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2636,7 +2644,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.3.0; + MARKETING_VERSION = 1.3.1; PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2661,7 +2669,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.3.0; + MARKETING_VERSION = 1.3.1; PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = "";