Skip to content

Commit

Permalink
feat: update certificates
Browse files Browse the repository at this point in the history
Co-authored-by: Emilio Apuzzo <[email protected]>
Co-authored-by: Light2288 <[email protected]>
  • Loading branch information
3 people authored Apr 19, 2022
1 parent 077fe2f commit a5ad747
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,29 @@ class GatewayConnection {
var timer: Timer?

private let certificateFilename: String
private let secondCertificateFilename: String
private let certificateEvaluator: String

static let shared = 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))
}

Expand Down
2 changes: 2 additions & 0 deletions DGCAVerifier/SupportingFiles/Plists/Info-Dev.plist
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,7 @@
<string>$(certificateEvaluator)</string>
<key>certificateFilename</key>
<string>$(certificateFilename)</string>
<key>secondCertificateFilename</key>
<string>$(secondCertificateFilename)</string>
</dict>
</plist>
2 changes: 2 additions & 0 deletions DGCAVerifier/SupportingFiles/Plists/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,7 @@
<string>$(certificateEvaluator)</string>
<key>certificateFilename</key>
<string>$(certificateFilename)</string>
<key>secondCertificateFilename</key>
<string>$(secondCertificateFilename)</string>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 16 additions & 8 deletions Verifier.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -560,6 +562,8 @@
6B155164265BE463001D19E2 /* TestValidityCheck.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestValidityCheck.swift; sourceTree = "<group>"; };
6B155165265BE463001D19E2 /* Setting.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Setting.swift; sourceTree = "<group>"; };
6B24E85A2660E0030003808F /* get-dgc-gov-it.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "get-dgc-gov-it.der"; sourceTree = "<group>"; };
6B2A88D12805F4C500139838 /* testaka4-sogei-it-new.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "testaka4-sogei-it-new.der"; sourceTree = "<group>"; };
6B5DC95028085B7C00B209E5 /* get-dgc-gov-it-new.der */ = {isa = PBXFileReference; lastKnownFileType = file; path = "get-dgc-gov-it-new.der"; sourceTree = "<group>"; };
6B797DD926D0528200EB2873 /* String+SHA256.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+SHA256.swift"; sourceTree = "<group>"; };
6B797DDC26D052B800EB2873 /* Data+SHA256.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Data+SHA256.swift"; sourceTree = "<group>"; };
6BA8B9DF266EB8E80060D767 /* VaccineValidityCheckTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VaccineValidityCheckTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -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 */,
);
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 = "";
Expand All @@ -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 = "";
Expand Down Expand Up @@ -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 = "";
Expand All @@ -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 = "";
Expand Down Expand Up @@ -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 = "";
Expand All @@ -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 = "";
Expand Down Expand Up @@ -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 = "";
Expand All @@ -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 = "";
Expand Down

0 comments on commit a5ad747

Please sign in to comment.