From 568749458209da4980332c10a864b8869dd19317 Mon Sep 17 00:00:00 2001 From: michael starke Date: Sat, 21 Jul 2012 15:49:44 +0200 Subject: [PATCH] Updated Readme --- MacPass.xcodeproj/project.pbxproj | 4 + MacPass/MPAppDelegate.m | 2 +- MacPass/MPDatabaseDocument.h | 3 +- MacPass/MPDatabaseDocument.m | 43 +++++------ MacPass/PasswordWindow.xib | 121 ++++++++++++++++++++++++++++++ README.md | 12 +-- 6 files changed, 151 insertions(+), 34 deletions(-) create mode 100644 MacPass/PasswordWindow.xib diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index 4ff512d4..7b223f18 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 4C77E37715B84A240093A587 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 4C77E37515B84A240093A587 /* Credits.rtf */; }; 4C77E37A15B84A240093A587 /* MPAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C77E37915B84A240093A587 /* MPAppDelegate.m */; }; 4C77E37D15B84A240093A587 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C77E37B15B84A240093A587 /* MainMenu.xib */; }; + 4C88763415BABA30003D2CE9 /* PasswordWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C88763315BABA30003D2CE9 /* PasswordWindow.xib */; }; 4CAD742E15B8860800104512 /* AesInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAD73E615B8860800104512 /* AesInputStream.m */; }; 4CAD742F15B8860800104512 /* AesOutputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAD73E815B8860800104512 /* AesOutputStream.m */; }; 4CAD743015B8860800104512 /* Arc4RandomStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAD73EA15B8860800104512 /* Arc4RandomStream.m */; }; @@ -81,6 +82,7 @@ 4C77E37815B84A240093A587 /* MPAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPAppDelegate.h; sourceTree = ""; }; 4C77E37915B84A240093A587 /* MPAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPAppDelegate.m; sourceTree = ""; }; 4C77E37C15B84A240093A587 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; + 4C88763315BABA30003D2CE9 /* PasswordWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PasswordWindow.xib; sourceTree = ""; }; 4CAD73E515B8860800104512 /* AesInputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AesInputStream.h; sourceTree = ""; }; 4CAD73E615B8860800104512 /* AesInputStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AesInputStream.m; sourceTree = ""; }; 4CAD73E715B8860800104512 /* AesOutputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AesOutputStream.h; sourceTree = ""; }; @@ -195,6 +197,7 @@ children = ( 4C77E37B15B84A240093A587 /* MainMenu.xib */, 4C06398E15B980640004DE27 /* OutlineView.xib */, + 4C88763315BABA30003D2CE9 /* PasswordWindow.xib */, ); name = Views; sourceTree = ""; @@ -478,6 +481,7 @@ 4CAD748015B887FD00104512 /* LICENSE.txt in Resources */, 4CAD748115B887FD00104512 /* README.markdown in Resources */, 4C06398F15B980640004DE27 /* OutlineView.xib in Resources */, + 4C88763415BABA30003D2CE9 /* PasswordWindow.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MacPass/MPAppDelegate.m b/MacPass/MPAppDelegate.m index 30b0d758..61ed5ddc 100644 --- a/MacPass/MPAppDelegate.m +++ b/MacPass/MPAppDelegate.m @@ -34,7 +34,7 @@ NSString *const kOutlineViewIdentifier = @"OutlineView"; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - _database = [[MPDatabaseDocument alloc] initWithFile:nil andPassword:@""]; + //_database = [[MPDatabaseDocument alloc] initWithFile:NSURL password:<#(NSString *)#> keyfile:<#(NSURL *)#> _outlineDelegate = [[MPOutlineViewDelegate alloc] init]; _datasource = [[MPOutlineDataSource alloc] init]; diff --git a/MacPass/MPDatabaseDocument.h b/MacPass/MPDatabaseDocument.h index e252956f..22b8a848 100644 --- a/MacPass/MPDatabaseDocument.h +++ b/MacPass/MPDatabaseDocument.h @@ -10,7 +10,6 @@ @interface MPDatabaseDocument : NSObject -- (id)initWithFile:(NSURL *)file andPassword:(NSString *)password; -- (id)initWithFile:(NSURL *)file andKeyfile:(NSURL *)keyfile; +- (id)initWithFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key; @end diff --git a/MacPass/MPDatabaseDocument.m b/MacPass/MPDatabaseDocument.m index 24d380dd..2e11edc3 100644 --- a/MacPass/MPDatabaseDocument.m +++ b/MacPass/MPDatabaseDocument.m @@ -11,46 +11,39 @@ @interface MPDatabaseDocument () @property (retain) KdbTree *tree; -- (id)initWithFile:(NSURL *)file andKdbPassword:(KdbPassword *)password; @end @implementation MPDatabaseDocument @synthesize tree = _tree; -- (id)initWithFile:(NSURL *)file andKeyfile:(NSURL *)keyfile { - KdbPassword *password = [[KdbPassword alloc] initWithKeyfile:[keyfile path]]; - [self initWithFile:file andKdbPassword:password]; - [password release]; - return self; +- (id)init { + return [self initWithFile:nil password:nil keyfile:nil]; } -- (id)initWithFile:(NSURL *)file andPassword:(NSString *)password { - KdbPassword *kdbPassword = [[KdbPassword alloc] initWithPassword:password encoding:NSUTF8StringEncoding]; - [self initWithFile:file andKdbPassword:kdbPassword]; - [password release]; - return self; -} - -- (id)initWithFile:(NSURL *)file andKdbPassword:(KdbPassword *)password { +- (id)initWithFile:(NSURL *)file password:(NSString *)password keyfile:(NSURL *)key +{ self = [super init]; if (self) { - NSString *path = [file path]; - BOOL isReadable = [[NSFileManager defaultManager] isReadableFileAtPath:path]; - BOOL isDirectory = [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory]; - // We may need more tests - if(isReadable && NO == isDirectory) { - @try { - self.tree = [KdbReaderFactory load:[file path] withPassword:password]; + // test for supplied parameters + KdbPassword *kdbPassword = nil; + if( password != nil ) { + if( key != nil ) { + kdbPassword = [[KdbPassword alloc] initWithPassword:password encoding:NSUTF8StringEncoding keyfile:[key path]]; } - @catch (NSException *exception) { - // Log the error but proceede - NSLog(@"Could not load the Database at path:%@", file); + else { + kdbPassword = [[KdbPassword alloc] initWithPassword:password encoding:NSUTF8StringEncoding]; } } + + @try { + _tree = [KdbReaderFactory load:[file path] withPassword:kdbPassword]; + } + @catch (NSException *exception) { + // ignore + } } return self; } - @end diff --git a/MacPass/PasswordWindow.xib b/MacPass/PasswordWindow.xib new file mode 100644 index 00000000..a6a3d4f7 --- /dev/null +++ b/MacPass/PasswordWindow.xib @@ -0,0 +1,121 @@ + + + + 1070 + 11E53 + 2182 + 1138.47 + 569.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 2182 + + + NSWindowTemplate + NSView + NSCustomObject + + + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + + NSObject + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{196, 207}, {480, 270}} + 611845120 + Window + NSWindow + + + + + 256 + {480, 270} + + + _NS:20 + + {{0, 0}, {1920, 1058}} + {10000000000000, 10000000000000} + YES + + + + + + + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 293 + + + + + + + + 294 + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + 294 + + + 0 + IBCocoaFramework + YES + 3 + YES + + diff --git a/README.md b/README.md index 359a8d9f..b756b3e8 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,11 @@ MacPass ======= -There a lot of iOS KeePass Tools around but a distinct lack of a good OS X Version. -KeePass can be used as is via Mono on OS X but lacks vital Functionality. +There a lot of iOS KeePass tools around but a distinct lack of a good OS X Version. +KeePass can be used as is via Mono on OS X but lacks vital functionality. -This is a Attemtp to make create OS X port that should at least be able to read KeePass files. -Futher down the road there might be a complete port but. Maybe. - -Vital work is used in this Port. +This is an attemtp to create amn OS X port that should at least be able to read KeePass files. +Editing and synching capabilities might get added in the future. Licence ------- @@ -29,6 +27,8 @@ along with this program. If not, see . Copyright --------- +This Project is based upon the following work: + [KissXML](https://github.com/robbiehanson/KissXML) Copyright 2012 Robbie Hanson. All rights reserver. [MiniKeePass](https://github.com/MiniKeePass/MiniKeePass) Copyright 2011 Jason Rush and John Flanagan. All rights reserved.