Fixed error when setting an empty password.

Fixed error that ignored the keyfile
This commit is contained in:
michael starke
2013-06-25 13:28:13 +02:00
parent 93627a234f
commit e644370b02
4 changed files with 13 additions and 6 deletions

View File

@@ -103,7 +103,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
#pragma mark Protection
- (BOOL)decryptWithPassword:(NSString *)password keyFileURL:(NSURL *)keyFileURL {
self.password = password;
self.key = keyFileURL;
self.password = [password length] > 0 ? password : nil;
@try {
self.tree = [KdbReaderFactory load:[[self fileURL] path] withPassword:self.passwordHash];
}
@@ -139,8 +140,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
}
- (KdbPassword *)passwordHash {
// TODO: Use defaults to determine Encoding?
return [[[KdbPassword alloc] initWithPassword:self.password passwordEncoding:NSUTF8StringEncoding keyFile:[self.key path]] autorelease];
return [[[KdbPassword alloc] initWithPassword:self.password passwordEncoding:NSUTF8StringEncoding keyFileURL:self.key] autorelease];
}
+ (BOOL)autosavesInPlace

View File

@@ -52,7 +52,13 @@
MPDocument *document = [[NSDocumentController sharedDocumentController] documentForWindow:[[self view] window]];
if(document) {
document.key = [self.keyfilePathControl URL];
document.password = [self.passwordTextField stringValue];
NSString *password = [self.passwordTextField stringValue];
if([password length] > 0) {
document.password = password;
}
else {
document.password = nil;
}
}
id mainWindowController = [[[self view] window] windowController];
[mainWindowController showEntries];

View File

@@ -48,7 +48,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1065</string>
<string>1090</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>