diff --git a/KeePassKit b/KeePassKit index 0ef316dc..821a79aa 160000 --- a/KeePassKit +++ b/KeePassKit @@ -1 +1 @@ -Subproject commit 0ef316dc105b6592157997511397c9b2a07d7b39 +Subproject commit 821a79aa86a124d8870784816de4ae60e2c8fa3d diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index b1b8630f..e235a3a5 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -244,6 +244,7 @@ 4CAD748C15B889B700104512 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CAD748B15B889B700104512 /* Security.framework */; }; 4CAD748E15B88AC100104512 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CAD748D15B88AC100104512 /* libz.dylib */; }; 4CAF62FC1763604000CD7084 /* HNHBadgedTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAF62FB1763604000CD7084 /* HNHBadgedTextFieldCell.m */; }; + 4CB4AA0D17C2274200454CAD /* KeePass1_native_test.kdb in Resources */ = {isa = PBXBuildFile; fileRef = 4CB4AA0C17C2274200454CAD /* KeePass1_native_test.kdb */; }; 4CB9339916D3A0DD00A13B5D /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 4CB9339716D3A0DD00A13B5D /* Credits.rtf */; }; 4CBA2ABA17074C07006D8139 /* MPSettingsHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CBA2AB917074C07006D8139 /* MPSettingsHelper.m */; }; 4CC0D2CE17974A47000B4BDA /* MPCustomFieldTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC0D2CD17974A47000B4BDA /* MPCustomFieldTableViewDelegate.m */; }; @@ -284,6 +285,7 @@ 4CE8246F16E2E93400573141 /* MPOverlayWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8246E16E2E93400573141 /* MPOverlayWindowController.m */; }; 4CE8247516E2F2B900573141 /* MPOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8247416E2F2B900573141 /* MPOverlayView.m */; }; 4CE88B9717BA651C0042E078 /* contextTriangleTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4CE88B9617BA651C0042E078 /* contextTriangleTemplate.pdf */; }; + 4CE88C4117C16A6500BFD195 /* KPKLegacyHeaderUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE88C4017C16A6500BFD195 /* KPKLegacyHeaderUtility.m */; }; 4CEAF85717BA9B1D001307A6 /* Keepass2Key.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4CEAF85617BA9B1D001307A6 /* Keepass2Key.xml */; }; 4CEAF85B17BA9B44001307A6 /* KPKTestKeyfileParsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEAF85A17BA9B44001307A6 /* KPKTestKeyfileParsing.m */; }; 4CECB31717AC326D00EAFB0F /* KPKTestLegacyWriting.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CECB31617AC326D00EAFB0F /* KPKTestLegacyWriting.m */; }; @@ -750,6 +752,7 @@ 4CAD748D15B88AC100104512 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 4CAF62FA1763604000CD7084 /* HNHBadgedTextFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HNHBadgedTextFieldCell.h; sourceTree = ""; }; 4CAF62FB1763604000CD7084 /* HNHBadgedTextFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HNHBadgedTextFieldCell.m; sourceTree = ""; }; + 4CB4AA0C17C2274200454CAD /* KeePass1_native_test.kdb */ = {isa = PBXFileReference; lastKnownFileType = file; name = KeePass1_native_test.kdb; path = Databases/KeePass1_native_test.kdb; sourceTree = ""; }; 4CB9339816D3A0DD00A13B5D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; 4CBA2AB617074B59006D8139 /* MPSettingsHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPSettingsHelper.h; sourceTree = ""; }; 4CBA2AB917074C07006D8139 /* MPSettingsHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPSettingsHelper.m; sourceTree = ""; }; @@ -823,6 +826,10 @@ 4CE8247316E2F2B900573141 /* MPOverlayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPOverlayView.h; sourceTree = ""; }; 4CE8247416E2F2B900573141 /* MPOverlayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOverlayView.m; sourceTree = ""; }; 4CE88B9617BA651C0042E078 /* contextTriangleTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = contextTriangleTemplate.pdf; path = Icons/contextTriangleTemplate.pdf; sourceTree = ""; }; + 4CE88C2417C163FE00BFD195 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; + 4CE88C3317C1647400BFD195 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 4CE88C3F17C16A6500BFD195 /* KPKLegacyHeaderUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKLegacyHeaderUtility.h; sourceTree = ""; }; + 4CE88C4017C16A6500BFD195 /* KPKLegacyHeaderUtility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKLegacyHeaderUtility.m; sourceTree = ""; }; 4CEAF85617BA9B1D001307A6 /* Keepass2Key.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = Keepass2Key.xml; path = Keyfiles/Keepass2Key.xml; sourceTree = ""; }; 4CEAF85917BA9B44001307A6 /* KPKTestKeyfileParsing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKTestKeyfileParsing.h; sourceTree = ""; }; 4CEAF85A17BA9B44001307A6 /* KPKTestKeyfileParsing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTestKeyfileParsing.m; sourceTree = ""; }; @@ -944,6 +951,8 @@ 4CD3ABB2178F71B50073F5C5 /* KPKVersion.h */, 4C1842B9179B3A1700E2F5BC /* KPKXmlFormat.h */, 4C08C3AF17B3036500BBBC95 /* KPKLegacyFormat.h */, + 4CE88C3F17C16A6500BFD195 /* KPKLegacyHeaderUtility.h */, + 4CE88C4017C16A6500BFD195 /* KPKLegacyHeaderUtility.m */, ); name = Format; sourceTree = ""; @@ -951,6 +960,7 @@ 4C18F9AC178E123200890BCE /* Databases */ = { isa = PBXGroup; children = ( + 4CB4AA0C17C2274200454CAD /* KeePass1_native_test.kdb */, 4C5426F217BEEA8700A4424C /* Autotype_test.kdbx */, 4C6366B017AFB52500AAF17D /* CustomIcon_Password_1234.kdbx */, 4C6366B117AFB52500AAF17D /* CustomIcon_Password_1234.xml */, @@ -1469,6 +1479,8 @@ 4CAD748B15B889B700104512 /* Security.framework */, 4C77E36615B84A240093A587 /* Cocoa.framework */, 4C45FB1B178E09ED0010007D /* SenTestingKit.framework */, + 4CE88C2417C163FE00BFD195 /* CoreFoundation.framework */, + 4CE88C3317C1647400BFD195 /* Foundation.framework */, 4C77E36815B84A240093A587 /* Other Frameworks */, ); name = Frameworks; @@ -1943,6 +1955,7 @@ 4C6366B517AFB52500AAF17D /* KDB1_KeePassX_test.kdb in Resources */, 4CEAF85717BA9B1D001307A6 /* Keepass2Key.xml in Resources */, 4C5426F317BEEA8700A4424C /* Autotype_test.kdbx in Resources */, + 4CB4AA0D17C2274200454CAD /* KeePass1_native_test.kdb in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2265,6 +2278,7 @@ 4CA2E2DB17BCDA8300714076 /* NSString+Placeholder.m in Sources */, 4CA2E2DE17BCDEAE00714076 /* MPAutotypeDaemon.m in Sources */, 4C6C72C417C01E4200768849 /* NSMutableData+KeePassKit.m in Sources */, + 4CE88C4117C16A6500BFD195 /* KPKLegacyHeaderUtility.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MacPassTests/Databases/KeePass1_native_test.kdb b/MacPassTests/Databases/KeePass1_native_test.kdb new file mode 100644 index 00000000..76596e07 Binary files /dev/null and b/MacPassTests/Databases/KeePass1_native_test.kdb differ diff --git a/MacPassTests/KPKTestLegacyLoading.m b/MacPassTests/KPKTestLegacyLoading.m index bfc25c59..ffdc9988 100644 --- a/MacPassTests/KPKTestLegacyLoading.m +++ b/MacPassTests/KPKTestLegacyLoading.m @@ -24,6 +24,16 @@ STAssertNotNil(tree, @"Loading should result in a tree object"); } +- (void)testWrongPassword { + KPKPassword *password = [[KPKPassword alloc] initWithPassword:@"4321" key:nil]; + NSData *data = [self _loadTestDataBase:@"KeePass1_native_test" extension:@"kdb"]; + NSError *error; + KPKTree *tree = [[KPKTree alloc] initWithData:data password:password error:&error]; + STAssertNil(tree, @"Wrong password should yield nil tree"); + STAssertNotNil(error, @"Wrong password should yield error"); + //STAssertTrue([error code] == KPKErrorPasswordAndOrKeyfileWrong, @"Error code should be wrong password and/or keyfile"); +} + - (void)testInvalidFile { NSError *error; uint8_t bytes[] = {0x00,0x11,0x22,0x33,0x44}; diff --git a/MiniKeePassLib b/MiniKeePassLib index c56ef24a..fc1e3c22 160000 --- a/MiniKeePassLib +++ b/MiniKeePassLib @@ -1 +1 @@ -Subproject commit c56ef24aacfa53478d499697f2219a675918680e +Subproject commit fc1e3c2232009b9a0245f248fe27a78066bb434d