mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 05:52:58 +00:00
Refactored password handling in Document. Now only the composite key is stored and not the plain password and key file URL. This for now breaks the change password dialog a bit. Needs to be addressed.
Started conceptualising for auto type functionality
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#import "KPKTestLegacyLoading.h"
|
||||
|
||||
#import "KPKTree+Serializing.h"
|
||||
#import "KPKPassword.h"
|
||||
#import "KPKCompositeKey.h"
|
||||
#import "KPKMetaData.h"
|
||||
#import "KPKIcon.h"
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
@implementation KPKTestLegacyLoading
|
||||
|
||||
- (void)testValidFile {
|
||||
KPKPassword *password = [[KPKPassword alloc] initWithPassword:@"1234" key:nil];
|
||||
KPKCompositeKey *password = [[KPKCompositeKey alloc] initWithPassword:@"1234" key:nil];
|
||||
NSData *data = [self _loadTestDataBase:@"Test_Password_1234" extension:@"kdb"];
|
||||
KPKTree *tree = [[KPKTree alloc] initWithData:data password:password error:NULL];
|
||||
STAssertNotNil(tree, @"Loading should result in a tree object");
|
||||
}
|
||||
|
||||
- (void)testWrongPassword {
|
||||
KPKPassword *password = [[KPKPassword alloc] initWithPassword:@"wrongPassword" key:nil];
|
||||
KPKCompositeKey *password = [[KPKCompositeKey alloc] initWithPassword:@"wrongPassword" key:nil];
|
||||
NSData *data = [self _loadTestDataBase:@"KeePass1_native_test" extension:@"kdb"];
|
||||
NSError *error;
|
||||
KPKTree *tree = [[KPKTree alloc] initWithData:data password:password error:&error];
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
- (void)testMetaParsing {
|
||||
NSData *data = [self _loadTestDataBase:@"KDB1_KeePassX_test" extension:@"kdb"];
|
||||
KPKPassword *password = [[KPKPassword alloc] initWithPassword:@"test" key:nil];
|
||||
KPKCompositeKey *password = [[KPKCompositeKey alloc] initWithPassword:@"test" key:nil];
|
||||
KPKTree *tree = [[KPKTree alloc] initWithData:data password:password error:NULL];
|
||||
STAssertNotNil(tree, @"Tree shoudl be loaded" );
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
@class KPKPassword;
|
||||
@class KPKCompositeKey;
|
||||
|
||||
@interface KPKTestLegacyWriting : SenTestCase
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#import "KPKTestLegacyWriting.h"
|
||||
|
||||
#import "KPKPassword.h"
|
||||
#import "KPKCompositeKey.h"
|
||||
#import "KPKTree+Serializing.h"
|
||||
|
||||
@implementation KPKTestLegacyWriting
|
||||
@@ -16,7 +16,7 @@
|
||||
- (void)testWriting {
|
||||
NSError __autoreleasing *error = nil;
|
||||
NSURL *dbUrl = [self _urlForFile:@"CustomIcon_Password_1234" extension:@"kdbx"];
|
||||
KPKPassword *password = [[KPKPassword alloc] initWithPassword:@"1234" key:nil];
|
||||
KPKCompositeKey *password = [[KPKCompositeKey alloc] initWithPassword:@"1234" key:nil];
|
||||
KPKTree *tree = [[KPKTree alloc] initWithContentsOfUrl:dbUrl password:password error:&error];
|
||||
STAssertNotNil(tree, @"Tree should be created");
|
||||
error = nil;
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
//
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
@class KPKPassword;
|
||||
@class KPKCompositeKey;
|
||||
|
||||
@interface KPKTestXmlLoading : SenTestCase {
|
||||
@private
|
||||
NSData *_data;
|
||||
KPKPassword *_password;
|
||||
KPKCompositeKey *_password;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
|
||||
#import "KPKTestXmlLoading.h"
|
||||
#import "KPKPassword.h"
|
||||
#import "KPKCompositeKey.h"
|
||||
|
||||
#import "KPKTree+Serializing.h"
|
||||
#import "KPKEntry.h"
|
||||
@@ -19,7 +19,7 @@
|
||||
NSBundle *myBundle = [NSBundle bundleForClass:[self class]];
|
||||
NSURL *url = [myBundle URLForResource:@"Test_Password_1234" withExtension:@"kdbx"];
|
||||
_data = [NSData dataWithContentsOfURL:url];
|
||||
_password = [[KPKPassword alloc] initWithPassword:@"1234" key:nil];
|
||||
_password = [[KPKCompositeKey alloc] initWithPassword:@"1234" key:nil];
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
@@ -39,7 +39,7 @@
|
||||
- (void)testAutotypeLoading {
|
||||
NSBundle *myBundle = [NSBundle bundleForClass:[self class]];
|
||||
NSURL *url = [myBundle URLForResource:@"Autotype_test" withExtension:@"kdbx"];
|
||||
KPKPassword *password = [[KPKPassword alloc] initWithPassword:@"test" key:nil];
|
||||
KPKCompositeKey *password = [[KPKCompositeKey alloc] initWithPassword:@"test" key:nil];
|
||||
NSError *error;
|
||||
KPKTree *tree = [[KPKTree alloc] initWithContentsOfUrl:url password:password error:&error];
|
||||
STAssertNotNil(tree, @"Tree shoud be loaded");
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
|
||||
#import "KPKTestXmlWriting.h"
|
||||
#import "KPKPassword.h"
|
||||
#import "KPKCompositeKey.h"
|
||||
#import "KPKTree+Serializing.h"
|
||||
|
||||
@implementation KPKTestXmlWriting
|
||||
@@ -15,7 +15,7 @@
|
||||
- (void)testXmlWriting {
|
||||
NSData *data = [self _loadTestDataBase:@"CustomIcon_Password_1234" extension:@"kdbx"];
|
||||
NSError *error;
|
||||
KPKPassword *password = [[KPKPassword alloc] initWithPassword:@"1234" key:nil];
|
||||
KPKCompositeKey *password = [[KPKCompositeKey alloc] initWithPassword:@"1234" key:nil];
|
||||
KPKTree *tree = [[KPKTree alloc] initWithData:data password:password error:&error];
|
||||
error = nil;
|
||||
NSData *saveData = [tree encryptWithPassword:password forVersion:KPKXmlVersion error:&error];
|
||||
|
||||
Reference in New Issue
Block a user