Skip to content

Commit

Permalink
Merge pull request #16 from regulaforensics/Add-identity-pinning-sample
Browse files Browse the repository at this point in the history
Add identity pinning sample
  • Loading branch information
DzmitrySmaliakou authored Oct 17, 2023
2 parents 061f8f4 + 7b2fda1 commit 84793d4
Show file tree
Hide file tree
Showing 18 changed files with 923 additions and 0 deletions.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
36 changes: 36 additions & 0 deletions FaceCertificatePinning/FaceCertificatePinning/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// AppDelegate.swift
// FaceCertificatePinning
//
// Created by Serge Rylko on 13.10.23.
//

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="collection view cell content view" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="FaceCertificatePinning" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="FOs-Y9-ogJ">
<rect key="frame" x="0.0" y="59" width="393" height="379.66666666666669"/>
</imageView>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="6SJ-ka-Nnx">
<rect key="frame" x="0.0" y="438.66666666666674" width="393" height="301.33333333333326"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="6o7-G0-kZe">
<size key="itemSize" width="128" height="128"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFill" reuseIdentifier="DetectionCollectionViewCell" id="YBx-6q-aUh" customClass="DetectionCollectionViewCell" customModule="FaceCertificatePinning" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="128" height="128"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="pz2-NI-Sg2">
<rect key="frame" x="0.0" y="0.0" width="128" height="128"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="hdB-aA-JwC">
<rect key="frame" x="0.0" y="0.0" width="128" height="128"/>
</imageView>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="hdB-aA-JwC" secondAttribute="bottom" id="589-Wb-spg"/>
<constraint firstItem="hdB-aA-JwC" firstAttribute="leading" secondItem="pz2-NI-Sg2" secondAttribute="leading" id="FLS-gQ-hd5"/>
<constraint firstItem="hdB-aA-JwC" firstAttribute="top" secondItem="pz2-NI-Sg2" secondAttribute="top" id="qHf-54-AsU"/>
<constraint firstAttribute="trailing" secondItem="hdB-aA-JwC" secondAttribute="trailing" id="ym8-D6-Pj1"/>
</constraints>
</collectionViewCellContentView>
<connections>
<outlet property="imageView" destination="hdB-aA-JwC" id="xZB-Jk-eRw"/>
</connections>
</collectionViewCell>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="ZAO-Cl-XFv">
<rect key="frame" x="128" y="0.0" width="127.99999999999997" height="128"/>
<autoresizingMask key="autoresizingMask"/>
<collectionViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="AG5-8B-r0P">
<rect key="frame" x="0.0" y="0.0" width="127.99999999999997" height="128"/>
<autoresizingMask key="autoresizingMask"/>
</collectionViewCellContentView>
</collectionViewCell>
</cells>
<connections>
<outlet property="delegate" destination="BYZ-38-t0r" id="dij-UU-8uz"/>
</connections>
</collectionView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="E91-Jl-maB">
<rect key="frame" x="134.66666666666666" y="760" width="123.99999999999997" height="35"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="filled" title="Detect Faces"/>
<connections>
<action selector="didPressDetectFacesButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="pe0-UN-ZSY"/>
</connections>
</button>
<activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="large" translatesAutoresizingMaskIntoConstraints="NO" id="8W4-mP-Zc6">
<rect key="frame" x="178" y="570.66666666666663" width="37" height="37"/>
</activityIndicatorView>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="E91-Jl-maB" firstAttribute="top" secondItem="6SJ-ka-Nnx" secondAttribute="bottom" constant="20" id="3c1-JJ-oH9"/>
<constraint firstItem="8W4-mP-Zc6" firstAttribute="centerY" secondItem="6SJ-ka-Nnx" secondAttribute="centerY" id="EpX-YZ-RlV"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="FOs-Y9-ogJ" secondAttribute="trailing" id="HOk-A9-OT9"/>
<constraint firstItem="6SJ-ka-Nnx" firstAttribute="top" secondItem="FOs-Y9-ogJ" secondAttribute="bottom" id="Iad-eY-P7z"/>
<constraint firstItem="FOs-Y9-ogJ" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="TtJ-KE-SAC"/>
<constraint firstItem="E91-Jl-maB" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="ehN-J8-Cqx"/>
<constraint firstItem="FOs-Y9-ogJ" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="fbH-qE-XTM"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="E91-Jl-maB" secondAttribute="bottom" constant="23" id="gW3-wR-aUM"/>
<constraint firstItem="FOs-Y9-ogJ" firstAttribute="height" secondItem="6Tk-OE-BBY" secondAttribute="height" multiplier="0.5" id="hPD-w7-joq"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="6SJ-ka-Nnx" secondAttribute="trailing" id="qGD-UT-Ryf"/>
<constraint firstItem="6SJ-ka-Nnx" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="zCL-G0-gED"/>
<constraint firstItem="8W4-mP-Zc6" firstAttribute="centerX" secondItem="6SJ-ka-Nnx" secondAttribute="centerX" id="zNS-eO-DDO"/>
</constraints>
</view>
<connections>
<outlet property="activityIndicator" destination="8W4-mP-Zc6" id="2on-If-lNd"/>
<outlet property="collectionView" destination="6SJ-ka-Nnx" id="5TU-Ll-DCa"/>
<outlet property="detectButton" destination="E91-Jl-maB" id="Iql-kw-aBU"/>
<outlet property="imageView" destination="FOs-Y9-ogJ" id="Mnk-O9-6t0"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="78.625954198473281" y="-2.1126760563380285"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// DetectionCollectionViewCell.swift
// FaceCertificatePinning
//
// Created by Serge Rylko on 13.10.23.
//

import UIKit

class DetectionCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var imageView: UIImageView!
}
43 changes: 43 additions & 0 deletions FaceCertificatePinning/FaceCertificatePinning/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSPinnedDomains</key>
<dict>
<key>regulaforensics.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSPinnedLeafIdentities</key>
<array>
<dict>
<key>SPKI-SHA256-BASE64</key>
<string>/5RKFaPkCjAzvsEZHOlYqncYADaLIG5VfTmhsBbkaBk=</string>
</dict>
</array>
</dict>
</dict>
</dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
</dict>
</plist>
52 changes: 52 additions & 0 deletions FaceCertificatePinning/FaceCertificatePinning/SceneDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// SceneDelegate.swift
// FaceCertificatePinning
//
// Created by Serge Rylko on 13.10.23.
//

import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }
}

func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
}

func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}

func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}

func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}

func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}


}

Loading

0 comments on commit 84793d4

Please sign in to comment.