├── .gitignore ├── .gitmodules ├── Cartfile ├── Cartfile.resolved ├── KeePassHTTPKit.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── xcshareddata │ └── xcschemes │ │ └── KeePassHTTPKit.xcscheme └── xcuserdata │ └── michael.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── KeePassHTTPKit ├── Categories │ ├── NSData+Cryptor.h │ └── NSData+Cryptor.m ├── Handlers │ ├── KPHAssociateHandler.h │ ├── KPHAssociateHandler.m │ ├── KPHGeneratePasswordHandler.h │ ├── KPHGeneratePasswordHandler.m │ ├── KPHGetAllLoginsHandler.h │ ├── KPHGetAllLoginsHandler.m │ ├── KPHGetLoginsCountHandler.h │ ├── KPHGetLoginsCountHandler.m │ ├── KPHGetLoginsHandler.h │ ├── KPHGetLoginsHandler.m │ ├── KPHHandler.h │ ├── KPHHandler.m │ ├── KPHSetLoginHandler.h │ ├── KPHSetLoginHandler.m │ ├── KPHTestAssociateHandler.h │ └── KPHTestAssociateHandler.m ├── Info.plist ├── KPHAESConfig.h ├── KPHAESConfig.m ├── KPHDelegate.h ├── KPHRequest.h ├── KPHRequest.m ├── KPHResponse.h ├── KPHResponse.m ├── KPHServer.h ├── KPHServer.m ├── KPHUtils.h ├── KPHUtils.m └── KeePassHTTPKit.h ├── KeePassHTTPKitTests ├── Info.plist └── KeePassHTTPKitTests.m ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | #*.xcscheme 26 | 27 | ## Obj-C/Swift specific 28 | *.hmap 29 | *.ipa 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 52 | 53 | fastlane/report.xml 54 | fastlane/screenshots -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MacPass/KeePassHTTPKit/7894d5eaf6edaddb6890c3adf453b5f8c8624aa0/.gitmodules -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "swisspol/GCDWebServer" == 3.4.1 2 | github "jsonmodel/jsonmodel" "cd940e7ae0e74c927cd4293931f5d7e6465c343d" 3 | 4 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "jsonmodel/jsonmodel" "364f57ba9671af417b35762049d8aed482fcf075" 2 | github "swisspol/GCDWebServer" "3.4.1" 3 | -------------------------------------------------------------------------------- /KeePassHTTPKit.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4C0A25131BFA679D007DFDBA /* GCDWebServers.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4CDE593D1BF9E87200C7AF5B /* GCDWebServers.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 11 | 4C4E1DB31EF0467000128BA9 /* JSONModel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C4E1DB21EF0467000128BA9 /* JSONModel.framework */; }; 12 | 4C7A19B21F8CBEDD00C4D20B /* JSONModel.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4C4E1DB21EF0467000128BA9 /* JSONModel.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 13 | 4CCAC3921BF9C30300EA4639 /* KeePassHTTPKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CCAC3911BF9C30300EA4639 /* KeePassHTTPKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; 14 | 4CCAC3991BF9C30300EA4639 /* KeePassHTTPKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CCAC38E1BF9C30300EA4639 /* KeePassHTTPKit.framework */; }; 15 | 4CCAC39E1BF9C30300EA4639 /* KeePassHTTPKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCAC39D1BF9C30300EA4639 /* KeePassHTTPKitTests.m */; }; 16 | 4CDE59201BF9E2D700C7AF5B /* NSData+Cryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE59021BF9E2D600C7AF5B /* NSData+Cryptor.h */; }; 17 | 4CDE59211BF9E2D700C7AF5B /* NSData+Cryptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE59031BF9E2D600C7AF5B /* NSData+Cryptor.m */; }; 18 | 4CDE59221BF9E2D700C7AF5B /* KPHAssociateHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE59051BF9E2D600C7AF5B /* KPHAssociateHandler.h */; }; 19 | 4CDE59231BF9E2D700C7AF5B /* KPHAssociateHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE59061BF9E2D600C7AF5B /* KPHAssociateHandler.m */; }; 20 | 4CDE59241BF9E2D700C7AF5B /* KPHGeneratePasswordHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE59071BF9E2D600C7AF5B /* KPHGeneratePasswordHandler.h */; }; 21 | 4CDE59251BF9E2D700C7AF5B /* KPHGeneratePasswordHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE59081BF9E2D600C7AF5B /* KPHGeneratePasswordHandler.m */; }; 22 | 4CDE59261BF9E2D700C7AF5B /* KPHGetAllLoginsHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE59091BF9E2D700C7AF5B /* KPHGetAllLoginsHandler.h */; }; 23 | 4CDE59271BF9E2D700C7AF5B /* KPHGetAllLoginsHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE590A1BF9E2D700C7AF5B /* KPHGetAllLoginsHandler.m */; }; 24 | 4CDE59281BF9E2D700C7AF5B /* KPHGetLoginsCountHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE590B1BF9E2D700C7AF5B /* KPHGetLoginsCountHandler.h */; }; 25 | 4CDE59291BF9E2D700C7AF5B /* KPHGetLoginsCountHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE590C1BF9E2D700C7AF5B /* KPHGetLoginsCountHandler.m */; }; 26 | 4CDE592A1BF9E2D700C7AF5B /* KPHGetLoginsHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE590D1BF9E2D700C7AF5B /* KPHGetLoginsHandler.h */; }; 27 | 4CDE592B1BF9E2D700C7AF5B /* KPHGetLoginsHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE590E1BF9E2D700C7AF5B /* KPHGetLoginsHandler.m */; }; 28 | 4CDE592C1BF9E2D700C7AF5B /* KPHHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE590F1BF9E2D700C7AF5B /* KPHHandler.h */; }; 29 | 4CDE592D1BF9E2D700C7AF5B /* KPHHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE59101BF9E2D700C7AF5B /* KPHHandler.m */; }; 30 | 4CDE592E1BF9E2D700C7AF5B /* KPHSetLoginHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE59111BF9E2D700C7AF5B /* KPHSetLoginHandler.h */; }; 31 | 4CDE592F1BF9E2D700C7AF5B /* KPHSetLoginHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE59121BF9E2D700C7AF5B /* KPHSetLoginHandler.m */; }; 32 | 4CDE59301BF9E2D700C7AF5B /* KPHTestAssociateHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE59131BF9E2D700C7AF5B /* KPHTestAssociateHandler.h */; }; 33 | 4CDE59311BF9E2D700C7AF5B /* KPHTestAssociateHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE59141BF9E2D700C7AF5B /* KPHTestAssociateHandler.m */; }; 34 | 4CDE59321BF9E2D700C7AF5B /* KPHAESConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE59151BF9E2D700C7AF5B /* KPHAESConfig.h */; }; 35 | 4CDE59331BF9E2D700C7AF5B /* KPHAESConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE59161BF9E2D700C7AF5B /* KPHAESConfig.m */; }; 36 | 4CDE59341BF9E2D700C7AF5B /* KPHDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE59171BF9E2D700C7AF5B /* KPHDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 37 | 4CDE59351BF9E2D700C7AF5B /* KPHRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE59181BF9E2D700C7AF5B /* KPHRequest.h */; }; 38 | 4CDE59361BF9E2D700C7AF5B /* KPHRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE59191BF9E2D700C7AF5B /* KPHRequest.m */; }; 39 | 4CDE59371BF9E2D700C7AF5B /* KPHResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE591A1BF9E2D700C7AF5B /* KPHResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; 40 | 4CDE59381BF9E2D700C7AF5B /* KPHResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE591B1BF9E2D700C7AF5B /* KPHResponse.m */; }; 41 | 4CDE59391BF9E2D700C7AF5B /* KPHServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE591C1BF9E2D700C7AF5B /* KPHServer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 42 | 4CDE593A1BF9E2D700C7AF5B /* KPHServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE591D1BF9E2D700C7AF5B /* KPHServer.m */; }; 43 | 4CDE593B1BF9E2D700C7AF5B /* KPHUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CDE591E1BF9E2D700C7AF5B /* KPHUtils.h */; }; 44 | 4CDE593C1BF9E2D700C7AF5B /* KPHUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE591F1BF9E2D700C7AF5B /* KPHUtils.m */; }; 45 | 4CDE593E1BF9E87200C7AF5B /* GCDWebServers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CDE593D1BF9E87200C7AF5B /* GCDWebServers.framework */; }; 46 | /* End PBXBuildFile section */ 47 | 48 | /* Begin PBXContainerItemProxy section */ 49 | 4CCAC39A1BF9C30300EA4639 /* PBXContainerItemProxy */ = { 50 | isa = PBXContainerItemProxy; 51 | containerPortal = 4CCAC3851BF9C30300EA4639 /* Project object */; 52 | proxyType = 1; 53 | remoteGlobalIDString = 4CCAC38D1BF9C30300EA4639; 54 | remoteInfo = KeePassHTTPKit; 55 | }; 56 | /* End PBXContainerItemProxy section */ 57 | 58 | /* Begin PBXCopyFilesBuildPhase section */ 59 | 4C0A25121BFA6794007DFDBA /* CopyFiles */ = { 60 | isa = PBXCopyFilesBuildPhase; 61 | buildActionMask = 2147483647; 62 | dstPath = ""; 63 | dstSubfolderSpec = 10; 64 | files = ( 65 | 4C0A25131BFA679D007DFDBA /* GCDWebServers.framework in CopyFiles */, 66 | 4C7A19B21F8CBEDD00C4D20B /* JSONModel.framework in CopyFiles */, 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXCopyFilesBuildPhase section */ 71 | 72 | /* Begin PBXFileReference section */ 73 | 4C4E1DB21EF0467000128BA9 /* JSONModel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JSONModel.framework; path = Carthage/Build/Mac/JSONModel.framework; sourceTree = ""; }; 74 | 4CCAC38E1BF9C30300EA4639 /* KeePassHTTPKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = KeePassHTTPKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 75 | 4CCAC3911BF9C30300EA4639 /* KeePassHTTPKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeePassHTTPKit.h; sourceTree = ""; }; 76 | 4CCAC3931BF9C30300EA4639 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 77 | 4CCAC3981BF9C30300EA4639 /* KeePassHTTPKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KeePassHTTPKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 78 | 4CCAC39D1BF9C30300EA4639 /* KeePassHTTPKitTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KeePassHTTPKitTests.m; sourceTree = ""; }; 79 | 4CCAC39F1BF9C30300EA4639 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 80 | 4CDE59021BF9E2D600C7AF5B /* NSData+Cryptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Cryptor.h"; sourceTree = ""; }; 81 | 4CDE59031BF9E2D600C7AF5B /* NSData+Cryptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Cryptor.m"; sourceTree = ""; }; 82 | 4CDE59051BF9E2D600C7AF5B /* KPHAssociateHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHAssociateHandler.h; sourceTree = ""; }; 83 | 4CDE59061BF9E2D600C7AF5B /* KPHAssociateHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPHAssociateHandler.m; sourceTree = ""; }; 84 | 4CDE59071BF9E2D600C7AF5B /* KPHGeneratePasswordHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHGeneratePasswordHandler.h; sourceTree = ""; }; 85 | 4CDE59081BF9E2D600C7AF5B /* KPHGeneratePasswordHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPHGeneratePasswordHandler.m; sourceTree = ""; }; 86 | 4CDE59091BF9E2D700C7AF5B /* KPHGetAllLoginsHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHGetAllLoginsHandler.h; sourceTree = ""; }; 87 | 4CDE590A1BF9E2D700C7AF5B /* KPHGetAllLoginsHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPHGetAllLoginsHandler.m; sourceTree = ""; }; 88 | 4CDE590B1BF9E2D700C7AF5B /* KPHGetLoginsCountHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHGetLoginsCountHandler.h; sourceTree = ""; }; 89 | 4CDE590C1BF9E2D700C7AF5B /* KPHGetLoginsCountHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPHGetLoginsCountHandler.m; sourceTree = ""; }; 90 | 4CDE590D1BF9E2D700C7AF5B /* KPHGetLoginsHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHGetLoginsHandler.h; sourceTree = ""; }; 91 | 4CDE590E1BF9E2D700C7AF5B /* KPHGetLoginsHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPHGetLoginsHandler.m; sourceTree = ""; }; 92 | 4CDE590F1BF9E2D700C7AF5B /* KPHHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHHandler.h; sourceTree = ""; }; 93 | 4CDE59101BF9E2D700C7AF5B /* KPHHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPHHandler.m; sourceTree = ""; }; 94 | 4CDE59111BF9E2D700C7AF5B /* KPHSetLoginHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHSetLoginHandler.h; sourceTree = ""; }; 95 | 4CDE59121BF9E2D700C7AF5B /* KPHSetLoginHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPHSetLoginHandler.m; sourceTree = ""; }; 96 | 4CDE59131BF9E2D700C7AF5B /* KPHTestAssociateHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHTestAssociateHandler.h; sourceTree = ""; }; 97 | 4CDE59141BF9E2D700C7AF5B /* KPHTestAssociateHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPHTestAssociateHandler.m; sourceTree = ""; }; 98 | 4CDE59151BF9E2D700C7AF5B /* KPHAESConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHAESConfig.h; sourceTree = ""; }; 99 | 4CDE59161BF9E2D700C7AF5B /* KPHAESConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPHAESConfig.m; sourceTree = ""; }; 100 | 4CDE59171BF9E2D700C7AF5B /* KPHDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHDelegate.h; sourceTree = ""; }; 101 | 4CDE59181BF9E2D700C7AF5B /* KPHRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHRequest.h; sourceTree = ""; }; 102 | 4CDE59191BF9E2D700C7AF5B /* KPHRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPHRequest.m; sourceTree = ""; }; 103 | 4CDE591A1BF9E2D700C7AF5B /* KPHResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHResponse.h; sourceTree = ""; }; 104 | 4CDE591B1BF9E2D700C7AF5B /* KPHResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPHResponse.m; sourceTree = ""; }; 105 | 4CDE591C1BF9E2D700C7AF5B /* KPHServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHServer.h; sourceTree = ""; }; 106 | 4CDE591D1BF9E2D700C7AF5B /* KPHServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPHServer.m; sourceTree = ""; }; 107 | 4CDE591E1BF9E2D700C7AF5B /* KPHUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPHUtils.h; sourceTree = ""; }; 108 | 4CDE591F1BF9E2D700C7AF5B /* KPHUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPHUtils.m; sourceTree = ""; }; 109 | 4CDE593D1BF9E87200C7AF5B /* GCDWebServers.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GCDWebServers.framework; path = Carthage/Build/Mac/GCDWebServers.framework; sourceTree = ""; }; 110 | /* End PBXFileReference section */ 111 | 112 | /* Begin PBXFrameworksBuildPhase section */ 113 | 4CCAC38A1BF9C30300EA4639 /* Frameworks */ = { 114 | isa = PBXFrameworksBuildPhase; 115 | buildActionMask = 2147483647; 116 | files = ( 117 | 4C4E1DB31EF0467000128BA9 /* JSONModel.framework in Frameworks */, 118 | 4CDE593E1BF9E87200C7AF5B /* GCDWebServers.framework in Frameworks */, 119 | ); 120 | runOnlyForDeploymentPostprocessing = 0; 121 | }; 122 | 4CCAC3951BF9C30300EA4639 /* Frameworks */ = { 123 | isa = PBXFrameworksBuildPhase; 124 | buildActionMask = 2147483647; 125 | files = ( 126 | 4CCAC3991BF9C30300EA4639 /* KeePassHTTPKit.framework in Frameworks */, 127 | ); 128 | runOnlyForDeploymentPostprocessing = 0; 129 | }; 130 | /* End PBXFrameworksBuildPhase section */ 131 | 132 | /* Begin PBXGroup section */ 133 | 4CCAC3841BF9C30300EA4639 = { 134 | isa = PBXGroup; 135 | children = ( 136 | 4C4E1DB21EF0467000128BA9 /* JSONModel.framework */, 137 | 4CDE593D1BF9E87200C7AF5B /* GCDWebServers.framework */, 138 | 4CCAC3901BF9C30300EA4639 /* KeePassHTTPKit */, 139 | 4CCAC39C1BF9C30300EA4639 /* KeePassHTTPKitTests */, 140 | 4CCAC38F1BF9C30300EA4639 /* Products */, 141 | ); 142 | sourceTree = ""; 143 | }; 144 | 4CCAC38F1BF9C30300EA4639 /* Products */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 4CCAC38E1BF9C30300EA4639 /* KeePassHTTPKit.framework */, 148 | 4CCAC3981BF9C30300EA4639 /* KeePassHTTPKitTests.xctest */, 149 | ); 150 | name = Products; 151 | sourceTree = ""; 152 | }; 153 | 4CCAC3901BF9C30300EA4639 /* KeePassHTTPKit */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 4CDE59011BF9E2D600C7AF5B /* Categories */, 157 | 4CDE59041BF9E2D600C7AF5B /* Handlers */, 158 | 4CDE59151BF9E2D700C7AF5B /* KPHAESConfig.h */, 159 | 4CDE59161BF9E2D700C7AF5B /* KPHAESConfig.m */, 160 | 4CDE59171BF9E2D700C7AF5B /* KPHDelegate.h */, 161 | 4CDE59181BF9E2D700C7AF5B /* KPHRequest.h */, 162 | 4CDE59191BF9E2D700C7AF5B /* KPHRequest.m */, 163 | 4CDE591A1BF9E2D700C7AF5B /* KPHResponse.h */, 164 | 4CDE591B1BF9E2D700C7AF5B /* KPHResponse.m */, 165 | 4CDE591C1BF9E2D700C7AF5B /* KPHServer.h */, 166 | 4CDE591D1BF9E2D700C7AF5B /* KPHServer.m */, 167 | 4CDE591E1BF9E2D700C7AF5B /* KPHUtils.h */, 168 | 4CDE591F1BF9E2D700C7AF5B /* KPHUtils.m */, 169 | 4CCAC3911BF9C30300EA4639 /* KeePassHTTPKit.h */, 170 | 4CCAC3931BF9C30300EA4639 /* Info.plist */, 171 | ); 172 | path = KeePassHTTPKit; 173 | sourceTree = ""; 174 | }; 175 | 4CCAC39C1BF9C30300EA4639 /* KeePassHTTPKitTests */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | 4CCAC39D1BF9C30300EA4639 /* KeePassHTTPKitTests.m */, 179 | 4CCAC39F1BF9C30300EA4639 /* Info.plist */, 180 | ); 181 | path = KeePassHTTPKitTests; 182 | sourceTree = ""; 183 | }; 184 | 4CDE59011BF9E2D600C7AF5B /* Categories */ = { 185 | isa = PBXGroup; 186 | children = ( 187 | 4CDE59021BF9E2D600C7AF5B /* NSData+Cryptor.h */, 188 | 4CDE59031BF9E2D600C7AF5B /* NSData+Cryptor.m */, 189 | ); 190 | path = Categories; 191 | sourceTree = ""; 192 | }; 193 | 4CDE59041BF9E2D600C7AF5B /* Handlers */ = { 194 | isa = PBXGroup; 195 | children = ( 196 | 4CDE59051BF9E2D600C7AF5B /* KPHAssociateHandler.h */, 197 | 4CDE59061BF9E2D600C7AF5B /* KPHAssociateHandler.m */, 198 | 4CDE59071BF9E2D600C7AF5B /* KPHGeneratePasswordHandler.h */, 199 | 4CDE59081BF9E2D600C7AF5B /* KPHGeneratePasswordHandler.m */, 200 | 4CDE59091BF9E2D700C7AF5B /* KPHGetAllLoginsHandler.h */, 201 | 4CDE590A1BF9E2D700C7AF5B /* KPHGetAllLoginsHandler.m */, 202 | 4CDE590B1BF9E2D700C7AF5B /* KPHGetLoginsCountHandler.h */, 203 | 4CDE590C1BF9E2D700C7AF5B /* KPHGetLoginsCountHandler.m */, 204 | 4CDE590D1BF9E2D700C7AF5B /* KPHGetLoginsHandler.h */, 205 | 4CDE590E1BF9E2D700C7AF5B /* KPHGetLoginsHandler.m */, 206 | 4CDE590F1BF9E2D700C7AF5B /* KPHHandler.h */, 207 | 4CDE59101BF9E2D700C7AF5B /* KPHHandler.m */, 208 | 4CDE59111BF9E2D700C7AF5B /* KPHSetLoginHandler.h */, 209 | 4CDE59121BF9E2D700C7AF5B /* KPHSetLoginHandler.m */, 210 | 4CDE59131BF9E2D700C7AF5B /* KPHTestAssociateHandler.h */, 211 | 4CDE59141BF9E2D700C7AF5B /* KPHTestAssociateHandler.m */, 212 | ); 213 | path = Handlers; 214 | sourceTree = ""; 215 | }; 216 | /* End PBXGroup section */ 217 | 218 | /* Begin PBXHeadersBuildPhase section */ 219 | 4CCAC38B1BF9C30300EA4639 /* Headers */ = { 220 | isa = PBXHeadersBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | 4CDE59341BF9E2D700C7AF5B /* KPHDelegate.h in Headers */, 224 | 4CDE59371BF9E2D700C7AF5B /* KPHResponse.h in Headers */, 225 | 4CDE59391BF9E2D700C7AF5B /* KPHServer.h in Headers */, 226 | 4CDE593B1BF9E2D700C7AF5B /* KPHUtils.h in Headers */, 227 | 4CDE59241BF9E2D700C7AF5B /* KPHGeneratePasswordHandler.h in Headers */, 228 | 4CDE59261BF9E2D700C7AF5B /* KPHGetAllLoginsHandler.h in Headers */, 229 | 4CDE592C1BF9E2D700C7AF5B /* KPHHandler.h in Headers */, 230 | 4CDE59281BF9E2D700C7AF5B /* KPHGetLoginsCountHandler.h in Headers */, 231 | 4CDE59321BF9E2D700C7AF5B /* KPHAESConfig.h in Headers */, 232 | 4CDE59221BF9E2D700C7AF5B /* KPHAssociateHandler.h in Headers */, 233 | 4CDE592A1BF9E2D700C7AF5B /* KPHGetLoginsHandler.h in Headers */, 234 | 4CCAC3921BF9C30300EA4639 /* KeePassHTTPKit.h in Headers */, 235 | 4CDE592E1BF9E2D700C7AF5B /* KPHSetLoginHandler.h in Headers */, 236 | 4CDE59201BF9E2D700C7AF5B /* NSData+Cryptor.h in Headers */, 237 | 4CDE59351BF9E2D700C7AF5B /* KPHRequest.h in Headers */, 238 | 4CDE59301BF9E2D700C7AF5B /* KPHTestAssociateHandler.h in Headers */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | /* End PBXHeadersBuildPhase section */ 243 | 244 | /* Begin PBXNativeTarget section */ 245 | 4CCAC38D1BF9C30300EA4639 /* KeePassHTTPKit */ = { 246 | isa = PBXNativeTarget; 247 | buildConfigurationList = 4CCAC3A21BF9C30300EA4639 /* Build configuration list for PBXNativeTarget "KeePassHTTPKit" */; 248 | buildPhases = ( 249 | 4CCAC3891BF9C30300EA4639 /* Sources */, 250 | 4CCAC38A1BF9C30300EA4639 /* Frameworks */, 251 | 4CCAC38B1BF9C30300EA4639 /* Headers */, 252 | 4CCAC38C1BF9C30300EA4639 /* Resources */, 253 | 4CFBACF21C122932005D9606 /* Versioning */, 254 | 4C0A25121BFA6794007DFDBA /* CopyFiles */, 255 | ); 256 | buildRules = ( 257 | ); 258 | dependencies = ( 259 | ); 260 | name = KeePassHTTPKit; 261 | productName = KeePassHTTPKit; 262 | productReference = 4CCAC38E1BF9C30300EA4639 /* KeePassHTTPKit.framework */; 263 | productType = "com.apple.product-type.framework"; 264 | }; 265 | 4CCAC3971BF9C30300EA4639 /* KeePassHTTPKitTests */ = { 266 | isa = PBXNativeTarget; 267 | buildConfigurationList = 4CCAC3A51BF9C30300EA4639 /* Build configuration list for PBXNativeTarget "KeePassHTTPKitTests" */; 268 | buildPhases = ( 269 | 4CCAC3941BF9C30300EA4639 /* Sources */, 270 | 4CCAC3951BF9C30300EA4639 /* Frameworks */, 271 | 4CCAC3961BF9C30300EA4639 /* Resources */, 272 | ); 273 | buildRules = ( 274 | ); 275 | dependencies = ( 276 | 4CCAC39B1BF9C30300EA4639 /* PBXTargetDependency */, 277 | ); 278 | name = KeePassHTTPKitTests; 279 | productName = KeePassHTTPKitTests; 280 | productReference = 4CCAC3981BF9C30300EA4639 /* KeePassHTTPKitTests.xctest */; 281 | productType = "com.apple.product-type.bundle.unit-test"; 282 | }; 283 | /* End PBXNativeTarget section */ 284 | 285 | /* Begin PBXProject section */ 286 | 4CCAC3851BF9C30300EA4639 /* Project object */ = { 287 | isa = PBXProject; 288 | attributes = { 289 | LastUpgradeCheck = 1310; 290 | ORGANIZATIONNAME = "HicknHack Software GmbH"; 291 | TargetAttributes = { 292 | 4CCAC38D1BF9C30300EA4639 = { 293 | CreatedOnToolsVersion = 7.1.1; 294 | }; 295 | 4CCAC3971BF9C30300EA4639 = { 296 | CreatedOnToolsVersion = 7.1.1; 297 | }; 298 | }; 299 | }; 300 | buildConfigurationList = 4CCAC3881BF9C30300EA4639 /* Build configuration list for PBXProject "KeePassHTTPKit" */; 301 | compatibilityVersion = "Xcode 3.2"; 302 | developmentRegion = en; 303 | hasScannedForEncodings = 0; 304 | knownRegions = ( 305 | en, 306 | Base, 307 | ); 308 | mainGroup = 4CCAC3841BF9C30300EA4639; 309 | productRefGroup = 4CCAC38F1BF9C30300EA4639 /* Products */; 310 | projectDirPath = ""; 311 | projectRoot = ""; 312 | targets = ( 313 | 4CCAC38D1BF9C30300EA4639 /* KeePassHTTPKit */, 314 | 4CCAC3971BF9C30300EA4639 /* KeePassHTTPKitTests */, 315 | ); 316 | }; 317 | /* End PBXProject section */ 318 | 319 | /* Begin PBXResourcesBuildPhase section */ 320 | 4CCAC38C1BF9C30300EA4639 /* Resources */ = { 321 | isa = PBXResourcesBuildPhase; 322 | buildActionMask = 2147483647; 323 | files = ( 324 | ); 325 | runOnlyForDeploymentPostprocessing = 0; 326 | }; 327 | 4CCAC3961BF9C30300EA4639 /* Resources */ = { 328 | isa = PBXResourcesBuildPhase; 329 | buildActionMask = 2147483647; 330 | files = ( 331 | ); 332 | runOnlyForDeploymentPostprocessing = 0; 333 | }; 334 | /* End PBXResourcesBuildPhase section */ 335 | 336 | /* Begin PBXShellScriptBuildPhase section */ 337 | 4CFBACF21C122932005D9606 /* Versioning */ = { 338 | isa = PBXShellScriptBuildPhase; 339 | buildActionMask = 2147483647; 340 | files = ( 341 | ); 342 | inputPaths = ( 343 | ); 344 | name = Versioning; 345 | outputPaths = ( 346 | ); 347 | runOnlyForDeploymentPostprocessing = 0; 348 | shellPath = /bin/sh; 349 | shellScript = "git=`sh /etc/profile; which git`\nbranch_name=`$git symbolic-ref HEAD | sed -e 's,.*/\\\\(.*\\\\),\\\\1,'`\ngit_count=`$git rev-list $branch_name |wc -l | sed 's/^ *//;s/ *$//'`\nsimple_branch_name=`$git rev-parse --abbrev-ref HEAD`\n\nbuild_number=\"${git_count}\"\nif [ $CONFIGURATION != \"Release\" ]; then\nbuild_number+=\"-$simple_branch_name\"\nfi\n\nplist=\"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}\"\ndsym_plist=\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist\"\n\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $build_number\" \"$plist\"\nif [ -f \"$DSYM_INFO_PLIST\" ] ; then\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $build_number\" \"$dsym_plist\"\nfi"; 350 | showEnvVarsInLog = 0; 351 | }; 352 | /* End PBXShellScriptBuildPhase section */ 353 | 354 | /* Begin PBXSourcesBuildPhase section */ 355 | 4CCAC3891BF9C30300EA4639 /* Sources */ = { 356 | isa = PBXSourcesBuildPhase; 357 | buildActionMask = 2147483647; 358 | files = ( 359 | 4CDE59381BF9E2D700C7AF5B /* KPHResponse.m in Sources */, 360 | 4CDE592D1BF9E2D700C7AF5B /* KPHHandler.m in Sources */, 361 | 4CDE59251BF9E2D700C7AF5B /* KPHGeneratePasswordHandler.m in Sources */, 362 | 4CDE59231BF9E2D700C7AF5B /* KPHAssociateHandler.m in Sources */, 363 | 4CDE593C1BF9E2D700C7AF5B /* KPHUtils.m in Sources */, 364 | 4CDE59361BF9E2D700C7AF5B /* KPHRequest.m in Sources */, 365 | 4CDE59291BF9E2D700C7AF5B /* KPHGetLoginsCountHandler.m in Sources */, 366 | 4CDE59271BF9E2D700C7AF5B /* KPHGetAllLoginsHandler.m in Sources */, 367 | 4CDE593A1BF9E2D700C7AF5B /* KPHServer.m in Sources */, 368 | 4CDE592F1BF9E2D700C7AF5B /* KPHSetLoginHandler.m in Sources */, 369 | 4CDE59211BF9E2D700C7AF5B /* NSData+Cryptor.m in Sources */, 370 | 4CDE592B1BF9E2D700C7AF5B /* KPHGetLoginsHandler.m in Sources */, 371 | 4CDE59311BF9E2D700C7AF5B /* KPHTestAssociateHandler.m in Sources */, 372 | 4CDE59331BF9E2D700C7AF5B /* KPHAESConfig.m in Sources */, 373 | ); 374 | runOnlyForDeploymentPostprocessing = 0; 375 | }; 376 | 4CCAC3941BF9C30300EA4639 /* Sources */ = { 377 | isa = PBXSourcesBuildPhase; 378 | buildActionMask = 2147483647; 379 | files = ( 380 | 4CCAC39E1BF9C30300EA4639 /* KeePassHTTPKitTests.m in Sources */, 381 | ); 382 | runOnlyForDeploymentPostprocessing = 0; 383 | }; 384 | /* End PBXSourcesBuildPhase section */ 385 | 386 | /* Begin PBXTargetDependency section */ 387 | 4CCAC39B1BF9C30300EA4639 /* PBXTargetDependency */ = { 388 | isa = PBXTargetDependency; 389 | target = 4CCAC38D1BF9C30300EA4639 /* KeePassHTTPKit */; 390 | targetProxy = 4CCAC39A1BF9C30300EA4639 /* PBXContainerItemProxy */; 391 | }; 392 | /* End PBXTargetDependency section */ 393 | 394 | /* Begin XCBuildConfiguration section */ 395 | 4CCAC3A01BF9C30300EA4639 /* Debug */ = { 396 | isa = XCBuildConfiguration; 397 | buildSettings = { 398 | ALWAYS_SEARCH_USER_PATHS = NO; 399 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 400 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 401 | CLANG_CXX_LIBRARY = "libc++"; 402 | CLANG_ENABLE_MODULES = YES; 403 | CLANG_ENABLE_OBJC_ARC = YES; 404 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 405 | CLANG_WARN_BOOL_CONVERSION = YES; 406 | CLANG_WARN_COMMA = YES; 407 | CLANG_WARN_CONSTANT_CONVERSION = YES; 408 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 409 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 410 | CLANG_WARN_EMPTY_BODY = YES; 411 | CLANG_WARN_ENUM_CONVERSION = YES; 412 | CLANG_WARN_INFINITE_RECURSION = YES; 413 | CLANG_WARN_INT_CONVERSION = YES; 414 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 415 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 416 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 417 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 418 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; 419 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 420 | CLANG_WARN_STRICT_PROTOTYPES = YES; 421 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 422 | CLANG_WARN_UNREACHABLE_CODE = YES; 423 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 424 | CODE_SIGN_IDENTITY = ""; 425 | COPY_PHASE_STRIP = NO; 426 | CURRENT_PROJECT_VERSION = 1; 427 | DEBUG_INFORMATION_FORMAT = dwarf; 428 | ENABLE_STRICT_OBJC_MSGSEND = YES; 429 | ENABLE_TESTABILITY = YES; 430 | GCC_C_LANGUAGE_STANDARD = gnu99; 431 | GCC_DYNAMIC_NO_PIC = NO; 432 | GCC_NO_COMMON_BLOCKS = YES; 433 | GCC_OPTIMIZATION_LEVEL = 0; 434 | GCC_PREPROCESSOR_DEFINITIONS = ( 435 | "DEBUG=1", 436 | "$(inherited)", 437 | ); 438 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 439 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 440 | GCC_WARN_UNDECLARED_SELECTOR = YES; 441 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 442 | GCC_WARN_UNUSED_FUNCTION = YES; 443 | GCC_WARN_UNUSED_VARIABLE = YES; 444 | MACOSX_DEPLOYMENT_TARGET = 10.13; 445 | MTL_ENABLE_DEBUG_INFO = YES; 446 | ONLY_ACTIVE_ARCH = YES; 447 | SDKROOT = macosx; 448 | VERSIONING_SYSTEM = "apple-generic"; 449 | VERSION_INFO_PREFIX = ""; 450 | WARNING_CFLAGS = "-Wpartial-availability"; 451 | }; 452 | name = Debug; 453 | }; 454 | 4CCAC3A11BF9C30300EA4639 /* Release */ = { 455 | isa = XCBuildConfiguration; 456 | buildSettings = { 457 | ALWAYS_SEARCH_USER_PATHS = NO; 458 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 459 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 460 | CLANG_CXX_LIBRARY = "libc++"; 461 | CLANG_ENABLE_MODULES = YES; 462 | CLANG_ENABLE_OBJC_ARC = YES; 463 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 464 | CLANG_WARN_BOOL_CONVERSION = YES; 465 | CLANG_WARN_COMMA = YES; 466 | CLANG_WARN_CONSTANT_CONVERSION = YES; 467 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 468 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 469 | CLANG_WARN_EMPTY_BODY = YES; 470 | CLANG_WARN_ENUM_CONVERSION = YES; 471 | CLANG_WARN_INFINITE_RECURSION = YES; 472 | CLANG_WARN_INT_CONVERSION = YES; 473 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 474 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 475 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 476 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 477 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO; 478 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 479 | CLANG_WARN_STRICT_PROTOTYPES = YES; 480 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 481 | CLANG_WARN_UNREACHABLE_CODE = YES; 482 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 483 | CODE_SIGN_IDENTITY = ""; 484 | COPY_PHASE_STRIP = NO; 485 | CURRENT_PROJECT_VERSION = 1; 486 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 487 | ENABLE_NS_ASSERTIONS = NO; 488 | ENABLE_STRICT_OBJC_MSGSEND = YES; 489 | GCC_C_LANGUAGE_STANDARD = gnu99; 490 | GCC_NO_COMMON_BLOCKS = YES; 491 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 492 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 493 | GCC_WARN_UNDECLARED_SELECTOR = YES; 494 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 495 | GCC_WARN_UNUSED_FUNCTION = YES; 496 | GCC_WARN_UNUSED_VARIABLE = YES; 497 | MACOSX_DEPLOYMENT_TARGET = 10.13; 498 | MTL_ENABLE_DEBUG_INFO = NO; 499 | SDKROOT = macosx; 500 | VERSIONING_SYSTEM = "apple-generic"; 501 | VERSION_INFO_PREFIX = ""; 502 | WARNING_CFLAGS = "-Wpartial-availability"; 503 | }; 504 | name = Release; 505 | }; 506 | 4CCAC3A31BF9C30300EA4639 /* Debug */ = { 507 | isa = XCBuildConfiguration; 508 | buildSettings = { 509 | CODE_SIGN_IDENTITY = ""; 510 | COMBINE_HIDPI_IMAGES = YES; 511 | CURRENT_PROJECT_VERSION = 1.3.1; 512 | DEFINES_MODULE = YES; 513 | DYLIB_COMPATIBILITY_VERSION = 1; 514 | DYLIB_CURRENT_VERSION = "$(CURRENT_PROJECT_VERSION)"; 515 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 516 | FRAMEWORK_SEARCH_PATHS = ( 517 | "$(inherited)", 518 | "$(PROJECT_DIR)/Carthage/Build/Mac", 519 | ); 520 | FRAMEWORK_VERSION = A; 521 | INFOPLIST_FILE = KeePassHTTPKit/Info.plist; 522 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 523 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; 524 | MACOSX_DEPLOYMENT_TARGET = 10.13; 525 | PRODUCT_BUNDLE_IDENTIFIER = com.hicknhacksoftware.KeePassHTTPKit; 526 | PRODUCT_NAME = "$(TARGET_NAME)"; 527 | SKIP_INSTALL = YES; 528 | VERSIONING_SYSTEM = ""; 529 | }; 530 | name = Debug; 531 | }; 532 | 4CCAC3A41BF9C30300EA4639 /* Release */ = { 533 | isa = XCBuildConfiguration; 534 | buildSettings = { 535 | CODE_SIGN_IDENTITY = ""; 536 | COMBINE_HIDPI_IMAGES = YES; 537 | CURRENT_PROJECT_VERSION = 1.3.1; 538 | DEFINES_MODULE = YES; 539 | DYLIB_COMPATIBILITY_VERSION = 1; 540 | DYLIB_CURRENT_VERSION = "$(CURRENT_PROJECT_VERSION)"; 541 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 542 | FRAMEWORK_SEARCH_PATHS = ( 543 | "$(inherited)", 544 | "$(PROJECT_DIR)/Carthage/Build/Mac", 545 | ); 546 | FRAMEWORK_VERSION = A; 547 | INFOPLIST_FILE = KeePassHTTPKit/Info.plist; 548 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 549 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; 550 | MACOSX_DEPLOYMENT_TARGET = 10.13; 551 | PRODUCT_BUNDLE_IDENTIFIER = com.hicknhacksoftware.KeePassHTTPKit; 552 | PRODUCT_NAME = "$(TARGET_NAME)"; 553 | SKIP_INSTALL = YES; 554 | VERSIONING_SYSTEM = ""; 555 | }; 556 | name = Release; 557 | }; 558 | 4CCAC3A61BF9C30300EA4639 /* Debug */ = { 559 | isa = XCBuildConfiguration; 560 | buildSettings = { 561 | COMBINE_HIDPI_IMAGES = YES; 562 | INFOPLIST_FILE = KeePassHTTPKitTests/Info.plist; 563 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 564 | PRODUCT_BUNDLE_IDENTIFIER = com.hicknhacksoftware.KeePassHTTPKitTests; 565 | PRODUCT_NAME = "$(TARGET_NAME)"; 566 | }; 567 | name = Debug; 568 | }; 569 | 4CCAC3A71BF9C30300EA4639 /* Release */ = { 570 | isa = XCBuildConfiguration; 571 | buildSettings = { 572 | COMBINE_HIDPI_IMAGES = YES; 573 | INFOPLIST_FILE = KeePassHTTPKitTests/Info.plist; 574 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 575 | PRODUCT_BUNDLE_IDENTIFIER = com.hicknhacksoftware.KeePassHTTPKitTests; 576 | PRODUCT_NAME = "$(TARGET_NAME)"; 577 | }; 578 | name = Release; 579 | }; 580 | /* End XCBuildConfiguration section */ 581 | 582 | /* Begin XCConfigurationList section */ 583 | 4CCAC3881BF9C30300EA4639 /* Build configuration list for PBXProject "KeePassHTTPKit" */ = { 584 | isa = XCConfigurationList; 585 | buildConfigurations = ( 586 | 4CCAC3A01BF9C30300EA4639 /* Debug */, 587 | 4CCAC3A11BF9C30300EA4639 /* Release */, 588 | ); 589 | defaultConfigurationIsVisible = 0; 590 | defaultConfigurationName = Release; 591 | }; 592 | 4CCAC3A21BF9C30300EA4639 /* Build configuration list for PBXNativeTarget "KeePassHTTPKit" */ = { 593 | isa = XCConfigurationList; 594 | buildConfigurations = ( 595 | 4CCAC3A31BF9C30300EA4639 /* Debug */, 596 | 4CCAC3A41BF9C30300EA4639 /* Release */, 597 | ); 598 | defaultConfigurationIsVisible = 0; 599 | defaultConfigurationName = Release; 600 | }; 601 | 4CCAC3A51BF9C30300EA4639 /* Build configuration list for PBXNativeTarget "KeePassHTTPKitTests" */ = { 602 | isa = XCConfigurationList; 603 | buildConfigurations = ( 604 | 4CCAC3A61BF9C30300EA4639 /* Debug */, 605 | 4CCAC3A71BF9C30300EA4639 /* Release */, 606 | ); 607 | defaultConfigurationIsVisible = 0; 608 | defaultConfigurationName = Release; 609 | }; 610 | /* End XCConfigurationList section */ 611 | }; 612 | rootObject = 4CCAC3851BF9C30300EA4639 /* Project object */; 613 | } 614 | -------------------------------------------------------------------------------- /KeePassHTTPKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /KeePassHTTPKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /KeePassHTTPKit.xcodeproj/xcshareddata/xcschemes/KeePassHTTPKit.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 42 | 48 | 49 | 50 | 51 | 52 | 62 | 63 | 69 | 70 | 71 | 72 | 78 | 79 | 85 | 86 | 87 | 88 | 90 | 91 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /KeePassHTTPKit.xcodeproj/xcuserdata/michael.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | KeePassHTTPKit.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4CCAC38D1BF9C30300EA4639 16 | 17 | primary 18 | 19 | 20 | 4CCAC3971BF9C30300EA4639 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Categories/NSData+Cryptor.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+Cryptor.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-21. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface NSData (Cryptor) 13 | 14 | - (NSData *)runCryptor:(CCCryptorRef)cryptor; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Categories/NSData+Cryptor.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+Cryptor.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-21. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "NSData+Cryptor.h" 10 | 11 | @implementation NSData (Cryptor) 12 | 13 | - (NSData *)runCryptor:(CCCryptorRef)cryptor 14 | { 15 | CCCryptorStatus status; 16 | 17 | size_t total_bytes = 0; 18 | size_t bytes_used = 0; 19 | size_t bufsize = CCCryptorGetOutputLength(cryptor, self.length, true); 20 | char *buf = malloc(bufsize); 21 | 22 | if (buf == NULL) 23 | return nil; 24 | 25 | NSData *output = nil; 26 | 27 | do { 28 | if ((status = CCCryptorUpdate(cryptor, self.bytes, self.length, buf, bufsize, &bytes_used)) != kCCSuccess) 29 | break; 30 | 31 | total_bytes += bytes_used; 32 | 33 | if ((status = CCCryptorFinal(cryptor, buf + bytes_used, bufsize - bytes_used, &bytes_used)) != kCCSuccess) 34 | break; 35 | 36 | total_bytes += bytes_used; 37 | 38 | output = [NSData dataWithBytes:buf length:total_bytes]; 39 | } while (0); 40 | 41 | free(buf); 42 | 43 | return output; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHAssociateHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHAssociateHandler.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-22. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHHandler.h" 10 | 11 | @interface KPHAssociateHandler : KPHHandler 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHAssociateHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // KPHAssociateHandler.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-22. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHAssociateHandler.h" 10 | 11 | @implementation KPHAssociateHandler 12 | 13 | - (void)handle:(KPHRequest *)request response:(KPHResponse *)response server:(KPHServer *)server { 14 | [super handle:request response:response server:server]; 15 | 16 | if(![self verifyRequest:request withKey:request.Key]) { 17 | return; 18 | } 19 | 20 | NSString *label = [self delegateLabelForKey:request.Key]; 21 | if(label) { 22 | response.Id = label; 23 | response.Success = YES; 24 | 25 | [self setResponseVerifier:response]; 26 | } 27 | 28 | return; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHGeneratePasswordHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHGeneratePasswordHandler.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-25. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHHandler.h" 10 | 11 | @interface KPHGeneratePasswordHandler : KPHHandler 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHGeneratePasswordHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // KPHGeneratePasswordHandler.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-25. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHGeneratePasswordHandler.h" 10 | 11 | @implementation KPHGeneratePasswordHandler 12 | 13 | - (void)handle:(KPHRequest *)request response:(KPHResponse *)response server:(KPHServer *)server { 14 | [super handle:request response:response server:server]; 15 | 16 | if(![self verifyRequest:request]) { 17 | return; 18 | } 19 | 20 | NSString *key = [self delegateKeyForLabel:request.Id]; 21 | if(!key) { 22 | return; 23 | } 24 | 25 | NSString *password = [self delegateGeneratePassword]; 26 | 27 | response.Id = request.Id; 28 | [self setResponseVerifier:response]; 29 | 30 | if(password) { 31 | KPHAESConfig *aes = [KPHAESConfig aesWithKey:key base64key:YES IV:response.Nonce base64IV:YES]; 32 | response.Entries = [KPHUtils encryptEntries:@[[KPHResponseEntry entryWithUrl:nil 33 | name:@"generate-password" 34 | login:@"" 35 | password:password 36 | uuid:@"generate-password" 37 | stringFields:nil]] withAES:aes]; 38 | response.Count = 1; 39 | response.Success = YES; 40 | } 41 | 42 | return; 43 | } 44 | 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHGetAllLoginsHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHGetAllLoginsHandler.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-25. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHHandler.h" 10 | 11 | @interface KPHGetAllLoginsHandler : KPHHandler 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHGetAllLoginsHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // KPHGetAllLoginsHandler.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-25. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHGetAllLoginsHandler.h" 10 | 11 | @implementation KPHGetAllLoginsHandler 12 | 13 | - (void)handle:(KPHRequest *)request response:(KPHResponse *)response server:(KPHServer *)server { 14 | [super handle:request response:response server:server]; 15 | 16 | if (![self verifyRequest:request]) { 17 | return; 18 | } 19 | 20 | NSString *key = [self delegateKeyForLabel:request.Id]; 21 | if (!key) { 22 | return; 23 | } 24 | 25 | KPHAESConfig *aes = [KPHAESConfig aesWithKey:key base64key:YES IV:request.Nonce base64IV:YES]; 26 | NSURL *url = [NSURL URLWithString:[KPHUtils decryptString:request.Url withAES:aes]]; 27 | if (!url) { 28 | return; 29 | } 30 | 31 | NSArray *entries = [self delegateAllEntries]; 32 | 33 | response.Id = request.Id; 34 | [self setResponseVerifier:response]; 35 | 36 | if (entries) { 37 | entries = [self copyEntries:entries]; 38 | 39 | /* these should not be provided in get-all-logins */ 40 | for (KPHResponseEntry *entry in entries) { 41 | entry.Password = nil; 42 | entry.StringFields = nil; 43 | } 44 | 45 | aes = [KPHAESConfig aesWithKey:key base64key:YES IV:response.Nonce base64IV:YES]; 46 | response.Entries = [KPHUtils encryptEntries:entries withAES:aes]; 47 | 48 | response.Count = response.Entries.count; 49 | response.Success = YES; 50 | } 51 | 52 | return; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHGetLoginsCountHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHGetLoginsCountHandler.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-25. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHHandler.h" 10 | 11 | @interface KPHGetLoginsCountHandler : KPHHandler 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHGetLoginsCountHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // KPHGetLoginsCountHandler.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-25. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHGetLoginsCountHandler.h" 10 | 11 | @implementation KPHGetLoginsCountHandler 12 | 13 | - (void)handle:(KPHRequest *)request response:(KPHResponse *)response server:(KPHServer *)server { 14 | [super handle:request response:response server:server]; 15 | 16 | if (![self verifyRequest:request]) { 17 | return; 18 | } 19 | 20 | NSString *key = [self delegateKeyForLabel:request.Id]; 21 | if (!key) { 22 | return; 23 | } 24 | 25 | KPHAESConfig *aes = [KPHAESConfig aesWithKey:key base64key:YES IV:request.Nonce base64IV:YES]; 26 | NSURL *url = [NSURL URLWithString:[KPHUtils decryptString:request.Url withAES:aes]]; 27 | if (url) { 28 | response.Count = [self entriesForURL:url].count; 29 | response.Success = YES; 30 | } 31 | 32 | response.Id = request.Id; 33 | [self setResponseVerifier:response]; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHGetLoginsHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHGetLoginsHandler.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-22. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHHandler.h" 10 | 11 | @interface KPHGetLoginsHandler : KPHHandler 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHGetLoginsHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // KPHGetLoginsHandler.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-22. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHGetLoginsHandler.h" 10 | 11 | @implementation KPHGetLoginsHandler 12 | 13 | - (void)handle:(KPHRequest *)request response:(KPHResponse *)response server:(KPHServer *)server { 14 | [super handle:request response:response server:server]; 15 | 16 | if (![self verifyRequest:request]) { 17 | return; 18 | } 19 | 20 | NSString *key = [self delegateKeyForLabel:request.Id]; 21 | if(!key) { 22 | return; 23 | } 24 | 25 | KPHAESConfig *aes = [KPHAESConfig aesWithKey:key base64key:YES IV:request.Nonce base64IV:YES]; 26 | NSURL *url = [NSURL URLWithString:[KPHUtils decryptString:request.Url withAES:aes]]; 27 | if(!url) { 28 | return; 29 | } 30 | 31 | NSArray *entries = [self entriesForURL:url]; 32 | 33 | response.Id = request.Id; 34 | [self setResponseVerifier:response]; 35 | 36 | if(!entries) { 37 | return; 38 | } 39 | if (request.SortSelection) 40 | { 41 | [KPHUtils sortEntries:entries 42 | withURL:[KPHUtils decryptString:request.Url withAES:aes] 43 | withSubmitURL:[KPHUtils decryptString:request.SubmitUrl withAES:aes]]; 44 | } 45 | 46 | 47 | aes = [KPHAESConfig aesWithKey:key base64key:YES IV:response.Nonce base64IV:YES]; 48 | response.Entries = [KPHUtils encryptEntries:entries withAES:aes]; 49 | 50 | response.Count = response.Entries.count; 51 | response.Success = YES; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHHandler.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-22. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "KPHRequest.h" 11 | #import "KPHResponse.h" 12 | #import "KPHAESConfig.h" 13 | #import "KPHServer.h" 14 | #import "KPHUtils.h" 15 | 16 | @interface KPHHandler : NSObject 17 | 18 | - (NSString *)delegateLabelForKey:(NSString *)key; 19 | - (NSString *)delegateKeyForLabel:(NSString *)label; 20 | - (NSArray *)delegateEntriesForURL:(NSString *)url; 21 | - (NSArray *)delegateAllEntries; 22 | - (void)delegateSetUsername:(NSString *)username andPassword:(NSString *)password forURL:(NSString *)url withUUID:(NSString *)uuid; 23 | - (NSString *)delegateGeneratePassword; 24 | 25 | - (BOOL)testRequestVerifier:(KPHRequest *)request withAES:(KPHAESConfig *)aes; 26 | - (void)setResponseVerifier:(KPHResponse *)response; 27 | - (BOOL)verifyRequest:(KPHRequest *)request; 28 | - (BOOL)verifyRequest:(KPHRequest *)request withKey:(NSString *)key; 29 | 30 | - (NSArray *)entriesForURL:(NSURL *)url; 31 | - (NSArray *)copyEntries:(NSArray *)entries; 32 | 33 | - (void)handle:(KPHRequest *)request response:(KPHResponse *)response server:(KPHServer *)server; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // KPHHandler.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-22. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHHandler.h" 10 | #import "KPHAESConfig.h" 11 | #import "KPHUtils.h" 12 | #import "NSData+Cryptor.h" 13 | 14 | @interface KPHHandler () 15 | @property (weak) KPHServer *server; 16 | @end 17 | 18 | @implementation KPHHandler 19 | 20 | - (NSString *)delegateLabelForKey:(NSString *)key { 21 | return [self.server.delegate server:self.server labelForKey:key]; 22 | } 23 | 24 | - (NSString *)delegateKeyForLabel:(NSString *)label { 25 | return [self.server.delegate server:self.server keyForLabel:label]; 26 | } 27 | 28 | - (NSArray *)delegateEntriesForURL:(NSString *)url { 29 | return [self.server.delegate server:self.server entriesForURL:url]; 30 | } 31 | 32 | - (NSArray *)delegateAllEntries { 33 | return [self.server.delegate allEntriesForServer:self.server]; 34 | } 35 | 36 | - (void)delegateSetUsername:(NSString *)username andPassword:(NSString *)password forURL:(NSString *)url withUUID:(NSString *)uuid { 37 | [self.server.delegate server:self.server setUsername:username andPassword:password forURL:url withUUID:uuid]; 38 | } 39 | 40 | - (NSString *)delegateGeneratePassword { 41 | return [self.server.delegate generatePasswordForServer:self.server]; 42 | } 43 | 44 | - (BOOL)testRequestVerifier:(KPHRequest *)request withAES:(KPHAESConfig *)aes { 45 | BOOL success = NO; 46 | 47 | CCCryptorRef cryptor = NULL; 48 | CCCryptorStatus status = CCCryptorCreate(kCCDecrypt, kCCAlgorithmAES, kCCOptionPKCS7Padding, aes.key.bytes, aes.key.length, aes.IV.bytes, &cryptor); 49 | if (status == kCCSuccess) 50 | { 51 | NSData *encrypted = [[NSData alloc] initWithBase64EncodedString:request.Verifier options:0]; 52 | NSData *decrypted = [encrypted runCryptor:cryptor]; 53 | 54 | success = [[[NSString alloc] initWithData:decrypted encoding:NSUTF8StringEncoding] isEqualToString:request.Nonce]; 55 | 56 | CCCryptorRelease(cryptor); 57 | } 58 | 59 | return success; 60 | } 61 | 62 | - (void)setResponseVerifier:(KPHResponse *)response { 63 | KPHAESConfig *aes = [KPHAESConfig aesWithKey:[self delegateKeyForLabel:response.Id] base64key:YES]; 64 | response.Nonce = [aes.IV base64EncodedStringWithOptions:0]; 65 | response.Verifier = [KPHUtils performOpertaion:kCCEncrypt withAES:aes onString:response.Nonce base64input:NO base64output:YES]; 66 | } 67 | 68 | - (BOOL)verifyRequest:(KPHRequest *)request { 69 | return [self verifyRequest:request withKey:[self delegateKeyForLabel:request.Id]]; 70 | } 71 | 72 | - (BOOL)verifyRequest:(KPHRequest *)request withKey:(NSString *)key { 73 | if (!key) { 74 | return NO; 75 | } 76 | 77 | if (![self testRequestVerifier:request withAES:[KPHAESConfig aesWithKey:key base64key:YES IV:request.Nonce base64IV:YES]]) 78 | { 79 | return NO; 80 | } 81 | return YES; 82 | } 83 | 84 | - (NSArray *)copyEntries:(NSArray *)entries { 85 | NSArray *copies = [[NSArray alloc] initWithArray:entries copyItems:YES]; 86 | 87 | for (NSUInteger i = 0; i < entries.count; i++) { 88 | ((KPHResponseEntry *)copies[i]).url = ((KPHResponseEntry *)entries[i]).url; 89 | } 90 | 91 | return copies; 92 | } 93 | 94 | - (NSArray *)entriesForURL:(NSURL *)url { 95 | /* if we got no scheme, host is nil as well so fall back to the full url string */ 96 | NSString *originalSearch = url.host ? url.host : url.absoluteString; 97 | NSString *search = [originalSearch copy]; 98 | NSArray *entries = nil; 99 | while ((!entries || entries.count == 0) && ([originalSearch isEqualToString:search] || [search rangeOfString:@"."].length > 0)) { 100 | entries = [self delegateEntriesForURL:search]; 101 | NSRange dot = [search rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"."]]; 102 | if (dot.location == NSNotFound || dot.location + 1 >= search.length) { 103 | break; 104 | } 105 | 106 | search = [search substringFromIndex:dot.location + 1]; 107 | } 108 | 109 | return [self copyEntries:entries]; 110 | } 111 | 112 | - (void)handle:(KPHRequest *)request response:(KPHResponse *)response server:(KPHServer *)server { 113 | self.server = server; 114 | } 115 | 116 | @end 117 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHSetLoginHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHSetLoginHandler.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-25. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHHandler.h" 10 | 11 | @interface KPHSetLoginHandler : KPHHandler 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHSetLoginHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // KPHSetLoginHandler.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-25. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHSetLoginHandler.h" 10 | 11 | @implementation KPHSetLoginHandler 12 | 13 | - (void)handle:(KPHRequest *)request response:(KPHResponse *)response server:(KPHServer *)server 14 | { 15 | [super handle:request response:response server:server]; 16 | 17 | if (![self verifyRequest:request]) 18 | return; 19 | 20 | NSString *key = [self delegateKeyForLabel:request.Id]; 21 | if (!key) 22 | return; 23 | 24 | KPHAESConfig *aes = [KPHAESConfig aesWithKey:key base64key:YES IV:request.Nonce base64IV:YES]; 25 | 26 | NSString *url = [KPHUtils decryptString:request.Url withAES:aes]; 27 | NSString *username = [KPHUtils decryptString:request.Login withAES:aes]; 28 | NSString *password = [KPHUtils decryptString:request.Password withAES:aes]; 29 | NSString *uuid = (request.Uuid) ? [KPHUtils decryptString:request.Uuid withAES:aes] : nil; 30 | 31 | if (url && username && password) 32 | { 33 | [self delegateSetUsername:username andPassword:password forURL:url withUUID:uuid]; 34 | response.Success = YES; 35 | } 36 | 37 | response.Id = request.Id; 38 | [self setResponseVerifier:response]; 39 | 40 | return; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHTestAssociateHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHTestAssociateHandler.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-22. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHHandler.h" 10 | 11 | @interface KPHTestAssociateHandler : KPHHandler 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Handlers/KPHTestAssociateHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // KPHTestAssociateHandler.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-22. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHTestAssociateHandler.h" 10 | 11 | @implementation KPHTestAssociateHandler 12 | 13 | - (void)handle:(KPHRequest *)request response:(KPHResponse *)response server:(KPHServer *)server 14 | { 15 | [super handle:request response:response server:server]; 16 | 17 | if (![self verifyRequest:request]) 18 | return; 19 | 20 | response.Id = request.Id; 21 | response.Success = YES; 22 | 23 | [self setResponseVerifier:response]; 24 | 25 | return; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /KeePassHTTPKit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | $(CURRENT_PROJECT_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | UNKNOWN 23 | NSHumanReadableCopyright 24 | Copyright © 2015 HicknHack Software GmbH. All rights reserved. 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /KeePassHTTPKit/KPHAESConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHAESConfig.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-22. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface KPHAESConfig : NSObject 12 | 13 | @property (nonatomic, strong) NSData *key; 14 | @property (nonatomic, strong) NSData *IV; 15 | 16 | + (instancetype)aesWithKey:(NSString *)key base64key:(BOOL)base64key; 17 | + (instancetype)aesWithKey:(NSString *)key base64key:(BOOL)base64key IV:(NSString *)IV base64IV:(BOOL)base64IV; 18 | - (void)generateIV; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /KeePassHTTPKit/KPHAESConfig.m: -------------------------------------------------------------------------------- 1 | // 2 | // KPHAESConfig.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-22. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHAESConfig.h" 10 | 11 | @implementation KPHAESConfig 12 | 13 | - (instancetype)init { 14 | if (self = [super init]) { 15 | [self generateIV]; 16 | } 17 | return self; 18 | } 19 | 20 | + (instancetype)aesWithKey:(NSString *)key base64key:(BOOL)base64key { 21 | KPHAESConfig *aes = [KPHAESConfig new]; 22 | aes.key = (base64key) ? [[NSData alloc] initWithBase64EncodedString:key options:0] : [key dataUsingEncoding:NSUTF8StringEncoding]; 23 | [aes generateIV]; 24 | return aes; 25 | } 26 | 27 | + (instancetype)aesWithKey:(NSString *)key base64key:(BOOL)base64key IV:(NSString *)IV base64IV:(BOOL)base64IV { 28 | KPHAESConfig *aes = [KPHAESConfig new]; 29 | aes.key = (base64key) ? [[NSData alloc] initWithBase64EncodedString:key options:0] : [key dataUsingEncoding:NSUTF8StringEncoding]; 30 | aes.IV = (base64IV) ? [[NSData alloc] initWithBase64EncodedString:IV options:0] : [IV dataUsingEncoding:NSUTF8StringEncoding]; 31 | return aes; 32 | } 33 | 34 | - (void)generateIV { 35 | static NSString *const charset = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; 36 | 37 | NSMutableString *string = [NSMutableString stringWithCapacity:16]; 38 | 39 | for (NSUInteger i = 0; i < 16; i++) { 40 | [string appendFormat: @"%C", [charset characterAtIndex: arc4random_uniform((unsigned int)charset.length) % charset.length]]; 41 | } 42 | 43 | _IV = [string dataUsingEncoding:NSUTF8StringEncoding]; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /KeePassHTTPKit/KPHDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHDelegate.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-22. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | static NSString *const KPHSettingsEntryName = @"KeePassHttp Settings"; 14 | static NSString *const KPHAssociatKeyFormat = @"AES Key: %@"; 15 | static NSString *const KPHGroupName = @"KeePassHttp Passwords"; 16 | static NSString *const KPHCustomFieldPrefix = @"KPH: "; 17 | 18 | @class KPHServer; 19 | @class KPHResponseEntry; 20 | 21 | @protocol KPHDelegate 22 | 23 | @required 24 | 25 | - (NSString *)server:(KPHServer *)server labelForKey:(NSString *)key; 26 | - (NSString *)server:(KPHServer *)server keyForLabel:(NSString *)label; 27 | - (NSArray *)server:(KPHServer *)server entriesForURL:(NSString *)url; 28 | - (NSArray *)allEntriesForServer:(KPHServer *)server; 29 | - (void)server:(KPHServer *)server setUsername:(NSString *)username andPassword:(NSString *)password forURL:(NSString *)url withUUID:(NSString *)uuid; 30 | - (NSString *)clientHashForServer:(KPHServer *)server; 31 | - (NSString *)generatePasswordForServer:(KPHServer *)server; 32 | 33 | NS_ASSUME_NONNULL_END 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /KeePassHTTPKit/KPHRequest.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHRequest.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-21. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JSONModel/JSONModel.h" 11 | 12 | 13 | static NSString *const kKPHRequestGetLogins = @"get-logins"; 14 | static NSString *const kKPHRequestGetLoginsCount = @"get-logins-count"; 15 | static NSString *const kKPHRequestGetAllLogins = @"get-all-logins"; 16 | static NSString *const kKPHRequestSetLogin = @"set-login"; 17 | static NSString *const kKPHRequestAssociate = @"associate"; 18 | static NSString *const kKPHRequestTestAssociate = @"test-associate"; 19 | static NSString *const kKPHRequestGeneratePassword = @"generate-password"; 20 | 21 | @interface KPHRequest : JSONModel 22 | 23 | @property (nonatomic, strong) NSString *RequestType; 24 | 25 | /// Sort selection by best URL matching for given hosts 26 | @property (nonatomic, assign) BOOL SortSelection; 27 | 28 | /// Trigger unlock of database even if feature is disabled in KPH (because of user interaction to fill-in) 29 | @property (nonatomic, strong) NSString *TriggerUnlock; 30 | 31 | /// Always encrypted, used with set-login, uuid is set 32 | /// if modifying an existing login 33 | @property (nonatomic, strong) NSString *Login; 34 | @property (nonatomic, strong) NSString *Password; 35 | @property (nonatomic, strong) NSString *Uuid; 36 | 37 | /// Always encrypted, used with get and set-login 38 | @property (nonatomic, strong) NSString *Url; 39 | 40 | /// Always encrypted, used with get-login 41 | @property (nonatomic, strong) NSString *SubmitUrl; 42 | 43 | /// Send the AES key ID with the 'associate' request 44 | @property (nonatomic, strong) NSString *Key; 45 | 46 | /// Always required, an identifier given by the KeePass user 47 | @property (nonatomic, strong) NSString *Id; 48 | 49 | /// A value used to ensure that the correct key has been chosen, 50 | /// it is always the value of Nonce encrypted with Key 51 | @property (nonatomic, strong) NSString *Verifier; 52 | 53 | /// Nonce value used in conjunction with all encrypted fields, 54 | /// randomly generated for each request 55 | @property (nonatomic, strong) NSString *Nonce; 56 | 57 | /// Realm value used for filtering results. Always encrypted. 58 | @property (nonatomic, strong) NSString *Realm; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /KeePassHTTPKit/KPHRequest.m: -------------------------------------------------------------------------------- 1 | // 2 | // KPHRequest.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-21. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHRequest.h" 10 | 11 | @implementation KPHRequest 12 | 13 | + (BOOL)propertyIsOptional:(NSString*)propertyName { 14 | return [propertyName isEqualToString:NSStringFromSelector(@selector(SortSelection))]; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /KeePassHTTPKit/KPHResponse.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHResponse.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-21. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JSONModel/JSONModel.h" 11 | 12 | @protocol KPHResponseStringField 13 | @end 14 | 15 | @interface KPHResponseStringField : JSONModel 16 | 17 | @property (nonatomic, strong) NSString *Key; 18 | @property (nonatomic, strong) NSString *Value; 19 | 20 | + (instancetype)stringFieldWithKey:(NSString *)key value:(NSString *)value; 21 | 22 | @end 23 | 24 | @protocol KPHResponseEntry 25 | @end 26 | 27 | @interface KPHResponseEntry : JSONModel 28 | 29 | @property (nonatomic, strong) NSString *url; 30 | @property (nonatomic, assign) NSUInteger sortValue; 31 | 32 | @property (nonatomic, strong) NSString *Login; 33 | @property (nonatomic, strong) NSString *Password; 34 | @property (nonatomic, strong) NSString *Uuid; 35 | @property (nonatomic, strong) NSString *Name; 36 | @property (nonatomic, strong) NSArray *StringFields; 37 | 38 | + (instancetype)entryWithUrl:(NSString *)url name:(NSString *)name login:(NSString *)login password:(NSString *)password uuid:(NSString *)uuid stringFields:(NSArray *)stringFields; 39 | 40 | @end 41 | 42 | @interface KPHResponse : JSONModel 43 | 44 | /// Mirrors the request type of KeePassRequest 45 | @property (nonatomic, strong) NSString *RequestType; 46 | 47 | @property (nonatomic, strong) NSString *Error; 48 | 49 | @property (nonatomic, assign) BOOL Success; 50 | 51 | /// The user selected string as a result of 'associate', 52 | /// always returned on every request 53 | @property (nonatomic, strong) NSString *Id; 54 | 55 | /// response to get-logins-count, number of entries for requested Url 56 | @property (nonatomic, assign) NSUInteger Count; 57 | 58 | /// response the current version of KeePassHttp 59 | @property (nonatomic, strong) NSString *Version; 60 | 61 | /// response an unique hash of the database composed of RootGroup UUid and RecycleBin UUid 62 | @property (nonatomic, strong) NSString *Hash; 63 | 64 | /// The resulting entries for a get-login request 65 | @property (nonatomic, strong) NSArray *Entries; 66 | 67 | /// Nonce value used in conjunction with all encrypted fields, 68 | /// randomly generated for each request 69 | @property (nonatomic, strong) NSString *Nonce; 70 | 71 | /// Same purpose as Request.Verifier, but a new value 72 | @property (nonatomic, strong) NSString *Verifier; 73 | 74 | + (instancetype)responseWithRequestType:(NSString *)requestType hash:(NSString *)hash; 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /KeePassHTTPKit/KPHResponse.m: -------------------------------------------------------------------------------- 1 | // 2 | // KPHResponse.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-21. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHResponse.h" 10 | 11 | @implementation KPHResponseStringField 12 | 13 | + (instancetype)stringFieldWithKey:(NSString *)key value:(NSString *)value { 14 | KPHResponseStringField *stringField = [KPHResponseStringField new]; 15 | stringField.Key = key; 16 | stringField.Value = value; 17 | return stringField; 18 | } 19 | 20 | @end 21 | 22 | @implementation KPHResponseEntry 23 | 24 | + (instancetype)entryWithUrl:(NSString *)url name:(NSString *)name login:(NSString *)login password:(NSString *)password uuid:(NSString *)uuid stringFields:(NSArray *)stringFields { 25 | KPHResponseEntry *entry = [[KPHResponseEntry alloc] init]; 26 | entry.url = url; 27 | entry.Name = name; 28 | entry.Login = login; 29 | entry.Password = password; 30 | entry.Uuid = uuid; 31 | entry.StringFields = stringFields; 32 | return entry; 33 | } 34 | 35 | + (BOOL)propertyIsIgnored:(NSString *)propertyName { 36 | return ([propertyName isEqualToString:@"sortValue"]); 37 | } 38 | @end 39 | 40 | @implementation KPHResponse 41 | 42 | - (instancetype)init { 43 | if (self = [super init]) { 44 | _Success = NO; 45 | NSBundle *bundle = [NSBundle bundleForClass:self.class]; 46 | NSString *name = bundle.infoDictionary[(NSString *)kCFBundleNameKey]; 47 | _Version = [NSString stringWithFormat:@"%@", name]; 48 | } 49 | return self; 50 | } 51 | 52 | + (instancetype)responseWithRequestType:(NSString *)requestType hash:(NSString *)hash 53 | { 54 | KPHResponse *response = [KPHResponse new]; 55 | response.RequestType = requestType; 56 | response.Hash = hash; 57 | return response; 58 | } 59 | 60 | + (BOOL)propertyIsOptional:(NSString*)propertyName { 61 | return ([propertyName isEqualToString:@"Count"]); 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /KeePassHTTPKit/KPHServer.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHServer.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-21. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "KPHDelegate.h" 11 | 12 | @interface KPHServer : NSObject 13 | 14 | @property (nonatomic, weak) id delegate; 15 | @property (readonly) BOOL isRunning; 16 | 17 | - (BOOL)start; 18 | - (BOOL)startWithPort:(NSUInteger)port bindToLocalhost:(BOOL)localhost error:(NSError *__autoreleasing *)error; 19 | - (void)stop; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /KeePassHTTPKit/KPHServer.m: -------------------------------------------------------------------------------- 1 | // 2 | // KPHServer.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-21. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "KPHServer.h" 12 | #import "KPHRequest.h" 13 | #import "KPHResponse.h" 14 | 15 | #import "KPHTestAssociateHandler.h" 16 | #import "KPHAssociateHandler.h" 17 | #import "KPHGetLoginsHandler.h" 18 | #import "KPHGetLoginsCountHandler.h" 19 | #import "KPHGetAllLoginsHandler.h" 20 | #import "KPHSetLoginHandler.h" 21 | #import "KPHGeneratePasswordHandler.h" 22 | 23 | static const NSUInteger kKPHDefaultPort = 19455; 24 | 25 | @interface KPHServer () 26 | 27 | @property (nonatomic, strong) NSDictionary *handlers; 28 | @property (strong) GCDWebServer *server; 29 | 30 | @end 31 | 32 | @implementation KPHServer 33 | 34 | #pragma mark - Initializaiton 35 | 36 | - (instancetype)init { 37 | if (self = [super init]) { 38 | // Log Erros 39 | [GCDWebServer setLogLevel:4]; 40 | 41 | _handlers = @{ 42 | kKPHRequestTestAssociate: [KPHTestAssociateHandler new], 43 | kKPHRequestAssociate: [KPHAssociateHandler new], 44 | kKPHRequestGetLogins: [KPHGetLoginsHandler new], 45 | kKPHRequestGetLoginsCount: [KPHGetLoginsCountHandler new], 46 | kKPHRequestGetAllLogins: [KPHGetAllLoginsHandler new], 47 | kKPHRequestSetLogin: [KPHSetLoginHandler new], 48 | kKPHRequestGeneratePassword: [KPHGeneratePasswordHandler new], 49 | }; 50 | 51 | _server = [[GCDWebServer alloc] init]; 52 | 53 | __weak typeof(self) weakSelf = self; 54 | [_server addDefaultHandlerForMethod:@"POST" 55 | requestClass:[GCDWebServerDataRequest class] 56 | processBlock:^GCDWebServerResponse *(GCDWebServerRequest *request) { 57 | 58 | NSString *clientHash = [weakSelf.delegate clientHashForServer:weakSelf]; 59 | if (clientHash && [request isKindOfClass:[GCDWebServerDataRequest class]] && [request.contentType hasPrefix:@"application/json"]) { 60 | GCDWebServerDataRequest *dataRequest = (GCDWebServerDataRequest *)request; 61 | 62 | NSError *error = nil; 63 | KPHRequest *kphRequest = [[KPHRequest alloc] initWithData:dataRequest.data error:&error]; 64 | if (!error) { 65 | KPHResponse *kphResponse = [KPHResponse responseWithRequestType:kphRequest.RequestType hash:clientHash]; 66 | 67 | KPHHandler *handler = (KPHHandler *)weakSelf.handlers[kphRequest.RequestType]; 68 | if (handler) { 69 | [handler handle:kphRequest response:kphResponse server:weakSelf]; 70 | } 71 | return [[GCDWebServerDataResponse alloc] initWithData:[[kphResponse toJSONString] dataUsingEncoding:NSUTF8StringEncoding] contentType:@"application/json"]; 72 | } 73 | } 74 | 75 | GCDWebServerResponse *response = [GCDWebServerResponse new]; 76 | response.statusCode = 400; 77 | return response; 78 | }]; 79 | } 80 | return self; 81 | } 82 | 83 | - (BOOL)isRunning { 84 | return self.server.isRunning; 85 | } 86 | 87 | - (BOOL)start { 88 | return [self startWithPort:kKPHDefaultPort bindToLocalhost:YES error:nil]; 89 | } 90 | 91 | - (BOOL)startWithPort:(NSUInteger)port bindToLocalhost:(BOOL)localhost error:(NSError *__autoreleasing *)error { 92 | if(self.isRunning) { 93 | [self stop]; 94 | } 95 | return [self.server startWithOptions:@{ GCDWebServerOption_Port: @(port), GCDWebServerOption_BindToLocalhost: @(localhost) } error:error]; 96 | } 97 | 98 | - (void)stop { 99 | [self.server stop]; 100 | } 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /KeePassHTTPKit/KPHUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // KPHUtils.h 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-22. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "KPHAESConfig.h" 12 | #import "KPHResponse.h" 13 | 14 | @interface KPHUtils : NSObject 15 | 16 | + (NSString *)performOpertaion:(CCOperation)op withAES:(KPHAESConfig *)aes onString:(NSString *)input base64input:(BOOL)base64input base64output:(BOOL)base64output; 17 | + (NSString *)decryptString:(NSString *)input withAES:(KPHAESConfig *)aes; 18 | + (NSString *)encryptString:(NSString *)input withAES:(KPHAESConfig *)aes; 19 | + (NSArray *)encryptEntries:(NSArray *)entries withAES:(KPHAESConfig *)aes; 20 | 21 | + (void)sortEntries:(NSArray *)entries withURL:(NSString *)url withSubmitURL:(NSString *)submitUrl; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /KeePassHTTPKit/KPHUtils.m: -------------------------------------------------------------------------------- 1 | // 2 | // KPHUtils.m 3 | // KeePassHttp-ObjC 4 | // 5 | // Created by James Hurst on 2014-09-22. 6 | // Copyright (c) 2014 James Hurst. All rights reserved. 7 | // 8 | 9 | #import "KPHUtils.h" 10 | #import "NSData+Cryptor.h" 11 | #import "KPHResponse.h" 12 | 13 | @implementation KPHUtils 14 | 15 | + (NSString *)performOpertaion:(CCOperation)op withAES:(KPHAESConfig *)aes onString:(NSString *)input base64input:(BOOL)base64input base64output:(BOOL)base64output { 16 | NSString *output = nil; 17 | 18 | if(!input) { 19 | // invalid input! 20 | return output; 21 | } 22 | 23 | CCCryptorRef cryptor = NULL; 24 | CCCryptorStatus status = CCCryptorCreate(op, kCCAlgorithmAES, kCCOptionPKCS7Padding, aes.key.bytes, aes.key.length, aes.IV.bytes, &cryptor); 25 | if (status == kCCSuccess) { 26 | NSData *inputData = (base64input) ? [[NSData alloc] initWithBase64EncodedString:input options:0] : [input dataUsingEncoding:NSUTF8StringEncoding]; 27 | NSData *outputData = [inputData runCryptor:cryptor]; 28 | output = (base64output) ? [outputData base64EncodedStringWithOptions:0] : [[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding]; 29 | CCCryptorRelease(cryptor); 30 | } 31 | 32 | return output; 33 | } 34 | 35 | + (NSString *)decryptString:(NSString *)input withAES:(KPHAESConfig *)aes { 36 | return [KPHUtils performOpertaion:kCCDecrypt withAES:aes onString:input base64input:YES base64output:NO]; 37 | } 38 | 39 | + (NSString *)encryptString:(NSString *)input withAES:(KPHAESConfig *)aes { 40 | return [KPHUtils performOpertaion:kCCEncrypt withAES:aes onString:input base64input:NO base64output:YES]; 41 | } 42 | 43 | + (NSArray *)encryptEntries:(NSArray *)entries withAES:(KPHAESConfig *)aes { 44 | NSMutableArray *encryptedEntries = entries.mutableCopy; 45 | 46 | for (KPHResponseEntry *entry in encryptedEntries) { 47 | entry.Name = [KPHUtils encryptString:entry.Name withAES:aes]; 48 | entry.Login = [KPHUtils encryptString:entry.Login withAES:aes]; 49 | entry.Password = [KPHUtils encryptString:entry.Password withAES:aes]; 50 | entry.Uuid = [KPHUtils encryptString:entry.Uuid withAES:aes]; 51 | 52 | for (KPHResponseStringField *stringField in entry.StringFields) { 53 | stringField.Key = [KPHUtils encryptString:stringField.Key withAES:aes]; 54 | stringField.Value = [KPHUtils encryptString:stringField.Value withAES:aes]; 55 | } 56 | } 57 | 58 | return encryptedEntries; 59 | } 60 | 61 | + (NSString *)prepareURL:(NSString *)url 62 | { 63 | if (!url || url.length == 0) { 64 | return nil; 65 | } 66 | 67 | NSString *prepared = [[NSString alloc] initWithString:url]; 68 | 69 | // remove trailing '/' 70 | unichar lastChar = [url characterAtIndex:url.length - 1]; 71 | if ([[NSCharacterSet characterSetWithCharactersInString:@"/"] characterIsMember:lastChar]) { 72 | prepared = [prepared substringToIndex:url.length - 1]; 73 | } 74 | 75 | // add http:// if no scheme is present 76 | if ([prepared rangeOfString:@"://"].location == NSNotFound) { 77 | prepared = [@"http://" stringByAppendingString:prepared]; 78 | } 79 | 80 | return prepared; 81 | } 82 | 83 | + (void)sortEntries:(NSArray *)entries withURL:(NSString *)url withSubmitURL:(NSString *)submitUrl 84 | { 85 | NSString *cleanUrl = [KPHUtils prepareURL:url]; 86 | NSString *cleanSubmitUrl = (submitUrl) ? [KPHUtils prepareURL:submitUrl] : cleanUrl; 87 | 88 | NSURL *_url = [NSURL URLWithString:cleanUrl]; 89 | NSURL *_submitUrl = [NSURL URLWithString:cleanSubmitUrl]; 90 | 91 | if (!_url || !_submitUrl) { 92 | return; 93 | } 94 | 95 | NSString *baseSubmitUrl = [NSString stringWithFormat:@"%@://%@", _submitUrl.scheme, _submitUrl.host].lowercaseString; 96 | 97 | for (KPHResponseEntry *entry in entries) { 98 | NSString *cleanEntryUrl = [KPHUtils prepareURL:entry.url]; 99 | if (!cleanEntryUrl) { 100 | entry.sortValue = 0; 101 | continue; 102 | } 103 | 104 | NSURL *_entryUrl = [NSURL URLWithString:cleanEntryUrl]; 105 | NSString *baseEntryUrl = [NSString stringWithFormat:@"%@://%@", _entryUrl.scheme, _entryUrl.host].lowercaseString; 106 | 107 | if ([cleanSubmitUrl isEqualToString:cleanEntryUrl]) { 108 | entry.sortValue = 100; 109 | } 110 | else if ([cleanSubmitUrl hasPrefix:cleanEntryUrl] && ![cleanUrl isEqualToString:cleanEntryUrl] && ![baseSubmitUrl isEqualToString:cleanEntryUrl]) { 111 | entry.sortValue = 90; 112 | } 113 | else if ([cleanSubmitUrl hasPrefix:baseEntryUrl] && ![cleanUrl isEqualToString:baseEntryUrl] && ![baseSubmitUrl isEqualToString:baseEntryUrl]) { 114 | entry.sortValue = 80; 115 | } 116 | else if ([cleanUrl isEqualToString:cleanEntryUrl]) { 117 | entry.sortValue = 70; 118 | } 119 | else if ([baseSubmitUrl isEqualToString:cleanEntryUrl]) { 120 | entry.sortValue = 60; 121 | } 122 | else if ([cleanEntryUrl hasPrefix:cleanSubmitUrl]) { 123 | entry.sortValue = 50; 124 | } 125 | else if ([cleanEntryUrl hasPrefix:baseSubmitUrl] && ![baseSubmitUrl isEqualToString:cleanUrl]) { 126 | entry.sortValue = 40; 127 | } 128 | else if ([cleanSubmitUrl hasPrefix:cleanEntryUrl]) { 129 | entry.sortValue = 30; 130 | } 131 | else if ([cleanSubmitUrl hasPrefix:baseEntryUrl]) { 132 | entry.sortValue = 20; 133 | } 134 | else if ([cleanEntryUrl hasPrefix:cleanUrl]) { 135 | entry.sortValue = 10; 136 | } 137 | else if ([cleanUrl hasPrefix:cleanEntryUrl]) { 138 | entry.sortValue = 5; 139 | } 140 | else { 141 | entry.sortValue = 0; 142 | } 143 | } 144 | 145 | NSMutableArray *sortedEntries = entries.mutableCopy; 146 | [sortedEntries sortUsingComparator:^NSComparisonResult(KPHResponseEntry *obj1, KPHResponseEntry *obj2) { 147 | return [@(obj2.sortValue) compare:@(obj1.sortValue)]; 148 | }]; 149 | } 150 | 151 | @end 152 | -------------------------------------------------------------------------------- /KeePassHTTPKit/KeePassHTTPKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // KeePassHTTPKit.h 3 | // KeePassHTTPKit 4 | // 5 | // Created by Michael Starke on 16/11/15. 6 | // Copyright © 2015 HicknHack Software GmbH. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for KeePassHTTPKit. 12 | FOUNDATION_EXPORT double KeePassHTTPKitVersionNumber; 13 | 14 | //! Project version string for KeePassHTTPKit. 15 | FOUNDATION_EXPORT const unsigned char KeePassHTTPKitVersionString[]; 16 | 17 | #import "KPHDelegate.h" 18 | #import "KPHServer.h" 19 | #import "KPHResponse.h" 20 | -------------------------------------------------------------------------------- /KeePassHTTPKitTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | -------------------------------------------------------------------------------- /KeePassHTTPKitTests/KeePassHTTPKitTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // KeePassHTTPKitTests.m 3 | // KeePassHTTPKitTests 4 | // 5 | // Created by Michael Starke on 16/11/15. 6 | // Copyright © 2015 HicknHack Software GmbH. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "KeePassHTTPKit.h" 11 | 12 | @interface KeePassHTTPKitTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation KeePassHTTPKitTests 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)test { 29 | KPHServer *server = [[KPHServer alloc] init]; 30 | [server start]; 31 | //XCTFail(@"No tests implemented!"); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 James Hurst 4 | Copyright (c) 2015 Michael Starke, HicknHack Software GmbH 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KeePassHTTPKit 2 | 3 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 4 | 5 | An Objective-C implementation of the KeePassHttp protocol. 6 | 7 | Copyright (c) 2014 James Hurt
8 | Copyright (c) 2015-2016 Michael Starke, HicknHack Software GmbH 9 | 10 | ## Dependencies 11 | 12 | [JSONModel](https://github.com/icanzilb/JSONModel) (submodule) 13 | [GCDWebServer](https://github.com/swisspol/GCDWebServer) 14 | 15 | ## Installation 16 | 17 | * Clone the repository 18 | ```bash 19 | git clone https://github.com/MacPass/KeePassHTTPKit 20 | cd KeePassHTTPKit 21 | git submodule init 22 | git submodule update 23 | ``` 24 | * Install [Carthage](https://github.com/Carthage/Carthage#installing-carthage) 25 | * Fetch and build dependencies 26 | ```bash 27 | carthage bootstrap 28 | ``` 29 | 30 | ## Usage 31 | ```objectivec 32 | #import 33 | 34 | @interface ServerDelegate : NSObject 35 | - (NSString *)server:(KPHServer *)server labelForKey:(NSString *)key; 36 | - (NSString *)server:(KPHServer *)server keyForLabel:(NSString *)label; 37 | - (NSArray *)server:(KPHServer *)server entriesForURL:(NSString *)url; 38 | - (NSArray *)allEntriesForServer:(KPHServer *)server; 39 | - (void)server:(KPHServer *)server setUsername:(NSString *)username andPassword:(NSString *)password forURL:(NSString *)url withUUID:(NSString *)uuid; 40 | - (NSString *)clientHashForServer:(KPHServer *)server; 41 | - (NSString *)generatePasswordForServer:(KPHServer *)server; 42 | @end 43 | 44 | @interface Server : NSObject 45 | @property (strong) KPHServer *server; 46 | @property (strong) ServerDelegate *delegate; 47 | - (void)startServer; 48 | @end 49 | 50 | @implementation Server 51 | - (void)startServer { 52 | self.server = [[KPHServer alloc] init]; 53 | self.delegate = [[ServerDelegate alloc] init]; 54 | server.delegate = delgate; 55 | [server start]; 56 | } 57 | @end 58 | ``` 59 | 60 | ## License 61 | The MIT License (MIT) 62 | 63 | Copyright (c) 2014 James Hurst
64 | Copyright (c) 2015-2016 Michael Starke, HicknHack Software GmbH 65 | 66 | Permission is hereby granted, free of charge, to any person obtaining a copy 67 | of this software and associated documentation files (the "Software"), to deal 68 | in the Software without restriction, including without limitation the rights 69 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 70 | copies of the Software, and to permit persons to whom the Software is 71 | furnished to do so, subject to the following conditions: 72 | 73 | The above copyright notice and this permission notice shall be included in 74 | all copies or substantial portions of the Software. 75 | 76 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 77 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 78 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 79 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 80 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 81 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 82 | THE SOFTWARE. 83 | 84 | 85 | --------------------------------------------------------------------------------