├── .gitignore ├── LICENSE ├── README.md ├── test.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── test.xccheckout ├── test ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.h ├── ViewController.m ├── main.m └── test.entitlements └── testTests ├── Info.plist └── testTests.m /.gitignore: -------------------------------------------------------------------------------- 1 | # CocoaPods 2 | # 3 | # We recommend against adding the Pods directory to your .gitignore. However 4 | # you should judge for yourself, the pros and cons are mentioned at: 5 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control? 6 | # 7 | # Pods/ 8 | 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CryptoTokenKit-TrivialExample-OpenSC 2 | ==================================== 3 | 4 | Yosemite 10.10 its new CryptoTokenKit -- trivial example to track card insert/query as to compare with OpenSC 5 | 6 | Quick example -- see the view controller to track readers and cards that are (un)plugged; scan them and print some details on what is found. Including a entersafe specific serial number extraction through the normal APDU interface. 7 | 8 | NOTE: not very careful in cleaning up dangling card references; will leak observers/card-descriptors. 9 | 10 | -------------------------------------------------------------------------------- /test.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 329185C219AB3A120015C9C2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 329185C119AB3A120015C9C2 /* main.m */; }; 11 | 329185C519AB3A120015C9C2 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 329185C419AB3A120015C9C2 /* ViewController.m */; }; 12 | 329185C819AB3A120015C9C2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 329185C719AB3A120015C9C2 /* AppDelegate.m */; }; 13 | 329185CA19AB3A120015C9C2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 329185C919AB3A120015C9C2 /* Images.xcassets */; }; 14 | 329185CD19AB3A130015C9C2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 329185CB19AB3A130015C9C2 /* Main.storyboard */; }; 15 | 329185D919AB3A130015C9C2 /* testTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 329185D819AB3A130015C9C2 /* testTests.m */; }; 16 | 329185E319AB3A260015C9C2 /* CryptoTokenKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 329185E219AB3A260015C9C2 /* CryptoTokenKit.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 329185D319AB3A130015C9C2 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 329185B419AB3A120015C9C2 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 329185BB19AB3A120015C9C2; 25 | remoteInfo = test; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 329185BC19AB3A120015C9C2 /* test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = test.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 329185C019AB3A120015C9C2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 329185C119AB3A120015C9C2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 33 | 329185C319AB3A120015C9C2 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 34 | 329185C419AB3A120015C9C2 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 35 | 329185C619AB3A120015C9C2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 36 | 329185C719AB3A120015C9C2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 37 | 329185C919AB3A120015C9C2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 38 | 329185CC19AB3A130015C9C2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | 329185D219AB3A130015C9C2 /* testTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = testTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 329185D719AB3A130015C9C2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 41 | 329185D819AB3A130015C9C2 /* testTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = testTests.m; sourceTree = ""; }; 42 | 329185E219AB3A260015C9C2 /* CryptoTokenKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CryptoTokenKit.framework; path = System/Library/Frameworks/CryptoTokenKit.framework; sourceTree = SDKROOT; }; 43 | 329185E419AB3B880015C9C2 /* test.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = test.entitlements; sourceTree = ""; }; 44 | /* End PBXFileReference section */ 45 | 46 | /* Begin PBXFrameworksBuildPhase section */ 47 | 329185B919AB3A120015C9C2 /* Frameworks */ = { 48 | isa = PBXFrameworksBuildPhase; 49 | buildActionMask = 2147483647; 50 | files = ( 51 | 329185E319AB3A260015C9C2 /* CryptoTokenKit.framework in Frameworks */, 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | 329185CF19AB3A130015C9C2 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | /* End PBXFrameworksBuildPhase section */ 63 | 64 | /* Begin PBXGroup section */ 65 | 329185B319AB3A120015C9C2 = { 66 | isa = PBXGroup; 67 | children = ( 68 | 329185E219AB3A260015C9C2 /* CryptoTokenKit.framework */, 69 | 329185BE19AB3A120015C9C2 /* test */, 70 | 329185D519AB3A130015C9C2 /* testTests */, 71 | 329185BD19AB3A120015C9C2 /* Products */, 72 | ); 73 | sourceTree = ""; 74 | }; 75 | 329185BD19AB3A120015C9C2 /* Products */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 329185BC19AB3A120015C9C2 /* test.app */, 79 | 329185D219AB3A130015C9C2 /* testTests.xctest */, 80 | ); 81 | name = Products; 82 | sourceTree = ""; 83 | }; 84 | 329185BE19AB3A120015C9C2 /* test */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 329185E419AB3B880015C9C2 /* test.entitlements */, 88 | 329185C319AB3A120015C9C2 /* ViewController.h */, 89 | 329185C419AB3A120015C9C2 /* ViewController.m */, 90 | 329185C619AB3A120015C9C2 /* AppDelegate.h */, 91 | 329185C719AB3A120015C9C2 /* AppDelegate.m */, 92 | 329185C919AB3A120015C9C2 /* Images.xcassets */, 93 | 329185CB19AB3A130015C9C2 /* Main.storyboard */, 94 | 329185BF19AB3A120015C9C2 /* Supporting Files */, 95 | ); 96 | path = test; 97 | sourceTree = ""; 98 | }; 99 | 329185BF19AB3A120015C9C2 /* Supporting Files */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 329185C019AB3A120015C9C2 /* Info.plist */, 103 | 329185C119AB3A120015C9C2 /* main.m */, 104 | ); 105 | name = "Supporting Files"; 106 | sourceTree = ""; 107 | }; 108 | 329185D519AB3A130015C9C2 /* testTests */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 329185D819AB3A130015C9C2 /* testTests.m */, 112 | 329185D619AB3A130015C9C2 /* Supporting Files */, 113 | ); 114 | path = testTests; 115 | sourceTree = ""; 116 | }; 117 | 329185D619AB3A130015C9C2 /* Supporting Files */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 329185D719AB3A130015C9C2 /* Info.plist */, 121 | ); 122 | name = "Supporting Files"; 123 | sourceTree = ""; 124 | }; 125 | /* End PBXGroup section */ 126 | 127 | /* Begin PBXNativeTarget section */ 128 | 329185BB19AB3A120015C9C2 /* test */ = { 129 | isa = PBXNativeTarget; 130 | buildConfigurationList = 329185DC19AB3A130015C9C2 /* Build configuration list for PBXNativeTarget "test" */; 131 | buildPhases = ( 132 | 329185B819AB3A120015C9C2 /* Sources */, 133 | 329185B919AB3A120015C9C2 /* Frameworks */, 134 | 329185BA19AB3A120015C9C2 /* Resources */, 135 | ); 136 | buildRules = ( 137 | ); 138 | dependencies = ( 139 | ); 140 | name = test; 141 | productName = test; 142 | productReference = 329185BC19AB3A120015C9C2 /* test.app */; 143 | productType = "com.apple.product-type.application"; 144 | }; 145 | 329185D119AB3A130015C9C2 /* testTests */ = { 146 | isa = PBXNativeTarget; 147 | buildConfigurationList = 329185DF19AB3A130015C9C2 /* Build configuration list for PBXNativeTarget "testTests" */; 148 | buildPhases = ( 149 | 329185CE19AB3A130015C9C2 /* Sources */, 150 | 329185CF19AB3A130015C9C2 /* Frameworks */, 151 | 329185D019AB3A130015C9C2 /* Resources */, 152 | ); 153 | buildRules = ( 154 | ); 155 | dependencies = ( 156 | 329185D419AB3A130015C9C2 /* PBXTargetDependency */, 157 | ); 158 | name = testTests; 159 | productName = testTests; 160 | productReference = 329185D219AB3A130015C9C2 /* testTests.xctest */; 161 | productType = "com.apple.product-type.bundle.unit-test"; 162 | }; 163 | /* End PBXNativeTarget section */ 164 | 165 | /* Begin PBXProject section */ 166 | 329185B419AB3A120015C9C2 /* Project object */ = { 167 | isa = PBXProject; 168 | attributes = { 169 | LastUpgradeCheck = 0600; 170 | ORGANIZATIONNAME = "Dirk-Willem van Gulik"; 171 | TargetAttributes = { 172 | 329185BB19AB3A120015C9C2 = { 173 | CreatedOnToolsVersion = 6.0; 174 | DevelopmentTeam = HN29PWT4WM; 175 | SystemCapabilities = { 176 | com.apple.Keychain = { 177 | enabled = 0; 178 | }; 179 | com.apple.Sandbox = { 180 | enabled = 1; 181 | }; 182 | }; 183 | }; 184 | 329185D119AB3A130015C9C2 = { 185 | CreatedOnToolsVersion = 6.0; 186 | TestTargetID = 329185BB19AB3A120015C9C2; 187 | }; 188 | }; 189 | }; 190 | buildConfigurationList = 329185B719AB3A120015C9C2 /* Build configuration list for PBXProject "test" */; 191 | compatibilityVersion = "Xcode 3.2"; 192 | developmentRegion = English; 193 | hasScannedForEncodings = 0; 194 | knownRegions = ( 195 | en, 196 | Base, 197 | ); 198 | mainGroup = 329185B319AB3A120015C9C2; 199 | productRefGroup = 329185BD19AB3A120015C9C2 /* Products */; 200 | projectDirPath = ""; 201 | projectRoot = ""; 202 | targets = ( 203 | 329185BB19AB3A120015C9C2 /* test */, 204 | 329185D119AB3A130015C9C2 /* testTests */, 205 | ); 206 | }; 207 | /* End PBXProject section */ 208 | 209 | /* Begin PBXResourcesBuildPhase section */ 210 | 329185BA19AB3A120015C9C2 /* Resources */ = { 211 | isa = PBXResourcesBuildPhase; 212 | buildActionMask = 2147483647; 213 | files = ( 214 | 329185CA19AB3A120015C9C2 /* Images.xcassets in Resources */, 215 | 329185CD19AB3A130015C9C2 /* Main.storyboard in Resources */, 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | 329185D019AB3A130015C9C2 /* Resources */ = { 220 | isa = PBXResourcesBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | /* End PBXResourcesBuildPhase section */ 227 | 228 | /* Begin PBXSourcesBuildPhase section */ 229 | 329185B819AB3A120015C9C2 /* Sources */ = { 230 | isa = PBXSourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | 329185C519AB3A120015C9C2 /* ViewController.m in Sources */, 234 | 329185C219AB3A120015C9C2 /* main.m in Sources */, 235 | 329185C819AB3A120015C9C2 /* AppDelegate.m in Sources */, 236 | ); 237 | runOnlyForDeploymentPostprocessing = 0; 238 | }; 239 | 329185CE19AB3A130015C9C2 /* Sources */ = { 240 | isa = PBXSourcesBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | 329185D919AB3A130015C9C2 /* testTests.m in Sources */, 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | /* End PBXSourcesBuildPhase section */ 248 | 249 | /* Begin PBXTargetDependency section */ 250 | 329185D419AB3A130015C9C2 /* PBXTargetDependency */ = { 251 | isa = PBXTargetDependency; 252 | target = 329185BB19AB3A120015C9C2 /* test */; 253 | targetProxy = 329185D319AB3A130015C9C2 /* PBXContainerItemProxy */; 254 | }; 255 | /* End PBXTargetDependency section */ 256 | 257 | /* Begin PBXVariantGroup section */ 258 | 329185CB19AB3A130015C9C2 /* Main.storyboard */ = { 259 | isa = PBXVariantGroup; 260 | children = ( 261 | 329185CC19AB3A130015C9C2 /* Base */, 262 | ); 263 | name = Main.storyboard; 264 | sourceTree = ""; 265 | }; 266 | /* End PBXVariantGroup section */ 267 | 268 | /* Begin XCBuildConfiguration section */ 269 | 329185DA19AB3A130015C9C2 /* Debug */ = { 270 | isa = XCBuildConfiguration; 271 | buildSettings = { 272 | ALWAYS_SEARCH_USER_PATHS = NO; 273 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 274 | CLANG_CXX_LIBRARY = "libc++"; 275 | CLANG_ENABLE_MODULES = YES; 276 | CLANG_ENABLE_OBJC_ARC = YES; 277 | CLANG_WARN_BOOL_CONVERSION = YES; 278 | CLANG_WARN_CONSTANT_CONVERSION = YES; 279 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 280 | CLANG_WARN_EMPTY_BODY = YES; 281 | CLANG_WARN_ENUM_CONVERSION = YES; 282 | CLANG_WARN_INT_CONVERSION = YES; 283 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 284 | CLANG_WARN_UNREACHABLE_CODE = YES; 285 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 286 | CODE_SIGN_IDENTITY = "-"; 287 | COPY_PHASE_STRIP = NO; 288 | ENABLE_STRICT_OBJC_MSGSEND = YES; 289 | GCC_C_LANGUAGE_STANDARD = gnu99; 290 | GCC_DYNAMIC_NO_PIC = NO; 291 | GCC_OPTIMIZATION_LEVEL = 0; 292 | GCC_PREPROCESSOR_DEFINITIONS = ( 293 | "DEBUG=1", 294 | "$(inherited)", 295 | ); 296 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 297 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 298 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 299 | GCC_WARN_UNDECLARED_SELECTOR = YES; 300 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 301 | GCC_WARN_UNUSED_FUNCTION = YES; 302 | GCC_WARN_UNUSED_VARIABLE = YES; 303 | MACOSX_DEPLOYMENT_TARGET = 10.10; 304 | MTL_ENABLE_DEBUG_INFO = YES; 305 | ONLY_ACTIVE_ARCH = YES; 306 | SDKROOT = macosx; 307 | }; 308 | name = Debug; 309 | }; 310 | 329185DB19AB3A130015C9C2 /* Release */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | ALWAYS_SEARCH_USER_PATHS = NO; 314 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 315 | CLANG_CXX_LIBRARY = "libc++"; 316 | CLANG_ENABLE_MODULES = YES; 317 | CLANG_ENABLE_OBJC_ARC = YES; 318 | CLANG_WARN_BOOL_CONVERSION = YES; 319 | CLANG_WARN_CONSTANT_CONVERSION = YES; 320 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 321 | CLANG_WARN_EMPTY_BODY = YES; 322 | CLANG_WARN_ENUM_CONVERSION = YES; 323 | CLANG_WARN_INT_CONVERSION = YES; 324 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 325 | CLANG_WARN_UNREACHABLE_CODE = YES; 326 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 327 | CODE_SIGN_IDENTITY = "-"; 328 | COPY_PHASE_STRIP = YES; 329 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 330 | ENABLE_NS_ASSERTIONS = NO; 331 | ENABLE_STRICT_OBJC_MSGSEND = YES; 332 | GCC_C_LANGUAGE_STANDARD = gnu99; 333 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 334 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 335 | GCC_WARN_UNDECLARED_SELECTOR = YES; 336 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 337 | GCC_WARN_UNUSED_FUNCTION = YES; 338 | GCC_WARN_UNUSED_VARIABLE = YES; 339 | MACOSX_DEPLOYMENT_TARGET = 10.10; 340 | MTL_ENABLE_DEBUG_INFO = NO; 341 | SDKROOT = macosx; 342 | }; 343 | name = Release; 344 | }; 345 | 329185DD19AB3A130015C9C2 /* Debug */ = { 346 | isa = XCBuildConfiguration; 347 | buildSettings = { 348 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 349 | CODE_SIGN_ENTITLEMENTS = test/test.entitlements; 350 | CODE_SIGN_IDENTITY = "Mac Developer"; 351 | "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; 352 | COMBINE_HIDPI_IMAGES = YES; 353 | INFOPLIST_FILE = test/Info.plist; 354 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 355 | PRODUCT_NAME = "$(TARGET_NAME)"; 356 | PROVISIONING_PROFILE = ""; 357 | }; 358 | name = Debug; 359 | }; 360 | 329185DE19AB3A130015C9C2 /* Release */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 364 | CODE_SIGN_ENTITLEMENTS = test/test.entitlements; 365 | CODE_SIGN_IDENTITY = "Mac Developer"; 366 | "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer"; 367 | COMBINE_HIDPI_IMAGES = YES; 368 | INFOPLIST_FILE = test/Info.plist; 369 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | PROVISIONING_PROFILE = ""; 372 | }; 373 | name = Release; 374 | }; 375 | 329185E019AB3A130015C9C2 /* Debug */ = { 376 | isa = XCBuildConfiguration; 377 | buildSettings = { 378 | BUNDLE_LOADER = "$(TEST_HOST)"; 379 | COMBINE_HIDPI_IMAGES = YES; 380 | FRAMEWORK_SEARCH_PATHS = ( 381 | "$(DEVELOPER_FRAMEWORKS_DIR)", 382 | "$(inherited)", 383 | ); 384 | GCC_PREPROCESSOR_DEFINITIONS = ( 385 | "DEBUG=1", 386 | "$(inherited)", 387 | ); 388 | INFOPLIST_FILE = testTests/Info.plist; 389 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 390 | PRODUCT_NAME = "$(TARGET_NAME)"; 391 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/test.app/Contents/MacOS/test"; 392 | }; 393 | name = Debug; 394 | }; 395 | 329185E119AB3A130015C9C2 /* Release */ = { 396 | isa = XCBuildConfiguration; 397 | buildSettings = { 398 | BUNDLE_LOADER = "$(TEST_HOST)"; 399 | COMBINE_HIDPI_IMAGES = YES; 400 | FRAMEWORK_SEARCH_PATHS = ( 401 | "$(DEVELOPER_FRAMEWORKS_DIR)", 402 | "$(inherited)", 403 | ); 404 | INFOPLIST_FILE = testTests/Info.plist; 405 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 406 | PRODUCT_NAME = "$(TARGET_NAME)"; 407 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/test.app/Contents/MacOS/test"; 408 | }; 409 | name = Release; 410 | }; 411 | /* End XCBuildConfiguration section */ 412 | 413 | /* Begin XCConfigurationList section */ 414 | 329185B719AB3A120015C9C2 /* Build configuration list for PBXProject "test" */ = { 415 | isa = XCConfigurationList; 416 | buildConfigurations = ( 417 | 329185DA19AB3A130015C9C2 /* Debug */, 418 | 329185DB19AB3A130015C9C2 /* Release */, 419 | ); 420 | defaultConfigurationIsVisible = 0; 421 | defaultConfigurationName = Release; 422 | }; 423 | 329185DC19AB3A130015C9C2 /* Build configuration list for PBXNativeTarget "test" */ = { 424 | isa = XCConfigurationList; 425 | buildConfigurations = ( 426 | 329185DD19AB3A130015C9C2 /* Debug */, 427 | 329185DE19AB3A130015C9C2 /* Release */, 428 | ); 429 | defaultConfigurationIsVisible = 0; 430 | }; 431 | 329185DF19AB3A130015C9C2 /* Build configuration list for PBXNativeTarget "testTests" */ = { 432 | isa = XCConfigurationList; 433 | buildConfigurations = ( 434 | 329185E019AB3A130015C9C2 /* Debug */, 435 | 329185E119AB3A130015C9C2 /* Release */, 436 | ); 437 | defaultConfigurationIsVisible = 0; 438 | }; 439 | /* End XCConfigurationList section */ 440 | }; 441 | rootObject = 329185B419AB3A120015C9C2 /* Project object */; 442 | } 443 | -------------------------------------------------------------------------------- /test.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test.xcodeproj/project.xcworkspace/xcshareddata/test.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 152E1C78-2219-4B42-8336-CB3B1195F9E8 9 | IDESourceControlProjectName 10 | test 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | B066D1BF153DE2B16603D7BCD3274CCF37E3A0CC 14 | github.com:dirkx/CryptoTokenKit-TrivialExample-OpenSC.git 15 | 16 | IDESourceControlProjectPath 17 | test.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | B066D1BF153DE2B16603D7BCD3274CCF37E3A0CC 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | github.com:dirkx/CryptoTokenKit-TrivialExample-OpenSC.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | B066D1BF153DE2B16603D7BCD3274CCF37E3A0CC 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | B066D1BF153DE2B16603D7BCD3274CCF37E3A0CC 36 | IDESourceControlWCCName 37 | CryptoTokenKit-TrivialExample-OpenSC 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /test/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // test 4 | // 5 | // Created by Dirk-Willem van Gulik on 25-08-14. 6 | // Copyright (c) 2014 Dirk-Willem van Gulik. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /test/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // test 4 | // 5 | // Created by Dirk-Willem van Gulik on 25-08-14. 6 | // Copyright (c) 2014 Dirk-Willem van Gulik. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 18 | // Insert code here to initialize your application 19 | } 20 | 21 | - (void)applicationWillTerminate:(NSNotification *)aNotification { 22 | // Insert code here to tear down your application 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /test/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | Default 510 | 511 | 512 | 513 | 514 | 515 | 516 | Left to Right 517 | 518 | 519 | 520 | 521 | 522 | 523 | Right to Left 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | Default 535 | 536 | 537 | 538 | 539 | 540 | 541 | Left to Right 542 | 543 | 544 | 545 | 546 | 547 | 548 | Right to Left 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | -------------------------------------------------------------------------------- /test/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /test/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | org.webweaving.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2014 Dirk-Willem van Gulik. All rights reserved. 29 | NSMainStoryboardFile 30 | Main 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /test/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // test 4 | // 5 | // Created by Dirk-Willem van Gulik on 25-08-14. 6 | // Copyright (c) 2014 Dirk-Willem van Gulik. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : NSViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /test/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // test 4 | // 5 | // Created by Dirk-Willem van Gulik on 25-08-14. 6 | // Copyright (c) 2014 Dirk-Willem van Gulik. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import 11 | 12 | @interface NSData (fingerprint) 13 | -(NSString *)fingerprint; 14 | @end 15 | 16 | @implementation NSData (fingerprint) 17 | -(NSString *)fingerprint { 18 | NSMutableString * str = [NSMutableString string]; 19 | for(int i = 0; i < [self length]; i++) 20 | [str appendFormat:@"%s%02x", i ? ":" : "", ((unsigned char *)[self bytes])[i]]; 21 | [str appendFormat:@" (%lu bytes)", (unsigned long)[self length]]; 22 | return str; 23 | } 24 | @end 25 | 26 | 27 | @interface ViewController () 28 | @property (nonatomic, retain) TKSmartCardSlotManager * mngr; 29 | @property (nonatomic, retain) NSMutableArray * slots; 30 | @property (nonatomic, retain) NSMutableArray * cards; 31 | @end 32 | 33 | @implementation ViewController 34 | 35 | 36 | - (void)viewDidLoad { 37 | [super viewDidLoad]; 38 | 39 | self.mngr = [TKSmartCardSlotManager defaultManager]; 40 | assert(self.mngr); 41 | 42 | // Observe readers joining and leaving. 43 | // 44 | [self.mngr addObserver:self forKeyPath:@"slotNames" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld | NSKeyValueObservingOptionInitial context:nil]; 45 | 46 | } 47 | 48 | -(void)dealloc { 49 | [self.mngr removeObserver:self forKeyPath:@"slotNames"]; 50 | 51 | for(id slot in self.slots) 52 | [slot removeObserver:self]; 53 | 54 | for(id card in self.cards) 55 | [card removeObserver:self]; 56 | } 57 | 58 | - (void)observeValueForKeyPath:(NSString *)keyPath 59 | ofObject:(id)object 60 | change:(NSDictionary *)change 61 | context:(void *)context { 62 | 63 | if ([keyPath isEqualToString:@"slotNames"]) { 64 | NSLog(@"(Re)Scanning Slots: %@",[self.mngr slotNames]); 65 | 66 | // Purge any old observing and rebuild the array. 67 | // 68 | for(id slot in _slots) { 69 | [slot removeObserver:self forKeyPath:@"state"]; 70 | 71 | } 72 | for(id card in self.cards) 73 | [card removeObserver:self forKeyPath:@"valid"]; 74 | 75 | self.slots = [[NSMutableArray alloc] init]; 76 | self.cards = [[NSMutableArray alloc] init]; 77 | 78 | for(NSString *slotName in [_mngr slotNames]) { 79 | 80 | [_mngr getSlotWithName:slotName reply:^(TKSmartCardSlot *slot) { 81 | [_slots addObject:slot]; 82 | 83 | [slot addObserver:self forKeyPath:@"state" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld | NSKeyValueObservingOptionInitial context:nil]; 84 | 85 | NSLog(@"Slot: %@",slot); 86 | NSLog(@" name: %@",slot.name); 87 | NSLog(@" state: %@",[self stateString:slot.state]); 88 | }]; 89 | }; 90 | } // end of Slot change 91 | else if ([keyPath isEqualToString:@"state"]) { 92 | TKSmartCardSlot * slot = object; 93 | NSLog(@" state: %@ for %@",[self stateString:slot.state], slot); 94 | 95 | if (slot.state == TKSmartCardSlotStateValidCard) { 96 | NSLog(@" atr: %@",slot.ATR); 97 | 98 | TKSmartCardATRInterfaceGroup * iface = [slot.ATR interfaceGroupForProtocol:TKSmartCardProtocolT1]; 99 | NSLog(@"Iface for T1: %@", iface); 100 | 101 | TKSmartCard * sc = [slot makeSmartCard]; 102 | [_cards addObject:sc]; 103 | 104 | [sc addObserver:self forKeyPath:@"valid" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld | NSKeyValueObservingOptionInitial context:nil]; 105 | 106 | NSLog(@"Card: %@", sc); 107 | NSLog(@"Allowed protocol bitmask: %lx", sc.allowedProtocols); 108 | 109 | if (sc.allowedProtocols & TKSmartCardProtocolT0) 110 | NSLog(@" T0"); 111 | if (sc.allowedProtocols & TKSmartCardProtocolT1) 112 | NSLog(@" T1"); 113 | if (sc.allowedProtocols & TKSmartCardProtocolT15) 114 | NSLog(@" T15"); 115 | } 116 | 117 | } 118 | else if ([keyPath isEqualToString:@"valid"]) { 119 | TKSmartCard * sc = object; 120 | 121 | if (sc.valid) [sc beginSessionWithReply:^(BOOL success, NSError *error) { 122 | NSLog(@"Card in slot <%@>",sc.slot.name); 123 | NSLog(@" now in session, selected protocol: %lx", sc.currentProtocol); 124 | 125 | assert(sc.currentProtocol != TKSmartCardProtocolNone); 126 | 127 | #if 0 128 | static const char pin[] = { '1', '2','3','4',0xFF,0xFF,0xFF,0xFF }; 129 | [sc sendIns:0x20 130 | p1:0 131 | p2:0 132 | data:[NSData dataWithBytes:pin length:sizeof(pin)] 133 | le:0 134 | reply:^(NSData *replyData, UInt16 sw, NSError *error) { 135 | NSLog(@"Error: %@", error); 136 | NSLog(@"Data: %@", replyData); 137 | NSLog(@"SW: %02x/%02x", sw >> 8, sw & 0xFF); 138 | } 139 | ]; 140 | #endif 141 | #if 0 142 | sc.cla = 0x0; 143 | [sc sendIns:0x84 // entersafe - get me a random number 144 | p1:0 145 | p2:0 146 | data:nil 147 | le:[NSNumber numberWithInt:8] 148 | reply:^(NSData *replyData, UInt16 sw, NSError *error) { 149 | assert(!error); 150 | NSLog(@"SW: %02x/%02x", sw >> 8, sw & 0xFF); 151 | NSLog(@"random data: %@", [replyData fingerprint]); 152 | } 153 | ]; 154 | #endif 155 | #if 1 156 | sc.cla = 0x80; 157 | [sc sendIns:0xEA // entersafe - get card serial number 158 | p1:0 159 | p2:0 160 | data:nil 161 | le:[NSNumber numberWithInt:8] // what we expect *back* 162 | reply:^(NSData *replyData, UInt16 sw, NSError *error) { 163 | assert(!error); 164 | NSLog(@"SW: %02x/%02x", sw >> 8, sw & 0xFF); 165 | NSLog(@"Serial: %@", [replyData fingerprint]); 166 | } 167 | ]; 168 | #endif 169 | 170 | [sc endSession]; 171 | }]; 172 | } // end of TKSmartCard sc valid change 173 | else { 174 | NSLog(@"Ignored..."); 175 | } 176 | } // end of function 177 | 178 | - (void)setRepresentedObject:(id)representedObject { 179 | [super setRepresentedObject:representedObject]; 180 | 181 | // Update the view, if already loaded. 182 | 183 | } 184 | 185 | -(NSString *)stateString:(TKSmartCardSlotState)state { 186 | switch (state) { 187 | case TKSmartCardSlotStateEmpty: 188 | return @"TKSmartCardSlotStateEmpty"; 189 | break; 190 | case TKSmartCardSlotStateMissing: 191 | return @"TKSmartCardSlotStateMissing"; 192 | break; 193 | case TKSmartCardSlotStateMuteCard: 194 | return @"TKSmartCardSlotStateMuteCard"; 195 | break; 196 | case TKSmartCardSlotStateProbing: 197 | return @"TKSmartCardSlotStateProbing"; 198 | break; 199 | case TKSmartCardSlotStateValidCard: 200 | return @"TKSmartCardSlotStateValidCard"; 201 | break; 202 | default: 203 | return @"error"; 204 | break; 205 | } 206 | return @"bug"; 207 | } 208 | @end 209 | -------------------------------------------------------------------------------- /test/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // test 4 | // 5 | // Created by Dirk-Willem van Gulik on 25-08-14. 6 | // Copyright (c) 2014 Dirk-Willem van Gulik. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | -------------------------------------------------------------------------------- /test/test.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.smartcard 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /testTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.webweaving.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /testTests/testTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // testTests.m 3 | // testTests 4 | // 5 | // Created by Dirk-Willem van Gulik on 25-08-14. 6 | // Copyright (c) 2014 Dirk-Willem van Gulik. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface testTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation testTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | --------------------------------------------------------------------------------