diff --git a/KeePassKit b/KeePassKit index 709c8874..07349e3b 160000 --- a/KeePassKit +++ b/KeePassKit @@ -1 +1 @@ -Subproject commit 709c8874e411288f4563ac681c0de54390fc9ee1 +Subproject commit 07349e3bcbce3c3c16fcd3143d5c06efdedd40ce diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index 2b59c459..a74b28ac 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -12,7 +12,6 @@ 4C01C245176500C40016D5D0 /* HNHLevelIndicatorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C01C244176500C40016D5D0 /* HNHLevelIndicatorCell.m */; }; 4C055E74179620BF00BD2BAB /* NSString+CommandString.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C055E73179620BF00BD2BAB /* NSString+CommandString.m */; }; 4C10412C178CDD44001B5239 /* NSDate+Humanized.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C10412B178CDD44001B5239 /* NSDate+Humanized.m */; }; - 4C16BA6217879A3C002B42BD /* MPPasswordStringFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C16BA6117879A3C002B42BD /* MPPasswordStringFormatter.m */; }; 4C17D8E517A1C780006C8C1E /* MPDocumentWindowDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C17D8E417A1C780006C8C1E /* MPDocumentWindowDelegate.m */; }; 4C1842AB179B027800E2F5BC /* KPKDeletedNode.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842AA179B027800E2F5BC /* KPKDeletedNode.m */; }; 4C1842AF179B211C00E2F5BC /* KPKXmlTreeReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842AE179B211C00E2F5BC /* KPKXmlTreeReader.m */; }; @@ -23,7 +22,6 @@ 4C1842C0179B5BFD00E2F5BC /* NSData+CommonCrypto.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842BF179B5BFD00E2F5BC /* NSData+CommonCrypto.m */; }; 4C1842C3179B69E700E2F5BC /* NSData+HashedData.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842C2179B69E700E2F5BC /* NSData+HashedData.m */; }; 4C1842C6179BF52100E2F5BC /* KPKLegacyHeaderReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842C5179BF52000E2F5BC /* KPKLegacyHeaderReader.m */; }; - 4C1842CA179C616700E2F5BC /* KPKTreeCryptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842C9179C616700E2F5BC /* KPKTreeCryptor.m */; }; 4C1842D0179C64DD00E2F5BC /* KPKLegacyTreeCryptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842CF179C64DD00E2F5BC /* KPKLegacyTreeCryptor.m */; }; 4C1842D3179C64F000E2F5BC /* KPKXmlTreeCryptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1842D2179C64EF00E2F5BC /* KPKXmlTreeCryptor.m */; }; 4C18816C179E06920045C5B7 /* TrashBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C18816B179E06920045C5B7 /* TrashBar.xib */; }; @@ -211,6 +209,7 @@ 4CA0B2FC15BCAF8600654E32 /* MPSettingsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA0B2FB15BCAF8600654E32 /* MPSettingsWindowController.m */; }; 4CA0E3A7176FAF99004D18CB /* MPDocumentQueryService.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA0E3A6176FAF99004D18CB /* MPDocumentQueryService.m */; }; 4CA2335A176DBFE100F0B6AC /* MPLockDaemon.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA23359176DBFE100F0B6AC /* MPLockDaemon.m */; }; + 4CAC614317AD319200023F9E /* KPKTestXmlParsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAC614217AD319200023F9E /* KPKTestXmlParsing.m */; }; 4CAD747B15B887FD00104512 /* DDXMLElementAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAD745715B887FD00104512 /* DDXMLElementAdditions.m */; }; 4CAD747C15B887FD00104512 /* NSString+DDXML.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAD745A15B887FD00104512 /* NSString+DDXML.m */; }; 4CAD747D15B887FD00104512 /* DDXMLDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAD745D15B887FD00104512 /* DDXMLDocument.m */; }; @@ -257,6 +256,7 @@ 4CE5B54B173AFBA700207B39 /* MPDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE5B549173AFBA700207B39 /* MPDocument.m */; }; 4CE8246F16E2E93400573141 /* MPOverlayWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8246E16E2E93400573141 /* MPOverlayWindowController.m */; }; 4CE8247516E2F2B900573141 /* MPOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8247416E2F2B900573141 /* MPOverlayView.m */; }; + 4CECB31717AC326D00EAFB0F /* KPKLegacyWritingTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CECB31617AC326D00EAFB0F /* KPKLegacyWritingTest.m */; }; 4CF1F0CA1786B37900CD920E /* NSData+Gzip.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CF1F0C81786B37900CD920E /* NSData+Gzip.m */; }; 4CF29BF417879D0000851B60 /* 26_FileSaveTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4CF29BF317879D0000851B60 /* 26_FileSaveTemplate.pdf */; }; 4CF62B86179385D700B660B6 /* KPKAttribute.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CF62B85179385D700B660B6 /* KPKAttribute.m */; }; @@ -286,8 +286,8 @@ 4C055E73179620BF00BD2BAB /* NSString+CommandString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+CommandString.m"; sourceTree = ""; }; 4C10412A178CDD44001B5239 /* NSDate+Humanized.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+Humanized.h"; sourceTree = ""; }; 4C10412B178CDD44001B5239 /* NSDate+Humanized.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+Humanized.m"; sourceTree = ""; }; - 4C16BA6017879A3C002B42BD /* MPPasswordStringFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPPasswordStringFormatter.h; sourceTree = ""; }; - 4C16BA6117879A3C002B42BD /* MPPasswordStringFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPPasswordStringFormatter.m; sourceTree = ""; }; + 4C13904C17ADD1A300A62934 /* KPKTreeCrypting.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KPKTreeCrypting.h; sourceTree = ""; }; + 4C13904D17ADD3BE00A62934 /* KPKTreeWriting.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KPKTreeWriting.h; sourceTree = ""; }; 4C17D8E317A1C780006C8C1E /* MPDocumentWindowDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPDocumentWindowDelegate.h; sourceTree = ""; }; 4C17D8E417A1C780006C8C1E /* MPDocumentWindowDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPDocumentWindowDelegate.m; sourceTree = ""; }; 4C1842A9179B027700E2F5BC /* KPKDeletedNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKDeletedNode.h; sourceTree = ""; }; @@ -310,8 +310,6 @@ 4C1842C4179BF51F00E2F5BC /* KPKLegacyHeaderReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKLegacyHeaderReader.h; sourceTree = ""; }; 4C1842C5179BF52000E2F5BC /* KPKLegacyHeaderReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKLegacyHeaderReader.m; sourceTree = ""; }; 4C1842C7179BF6A100E2F5BC /* KPKLegacyHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = KPKLegacyHeader.h; path = Format/KPKLegacyHeader.h; sourceTree = ""; }; - 4C1842C8179C616600E2F5BC /* KPKTreeCryptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKTreeCryptor.h; sourceTree = ""; }; - 4C1842C9179C616700E2F5BC /* KPKTreeCryptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTreeCryptor.m; sourceTree = ""; }; 4C1842CE179C64DC00E2F5BC /* KPKLegacyTreeCryptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKLegacyTreeCryptor.h; sourceTree = ""; }; 4C1842CF179C64DD00E2F5BC /* KPKLegacyTreeCryptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKLegacyTreeCryptor.m; sourceTree = ""; }; 4C1842D1179C64EF00E2F5BC /* KPKXmlTreeCryptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKXmlTreeCryptor.h; sourceTree = ""; }; @@ -664,6 +662,8 @@ 4CA23358176DBFE100F0B6AC /* MPLockDaemon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPLockDaemon.h; sourceTree = ""; }; 4CA23359176DBFE100F0B6AC /* MPLockDaemon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPLockDaemon.m; sourceTree = ""; }; 4CAAFDD51787AED60013FCF9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/MainMenu.strings; sourceTree = ""; }; + 4CAC614117AD319200023F9E /* KPKTestXmlParsing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKTestXmlParsing.h; sourceTree = ""; }; + 4CAC614217AD319200023F9E /* KPKTestXmlParsing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTestXmlParsing.m; sourceTree = ""; }; 4CAD745615B887FD00104512 /* DDXMLElementAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDXMLElementAdditions.h; sourceTree = ""; }; 4CAD745715B887FD00104512 /* DDXMLElementAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDXMLElementAdditions.m; sourceTree = ""; }; 4CAD745915B887FD00104512 /* NSString+DDXML.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+DDXML.h"; sourceTree = ""; }; @@ -751,6 +751,8 @@ 4CE8246E16E2E93400573141 /* MPOverlayWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPOverlayWindowController.m; sourceTree = ""; }; 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 = ""; }; + 4CECB31517AC326D00EAFB0F /* KPKLegacyWritingTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKLegacyWritingTest.h; sourceTree = ""; }; + 4CECB31617AC326D00EAFB0F /* KPKLegacyWritingTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKLegacyWritingTest.m; sourceTree = ""; }; 4CF1F0C81786B37900CD920E /* NSData+Gzip.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Gzip.m"; sourceTree = ""; }; 4CF1F0C91786B37900CD920E /* NSData+Gzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Gzip.h"; sourceTree = ""; }; 4CF29BF317879D0000851B60 /* 26_FileSaveTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 26_FileSaveTemplate.pdf; sourceTree = ""; }; @@ -1111,8 +1113,6 @@ 4C01C2411764D8980016D5D0 /* MPContextMenuHelper.m */, 4CA23358176DBFE100F0B6AC /* MPLockDaemon.h */, 4CA23359176DBFE100F0B6AC /* MPLockDaemon.m */, - 4C16BA6017879A3C002B42BD /* MPPasswordStringFormatter.h */, - 4C16BA6117879A3C002B42BD /* MPPasswordStringFormatter.m */, 4C4B7EF617A4B335000234C7 /* MPUniqueCharactersFormatter.h */, 4C4B7EF717A4B335000234C7 /* MPUniqueCharactersFormatter.m */, ); @@ -1193,6 +1193,10 @@ 4C79E80517A9400500AC6CD2 /* KPKTestNSCoding.m */, 4C79E80717A9485600AC6CD2 /* KPKTestNSCopying.h */, 4C79E80817A9485600AC6CD2 /* KPKTestNSCopying.m */, + 4CECB31517AC326D00EAFB0F /* KPKLegacyWritingTest.h */, + 4CECB31617AC326D00EAFB0F /* KPKLegacyWritingTest.m */, + 4CAC614117AD319200023F9E /* KPKTestXmlParsing.h */, + 4CAC614217AD319200023F9E /* KPKTestXmlParsing.m */, ); path = MacPassTests; sourceTree = ""; @@ -1617,8 +1621,6 @@ children = ( 4CDB5C401794AA4F0017667E /* KPKTree+Serializing.h */, 4CDB5C411794AA4F0017667E /* KPKTree+Serializing.m */, - 4C1842C8179C616600E2F5BC /* KPKTreeCryptor.h */, - 4C1842C9179C616700E2F5BC /* KPKTreeCryptor.m */, 4C1842BA179B434C00E2F5BC /* KPKXmlHeaderReader.h */, 4C1842BB179B434C00E2F5BC /* KPKXmlHeaderReader.m */, 4C79E80117A9187400AC6CD2 /* KPKXmlHeaderWriter.h */, @@ -1637,9 +1639,11 @@ 4C1842C5179BF52000E2F5BC /* KPKLegacyHeaderReader.m */, 4C1842CE179C64DC00E2F5BC /* KPKLegacyTreeCryptor.h */, 4C1842CF179C64DD00E2F5BC /* KPKLegacyTreeCryptor.m */, + 4C13904C17ADD1A300A62934 /* KPKTreeCrypting.h */, 4C1842D4179C6DE400E2F5BC /* KPKHeaderReading.h */, 4C1842D5179C6F1800E2F5BC /* KPKHeaderWriting.h */, 4CCEDE2F179F550D008402BE /* KPKTreeReading.h */, + 4C13904D17ADD3BE00A62934 /* KPKTreeWriting.h */, 4CCEDE30179F5B6C008402BE /* KPKDataStreamReader.h */, 4CCEDE31179F5B6C008402BE /* KPKDataStreamReader.m */, 4C5FA86B17A5F26800C781C9 /* KPKDataStreamWriter.h */, @@ -1884,6 +1888,8 @@ 4CFC8743179DFD3E000DFC03 /* KPKXmlLoadingTest.m in Sources */, 4C79E80617A9400500AC6CD2 /* KPKTestNSCoding.m in Sources */, 4C79E80917A9485600AC6CD2 /* KPKTestNSCopying.m in Sources */, + 4CECB31717AC326D00EAFB0F /* KPKLegacyWritingTest.m in Sources */, + 4CAC614317AD319200023F9E /* KPKTestXmlParsing.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2033,7 +2039,6 @@ 4C5FE9AE17843CE20001D5A8 /* MPSelectedAttachmentTableCellView.m in Sources */, 4CF1F0CA1786B37900CD920E /* NSData+Gzip.m in Sources */, 4C3666411787327E00B249F1 /* MPDocument+Attachments.m in Sources */, - 4C16BA6217879A3C002B42BD /* MPPasswordStringFormatter.m in Sources */, 4CD6C5AE1789FDE6000891F6 /* HNHRoundedSecureTextField.m in Sources */, 4C10412C178CDD44001B5239 /* NSDate+Humanized.m in Sources */, 4CD3ABBA178F71B50073F5C5 /* KPKTree.m in Sources */, @@ -2067,7 +2072,6 @@ 4C1842C0179B5BFD00E2F5BC /* NSData+CommonCrypto.m in Sources */, 4C1842C3179B69E700E2F5BC /* NSData+HashedData.m in Sources */, 4C1842C6179BF52100E2F5BC /* KPKLegacyHeaderReader.m in Sources */, - 4C1842CA179C616700E2F5BC /* KPKTreeCryptor.m in Sources */, 4C1842D0179C64DD00E2F5BC /* KPKLegacyTreeCryptor.m in Sources */, 4C1842D3179C64F000E2F5BC /* KPKXmlTreeCryptor.m in Sources */, 4CFC873B179DEDF3000DFC03 /* KPKMetaData.m in Sources */, diff --git a/MacPass/Base.lproj/InspectorView.xib b/MacPass/Base.lproj/InspectorView.xib index f47764af..20415c0b 100644 --- a/MacPass/Base.lproj/InspectorView.xib +++ b/MacPass/Base.lproj/InspectorView.xib @@ -107,7 +107,7 @@ 134217728 33554432 - + NSImage NSActionTemplate @@ -126,8 +126,8 @@ - -2147483380 - {{20, 2}, {59, 25}} + 268 + {{20, 2}, {238, 25}} @@ -142,10 +142,7 @@ 918306816 163 - - NSImage - 07_NotepadTemplate - + 400 @@ -178,7 +175,7 @@ {278, 369} - + _NS:28 Entry @@ -601,6 +598,22 @@ 2930 + + + 6 + 0 + + 6 + 1 + + 20 + + 1000 + + 8 + 29 + 3 + 10 @@ -870,6 +883,11 @@ + + 3115 + + + @@ -911,6 +929,7 @@ + com.apple.InterfaceBuilder.CocoaPlugin @@ -954,12 +973,13 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin - 3114 + 3115 @@ -1059,10 +1079,10 @@ IBCocoaFramework YES 3 - - {128, 128} - {15, 15} - + + NSActionTemplate + {15, 15} + YES diff --git a/MacPass/DatabaseSettingsWindow.xib b/MacPass/DatabaseSettingsWindow.xib index 1394ed3f..4b385cc2 100644 --- a/MacPass/DatabaseSettingsWindow.xib +++ b/MacPass/DatabaseSettingsWindow.xib @@ -14,8 +14,10 @@ IBNSLayoutConstraint NSButton NSButtonCell + NSColorWell NSCustomObject NSMenu + NSMenuItem NSPathCell NSPathControl NSPopUpButton @@ -54,7 +56,7 @@ 7 2 - {{196, 240}, {546, 293}} + {{196, 240}, {546, 365}} 1618477056 Window NSWindow @@ -96,10 +98,10 @@ 12 - {{13, 41}, {520, 246}} + {{13, 41}, {520, 318}} - + _NS:9 @@ -111,7 +113,7 @@ 268 - {{136, 148}, {280, 22}} + {{136, 220}, {280, 22}} _NS:9 @@ -148,7 +150,7 @@ 268 - {{50, 121}, {81, 17}} + {{50, 195}, {81, 17}} _NS:1535 @@ -181,7 +183,7 @@ 268 - {{25, 151}, {106, 17}} + {{25, 223}, {106, 17}} _NS:1535 @@ -209,7 +211,7 @@ 2322 - {278, 121} + {278, 98} _NS:13 @@ -271,7 +273,7 @@ - {{1, 1}, {278, 121}} + {{1, 1}, {278, 98}} _NS:11 @@ -301,9 +303,9 @@ 256 - {{263, 1}, {16, 121}} + {{263, 1}, {16, 98}} - + _NS:83 NO @@ -325,7 +327,7 @@ 0.94565218687057495 - {{136, 17}, {280, 123}} + {{136, 112}, {280, 100}} _NS:9 @@ -337,8 +339,131 @@ 4 1 + + + 268 + {{134, 68}, {120, 26}} + + + _NS:9 + YES + + -2076180416 + 2048 + + _NS:9 + + 109199360 + 129 + + + 400 + 75 + + YES + + OtherViews + + + + None + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + _popUpItemAction: + + + + + GZip + + 1048576 + 2147483647 + + + _popUpItemAction: + 1 + + + + + + -1 + 1 + YES + YES + 2 + + NO + + + + 268 + {{39, 73}, {92, 17}} + + + _NS:1535 + YES + + 68157504 + 272630784 + Compression: + + _NS:1535 + + + + + NO + + + + 268 + {{88, 31}, {43, 17}} + + + _NS:1535 + YES + + 68157504 + 272630784 + Color: + + _NS:1535 + + + + + NO + + + + 268 + + NSColor pasteboard type + + {{136, 28}, {44, 23}} + + + _NS:1116 + YES + NO + YES + + 1 + MC4wNTgxMzA0OTg5OCAwLjA1NTU0MTg5OTA2IDEAA + + - {{10, 33}, {500, 200}} + {{10, 33}, {500, 272}} _NS:11 @@ -348,15 +473,14 @@ - + 256 268 - {{111, 140}, {68, 17}} + {{111, 212}, {68, 17}} - _NS:1535 YES @@ -379,9 +503,8 @@ Apple URL pasteboard type NSFilenamesPboardType - {{181, 74}, {170, 26}} + {{181, 146}, {170, 26}} - _NS:9 YES @@ -404,9 +527,8 @@ 268 - {{128, 78}, {51, 17}} + {{128, 150}, {51, 17}} - _NS:1535 YES @@ -425,9 +547,8 @@ 268 - {{184, 51}, {164, 19}} + {{184, 123}, {164, 19}} - _NS:9 YES @@ -454,9 +575,8 @@ 268 - {{356, 136}, {31, 25}} + {{356, 208}, {31, 25}} - _NS:22 YES @@ -483,9 +603,8 @@ 268 - {{356, 75}, {31, 25}} + {{356, 147}, {31, 25}} - _NS:22 YES @@ -512,9 +631,8 @@ 268 - {{184, 138}, {164, 22}} + {{184, 210}, {164, 22}} - _NS:9 YES @@ -537,9 +655,8 @@ 268 - {{127, 108}, {52, 17}} + {{127, 180}, {52, 17}} - _NS:1535 YES @@ -558,9 +675,8 @@ 268 - {{184, 106}, {164, 22}} + {{184, 178}, {164, 22}} - _NS:9 YES @@ -583,9 +699,8 @@ 268 - {{198, 168}, {137, 17}} + {{198, 240}, {137, 17}} - _NS:1535 YES @@ -609,9 +724,7 @@ NO - {{10, 33}, {500, 200}} - - + {{10, 33}, {500, 272}} Password @@ -620,14 +733,15 @@ - + 256 268 - {{184, 156}, {98, 18}} + {{184, 228}, {98, 18}} + _NS:9 YES @@ -657,8 +771,9 @@ 268 - {{184, 127}, {133, 18}} + {{184, 199}, {133, 18}} + _NS:9 YES @@ -683,8 +798,9 @@ 268 - {{184, 98}, {130, 18}} + {{184, 170}, {130, 18}} + _NS:9 YES @@ -709,8 +825,9 @@ 268 - {{184, 69}, {95, 18}} + {{184, 141}, {95, 18}} + _NS:9 YES @@ -735,8 +852,9 @@ 268 - {{184, 40}, {107, 18}} + {{184, 112}, {107, 18}} + _NS:9 YES @@ -759,7 +877,9 @@ NO - {{10, 33}, {500, 200}} + {{10, 33}, {500, 272}} + + Protection @@ -774,7 +894,7 @@ 268 - {{70, 159}, {307, 18}} + {{70, 231}, {307, 18}} _NS:9 @@ -800,7 +920,7 @@ 268 - {{70, 60}, {138, 18}} + {{70, 132}, {138, 18}} _NS:9 @@ -826,7 +946,7 @@ 268 - {{112, 37}, {187, 18}} + {{112, 109}, {187, 18}} _NS:9 @@ -852,7 +972,7 @@ 268 - {{111, 136}, {98, 17}} + {{111, 208}, {98, 17}} _NS:1535 @@ -872,7 +992,7 @@ 268 - {{214, 134}, {96, 22}} + {{214, 206}, {96, 22}} _NS:9 @@ -893,7 +1013,7 @@ 268 - {{315, 131}, {19, 27}} + {{315, 203}, {19, 27}} _NS:1099 @@ -912,7 +1032,7 @@ 268 - {{212, 56}, {220, 26}} + {{212, 128}, {220, 26}} _NS:9 @@ -948,7 +1068,7 @@ 268 - {{121, 103}, {88, 17}} + {{121, 175}, {88, 17}} _NS:1535 @@ -968,7 +1088,7 @@ 268 - {{214, 101}, {96, 22}} + {{214, 173}, {96, 22}} _NS:9 @@ -989,7 +1109,7 @@ 268 - {{315, 98}, {19, 27}} + {{315, 170}, {19, 27}} _NS:1099 @@ -1006,7 +1126,7 @@ NO - {{10, 33}, {500, 200}} + {{10, 33}, {500, 272}} Advanced @@ -1021,7 +1141,7 @@ 268 - {{97, 114}, {121, 17}} + {{97, 186}, {121, 17}} _NS:1535 @@ -1041,7 +1161,7 @@ 268 - {{223, 111}, {178, 22}} + {{223, 183}, {178, 22}} _NS:9 @@ -1062,7 +1182,7 @@ 268 - {{220, 79}, {184, 26}} + {{220, 151}, {184, 26}} _NS:9 @@ -1097,7 +1217,7 @@ 268 - {{107, 84}, {110, 17}} + {{107, 156}, {110, 17}} _NS:1535 @@ -1115,7 +1235,7 @@ NO - {{10, 33}, {500, 200}} + {{10, 33}, {500, 272}} Templates @@ -1123,13 +1243,13 @@ - + 0 YES YES - + @@ -1158,12 +1278,12 @@ NO - {546, 293} + {546, 365} - {{0, 0}, {2560, 1418}} + {{0, 0}, {1680, 1028}} {10000000000000, 10000000000000} YES @@ -1585,7 +1705,151 @@ 361 - + + + 5 + 0 + + 6 + 1 + + 8 + + 1000 + + 6 + 24 + 3 + + + + 4 + 0 + + 4 + 1 + + 28 + + 1000 + + 3 + 9 + 3 + + + + 3 + 0 + + 4 + 1 + + 20 + + 1000 + + 6 + 24 + 3 + + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 4 + 0 + + 4 + 1 + + 31 + + 1000 + + 3 + 9 + 3 + + + + 10 + 0 + + 10 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 5 + 0 + + 6 + 1 + + 8 + + 1000 + + 6 + 24 + 3 + + + + 5 + 0 + + 5 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + + + 10 + 0 + + 10 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + 4 0 @@ -1593,15 +1857,47 @@ 4 1 - 17 + 112 1000 - 8 - 29 + 3 + 9 3 - + + + 5 + 0 + + 6 + 1 + + 8 + + 1000 + + 6 + 24 + 3 + + + + 3 + 0 + + 3 + 1 + + 0.0 + + 1000 + + 6 + 24 + 2 + + 3 0 @@ -1613,8 +1909,8 @@ 1000 - 6 - 24 + 9 + 40 3 @@ -1633,21 +1929,21 @@ 24 2 - - - 5 + + + 10 0 - - 6 + + 10 1 - - 8 + + 0.0 1000 6 24 - 3 + 2 @@ -1697,22 +1993,6 @@ 24 3 - - - 3 - 0 - - 4 - 1 - - 13 - - 1000 - - 9 - 40 - 3 - 5 @@ -1729,26 +2009,14 @@ 9 3 - - - 10 - 0 - - 10 - 1 - - 0.0 - - 1000 - - 9 - 40 - 2 - - + + + + + @@ -1828,15 +2096,15 @@ 24 2 - - - 4 + + + 3 0 - - 4 + + 3 1 - 59 + 120 1000 @@ -1956,7 +2224,7 @@ 24 2 - + 4 0 @@ -1964,7 +2232,7 @@ 4 1 - 39 + 111 1000 @@ -2189,21 +2457,21 @@ 24 2 - + - 10 + 3 0 - 10 + 3 1 - -7 + 86 1000 - 5 - 22 - 2 + 3 + 9 + 3 @@ -2348,11 +2616,6 @@ - - 435 - - - 457 @@ -3064,11 +3327,6 @@ - - 710 - - - 665 @@ -3084,11 +3342,6 @@ - - 672 - - - 668 @@ -3137,21 +3390,6 @@ - - 853 - - - - - 854 - - - - - 867 - - - 956 @@ -3310,21 +3548,11 @@ - - 1114 - - - 1115 - - 1116 - - - 1120 @@ -3874,11 +4102,6 @@ - - 1375 - - - 1376 @@ -3889,6 +4112,206 @@ + + 710 + + + + + 1387 + + + + + 1388 + + + + + 1391 + + + + + 1393 + + + + + 1394 + + + + + + 7 + 0 + + 0 + 1 + + 115 + + 1000 + + 3 + 9 + 1 + + + + + + 1395 + + + + + + + + 1396 + + + + + + + + + 1397 + + + + + 1398 + + + + + 1401 + + + + + 1404 + + + + + + + + 1405 + + + + + 1408 + + + + + 1409 + + + + + 1410 + + + + + 1412 + + + + + 1421 + + + + + 1433 + + + + + 1434 + + + + + + + + 1435 + + + + + 1439 + + + + + 7 + 0 + + 0 + 1 + + 44 + + 1000 + + 3 + 9 + 1 + + + + + + 1441 + + + + + 1447 + + + + + 1448 + + + + + 1449 + + + + + 1450 + + + + + 1451 + + + + + 1452 + + + + + 1411 + + + @@ -3924,9 +4347,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -4024,9 +4445,47 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -4059,16 +4518,25 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - - + - - + + + + + + + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -4082,7 +4550,7 @@ - + @@ -4090,7 +4558,7 @@ - + @@ -4104,7 +4572,7 @@ - + @@ -4113,7 +4581,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -4205,7 +4672,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -4219,9 +4685,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -4235,7 +4698,7 @@ - 1377 + 1453 @@ -4287,7 +4750,7 @@ NSButton NSTextView NSTextField - HNHRoundendTextField + HNHRoundedTextField NSButton NSButton NSTextField @@ -4320,7 +4783,7 @@ defaultUsernameTextField - HNHRoundendTextField + HNHRoundedTextField emptyRecycleBinOnQuitCheckButton @@ -4400,6 +4863,24 @@ ./Classes/NSLayoutConstraint.h + + NSTextView + + orderFrontSharingServicePicker: + id + + + orderFrontSharingServicePicker: + + orderFrontSharingServicePicker: + id + + + + IBProjectSource + ./Classes/NSTextView.h + + 0 @@ -4407,6 +4888,8 @@ YES 3 + {11, 11} + {10, 3} {21, 16} {11, 11} {15, 15} diff --git a/MacPass/GroupInspectorView.xib b/MacPass/GroupInspectorView.xib index f259696a..255725fe 100644 --- a/MacPass/GroupInspectorView.xib +++ b/MacPass/GroupInspectorView.xib @@ -524,7 +524,7 @@ _NS:9 YES - -1804599231 + -2075131840 272631104 diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index e0934753..04d5c1bf 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -38,10 +38,6 @@ #import "DDXMLNode.h" -#import "KPKPassword.h" -#import "KPKTreeCryptor.h" -#import "KPKTree.h" - NSString *const MPDocumentDidAddGroupNotification = @"com.hicknhack.macpass.MPDocumentDidAddGroupNotification"; NSString *const MPDocumentDidAddEntryNotification = @"com.hicknhack.macpass.MPDocumentDidAddEntryNotification"; NSString *const MPDocumentDidRevertNotifiation = @"com.hicknhack.macpass.MPDocumentDidRevertNotifiation"; @@ -196,11 +192,7 @@ typedef NS_ENUM(NSUInteger, MPAlertType) { #pragma mark Lock/Unlock/Decrypt - (BOOL)unlockWithPassword:(NSString *)password keyFileURL:(NSURL *)keyFileURL { - // KPKPassword *pwd = [[KPKPassword alloc] initWithPassword:password key:nil]; - // - // KPKTreeCryptor *cryptor = [KPKTreeCryptor treeCryptorWithData:_fileData password:pwd]; - // KPKTree *tree = [cryptor decryptTree:NULL]; - + self.key = keyFileURL; self.password = [password length] > 0 ? password : nil; @try { diff --git a/MacPass/MPPasswordCreatorViewController.h b/MacPass/MPPasswordCreatorViewController.h index adfa3db6..a8576c98 100644 --- a/MacPass/MPPasswordCreatorViewController.h +++ b/MacPass/MPPasswordCreatorViewController.h @@ -8,7 +8,7 @@ #import "MPViewController.h" -@interface MPPasswordCreatorViewController : MPViewController +@interface MPPasswordCreatorViewController : MPViewController @property (copy, readonly) NSString *generatedPassword; diff --git a/MacPass/MPPasswordCreatorViewController.m b/MacPass/MPPasswordCreatorViewController.m index 83f752df..eefab323 100644 --- a/MacPass/MPPasswordCreatorViewController.m +++ b/MacPass/MPPasswordCreatorViewController.m @@ -52,9 +52,10 @@ typedef NS_ENUM(NSUInteger, MPPasswordRating) { @property (weak) IBOutlet NSTextField *entropyTextField; @property (weak) IBOutlet NSLevelIndicator *entropyIndicator; -@property (assign, nonatomic) BOOL useCustomString; -@property (assign, nonatomic) NSUInteger passwordLength; -@property (assign, nonatomic) CGFloat entropy; +@property (nonatomic, copy) NSString *customString; +@property (nonatomic, assign) BOOL useCustomString; +@property (nonatomic, assign) NSUInteger passwordLength; +@property (nonatomic, assign) CGFloat entropy; - (IBAction)_generatePassword:(id)sender; - (IBAction)_toggleCharacters:(id)sender; @@ -72,6 +73,7 @@ typedef NS_ENUM(NSUInteger, MPPasswordRating) { _passwordLength = 12; _characterFlags = MPPasswordCharactersAll; _useCustomString = NO; + _customString = @""; _entropy = 0.0; } return self; @@ -93,8 +95,10 @@ typedef NS_ENUM(NSUInteger, MPPasswordRating) { [self.entropyIndicator bind:NSValueBinding toObject:self withKeyPath:@"entropy" options:nil]; [self.entropyTextField bind:NSValueBinding toObject:self withKeyPath:@"entropy" options:nil]; - + + [self.customCharactersTextField setDelegate:self]; [_customButton bind:NSValueBinding toObject:self withKeyPath:@"useCustomString" options:nil]; + [_numbersButton setTag:MPPasswordCharactersNumbers]; [_upperCaseButton setTag:MPPasswordCharactersUpperCase]; [_lowerCaseButton setTag:MPPasswordCharactersLowerCase]; @@ -104,6 +108,9 @@ typedef NS_ENUM(NSUInteger, MPPasswordRating) { [self _generatePassword:nil]; } +#pragma mark - +#pragma mark Actions + - (IBAction)_generatePassword:(id)sender { if(_useCustomString) { if([[_customCharactersTextField stringValue] length] > 0) { @@ -137,6 +144,9 @@ typedef NS_ENUM(NSUInteger, MPPasswordRating) { } +#pragma mark - +#pragma mark Custom Setter + - (void)setPassword:(NSString *)password { if(![_password isEqualToString:password]) { _password = [password copy]; @@ -159,6 +169,18 @@ typedef NS_ENUM(NSUInteger, MPPasswordRating) { } } +#pragma mark - +#pragma mark NSTextFieldDelegate + +- (void)controlTextDidChange:(NSNotification *)obj { + if([obj object] == self.customCharactersTextField) { + [self _generatePassword:nil]; + } +} + +#pragma mark - +#pragma mark Helper + - (void)_resetCharacters { if(_useCustomString) { [_customButton setState:NSOnState]; diff --git a/MacPass/MPPasswordStringFormatter.h b/MacPass/MPPasswordStringFormatter.h deleted file mode 100644 index 5cb8425a..00000000 --- a/MacPass/MPPasswordStringFormatter.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// MPPasswordStringFormatter.h -// MacPass -// -// Created by Michael Starke on 06.07.13. -// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. -// - -#import - -@interface MPPasswordStringFormatter : NSFormatter - -@end diff --git a/MacPass/MPPasswordStringFormatter.m b/MacPass/MPPasswordStringFormatter.m deleted file mode 100644 index 758958ac..00000000 --- a/MacPass/MPPasswordStringFormatter.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// MPPasswordStringFormatter.m -// MacPass -// -// Created by Michael Starke on 06.07.13. -// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. -// - -#import "MPPasswordStringFormatter.h" - -@implementation MPPasswordStringFormatter - -@end diff --git a/MacPass/MPUniqueCharactersFormatter.m b/MacPass/MPUniqueCharactersFormatter.m index 770fc3d4..99e12e68 100644 --- a/MacPass/MPUniqueCharactersFormatter.m +++ b/MacPass/MPUniqueCharactersFormatter.m @@ -27,9 +27,16 @@ originalString:(NSString *)origString originalSelectedRange:(NSRange)origSelRange errorDescription:(NSString **)error { - return YES; + NSInteger newLenght = [*partialStringPtr length]; + NSInteger oldLenght = [origString length]; + if( oldLenght == 0 || (newLenght < oldLenght)) { + return YES; + } + + NSCharacterSet *newCharacterSet = [NSCharacterSet characterSetWithCharactersInString:*partialStringPtr]; + NSCharacterSet *oldCharacterSet = [NSCharacterSet characterSetWithCharactersInString:origString]; + + return ![oldCharacterSet isSupersetOfSet:newCharacterSet]; } - - @end diff --git a/MacPass/NSString+MPPasswordCreation.m b/MacPass/NSString+MPPasswordCreation.m index 8b5cb925..f6a161de 100644 --- a/MacPass/NSString+MPPasswordCreation.m +++ b/MacPass/NSString+MPPasswordCreation.m @@ -73,12 +73,11 @@ static NSString *allowedCharactersString(MPPasswordCharacterFlags flags) { } - (CGFloat)entropyWhithPossibleCharacterSet:(MPPasswordCharacterFlags)allowedCharacters orCustomCharacters:(NSString *)customCharacters { - if(nil != customCharacters) { - return 0; // We need a sophisticated parser here! + CGFloat alphabetCount = [customCharacters length]; + if(nil == customCharacters) { + NSString *stringSet = allowedCharactersString(allowedCharacters); + alphabetCount = [stringSet length]; } - - NSString *stringSet = allowedCharactersString(allowedCharacters); - CGFloat alphabetCount = [stringSet length]; CGFloat passwordLegnth = [self length]; return passwordLegnth * ( log10(alphabetCount) / log10(2) ); } diff --git a/MacPass/PasswordCreatorView.xib b/MacPass/PasswordCreatorView.xib index 418dbac3..ea551c0d 100644 --- a/MacPass/PasswordCreatorView.xib +++ b/MacPass/PasswordCreatorView.xib @@ -303,8 +303,8 @@ _NS:9 YES - -1804599231 - 272630784 + -1805647807 + 272631872 _NS:9 @@ -576,7 +576,7 @@ YES -2074083263 - 272631808 + 272632384 Menlo-Regular diff --git a/MacPass/en.lproj/Localizable.strings b/MacPass/en.lproj/Localizable.strings index 2e72c31c..9fdee21f 100644 Binary files a/MacPass/en.lproj/Localizable.strings and b/MacPass/en.lproj/Localizable.strings differ diff --git a/MacPassTests/KPKLegacyLoadingTest.m b/MacPassTests/KPKLegacyLoadingTest.m index a627e836..f14d095e 100644 --- a/MacPassTests/KPKLegacyLoadingTest.m +++ b/MacPassTests/KPKLegacyLoadingTest.m @@ -7,8 +7,9 @@ // #import "KPKLegacyLoadingTest.h" -#import "KPKTreeCryptor.h" +#import "KPKTree+Serializing.h" #import "KPKPassword.h" +#import "KPKErrors.h" @implementation KPKLegacyLoadingTest @@ -24,10 +25,19 @@ _password = nil; } -- (void)testLoading { - KPKTreeCryptor *cryptor = [KPKTreeCryptor treeCryptorWithData:_data password:_password]; - KPKTree *tree = [cryptor decryptTree:NULL]; +- (void)testValidFile { + KPKTree *tree = [[KPKTree alloc] initWithData:_data password:_password error:NULL]; STAssertNotNil(tree, @"Loading should result in a tree object"); } +- (void)testInvalidFile { + NSError *error; + uint8 bytes[] = {0x00,0x11,0x22,0x33,0x44}; + NSData *data = [NSData dataWithBytes:bytes length:5]; + KPKTree *tree = [[KPKTree alloc] initWithData:data password:nil error:&error]; + STAssertNil(tree, @"Tree should be nil with invalid data"); + STAssertNotNil(error, @"Error object should have been created"); + STAssertTrue(KPKErrorUnknownFileFormat == [error code], @"Error should be Unknown file format"); +} + @end diff --git a/MacPassTests/KPKLegacyWritingTest.h b/MacPassTests/KPKLegacyWritingTest.h new file mode 100644 index 00000000..82a0d4d5 --- /dev/null +++ b/MacPassTests/KPKLegacyWritingTest.h @@ -0,0 +1,17 @@ +// +// KPKLegacyWritingTest.h +// MacPass +// +// Created by Michael Starke on 02.08.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import +@class KPKPassword; + +@interface KPKLegacyWritingTest : SenTestCase { + NSData *_data; + KPKPassword *_password; +} + +@end diff --git a/MacPassTests/KPKLegacyWritingTest.m b/MacPassTests/KPKLegacyWritingTest.m new file mode 100644 index 00000000..d8380fe3 --- /dev/null +++ b/MacPassTests/KPKLegacyWritingTest.m @@ -0,0 +1,36 @@ +// +// KPKLegacyWritingTest.m +// MacPass +// +// Created by Michael Starke on 02.08.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "KPKLegacyWritingTest.h" + + +#import "KPKPassword.h" +#import "KPKTree+Serializing.h" + +@implementation KPKLegacyWritingTest + +- (void)setUp { + NSBundle *myBundle = [NSBundle bundleForClass:[self class]]; + NSURL *url = [myBundle URLForResource:@"Test_Password_1234" withExtension:@"kdb"]; + _data = [NSData dataWithContentsOfURL:url]; + _password = [[KPKPassword alloc] initWithPassword:@"1234" key:nil]; +} + +- (void)tearDown { + _data = nil; + _password = nil; +} + +- (void)testWriting { + NSError *error = nil; + KPKTree *tree = [[KPKTree alloc] initWithData:_data password:_password error:&error]; + NSData *data = [tree encryptWithPassword:_password forVersion:KPKVersion1 error:&error]; +} + + +@end diff --git a/MacPassTests/KPKTestXmlParsing.h b/MacPassTests/KPKTestXmlParsing.h new file mode 100644 index 00000000..7f1c96a9 --- /dev/null +++ b/MacPassTests/KPKTestXmlParsing.h @@ -0,0 +1,13 @@ +// +// KPKTestXmlParsing.h +// MacPass +// +// Created by Michael Starke on 03.08.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import + +@interface KPKTestXmlParsing : SenTestCase + +@end diff --git a/MacPassTests/KPKTestXmlParsing.m b/MacPassTests/KPKTestXmlParsing.m new file mode 100644 index 00000000..36c97f72 --- /dev/null +++ b/MacPassTests/KPKTestXmlParsing.m @@ -0,0 +1,47 @@ +// +// KPKTestXmlParsing.m +// MacPass +// +// Created by Michael Starke on 03.08.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "KPKTestXmlParsing.h" +#import "KPKXmlTreeReader.h" +#import "KPKErrors.h" + +#import "DDXMLDocument.h" + +@implementation KPKTestXmlParsing + +- (void)testEmptyXmlFile { + DDXMLDocument *document = [[DDXMLDocument alloc] initWithXMLString:@"" options:0 error:NULL]; + KPKXmlTreeReader *reader = [[KPKXmlTreeReader alloc] initWithData:[document XMLData] headerReader:nil]; + NSError *error; + KPKTree *tree = [reader tree:&error]; + STAssertNil(tree, @"No Tree form emptry data"); + STAssertNotNil(error, @"Error Object should be provided"); + STAssertTrue([error code] == KPKErrorNoData, @"Error Code should be No Data"); +} + +- (void)testNoNodeXmlFile { + DDXMLDocument *document = [[DDXMLDocument alloc] initWithXMLString:@"" options:0 error:NULL]; + KPKXmlTreeReader *reader = [[KPKXmlTreeReader alloc] initWithData:[document XMLData] headerReader:nil]; + NSError *error; + KPKTree *tree = [reader tree:&error]; + STAssertNil(tree, @"No Tree form emptry data"); + STAssertNotNil(error, @"Error Object should be provided"); + STAssertTrue([error code] == KPKErrorXMLKeePassFileElementMissing, @"Error Code should be KeePassFile root missing"); +} + +- (void)testNoRoodXmlFil { + DDXMLDocument *document = [[DDXMLDocument alloc] initWithXMLString:@"" options:0 error:NULL]; + KPKXmlTreeReader *reader = [[KPKXmlTreeReader alloc] initWithData:[document XMLData] headerReader:nil]; + NSError *error; + KPKTree *tree = [reader tree:&error]; + STAssertNil(tree, @"No Tree form emptry data"); + STAssertNotNil(error, @"Error Object should be provided"); + STAssertTrue([error code] == KPKErrorXMLRootElementMissing, @"Error Code should be KeePassFile root missing"); +} + +@end diff --git a/MacPassTests/KPKXmlLoadingTest.m b/MacPassTests/KPKXmlLoadingTest.m index 8945f58e..0bebcc6c 100644 --- a/MacPassTests/KPKXmlLoadingTest.m +++ b/MacPassTests/KPKXmlLoadingTest.m @@ -7,10 +7,9 @@ // #import "KPKXmlLoadingTest.h" -#import "KPKTreeCryptor.h" #import "KPKPassword.h" -#import "KPKTree.h" +#import "KPKTree+Serializing.h" #import "KPKEntry.h" #import "KPKGroup.h" @@ -29,12 +28,12 @@ } - (void)testLoading { - KPKTreeCryptor *cryptor = [KPKTreeCryptor treeCryptorWithData:_data password:_password]; - KPKTree *tree = [cryptor decryptTree:NULL]; - //STAssertNotNil(tree, @"Loading should result in a tree object"); + NSError *error; + KPKTree *tree = [[KPKTree alloc] initWithData:_data password:_password error:&error]; + STAssertNotNil(tree, @"Loading should result in a tree object"); - //STAssertTrue([tree.root.groups count] == 0, @"Tree contains just root group"); - //STAssertTrue([tree.root.entries count] == 1, @"Tree has only one entry"); + STAssertTrue([tree.root.groups count] == 0, @"Tree contains just root group"); + STAssertTrue([tree.root.entries count] == 1, @"Tree has only one entry"); KPKEntry *entry = [tree.root.entries lastObject]; NSMutableData *data = [[NSMutableData alloc] init];