diff --git a/KeePassKit b/KeePassKit index 88e6f34a..1c450910 160000 --- a/KeePassKit +++ b/KeePassKit @@ -1 +1 @@ -Subproject commit 88e6f34a06b10f79ca1e9b352da51cf02b750880 +Subproject commit 1c450910bebdcacb1e209b599de9c7651e4997ba diff --git a/MacPass.xcodeproj/project.pbxproj b/MacPass.xcodeproj/project.pbxproj index e235a3a5..8f03e278 100644 --- a/MacPass.xcodeproj/project.pbxproj +++ b/MacPass.xcodeproj/project.pbxproj @@ -247,6 +247,7 @@ 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 */; }; + 4CBA561617C2EA4900CE13D3 /* KPKTestXmlWriting.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CBA561517C2EA4900CE13D3 /* KPKTestXmlWriting.m */; }; 4CC0D2CE17974A47000B4BDA /* MPCustomFieldTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC0D2CD17974A47000B4BDA /* MPCustomFieldTableViewDelegate.m */; }; 4CC0D2D117974A5A000B4BDA /* MPAttachmentTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC0D2D017974A5A000B4BDA /* MPAttachmentTableViewDelegate.m */; }; 4CC1AEBE16D4467C006D2AAB /* KdbTree+MPAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC1AEBD16D4467C006D2AAB /* KdbTree+MPAdditions.m */; }; @@ -756,6 +757,8 @@ 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 = ""; }; + 4CBA561417C2EA4900CE13D3 /* KPKTestXmlWriting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KPKTestXmlWriting.h; sourceTree = ""; }; + 4CBA561517C2EA4900CE13D3 /* KPKTestXmlWriting.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KPKTestXmlWriting.m; sourceTree = ""; }; 4CC0D2CC17974A47000B4BDA /* MPCustomFieldTableViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPCustomFieldTableViewDelegate.h; sourceTree = ""; }; 4CC0D2CD17974A47000B4BDA /* MPCustomFieldTableViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPCustomFieldTableViewDelegate.m; sourceTree = ""; }; 4CC0D2CF17974A5A000B4BDA /* MPAttachmentTableViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAttachmentTableViewDelegate.h; sourceTree = ""; }; @@ -1302,6 +1305,8 @@ 4CEAF85A17BA9B44001307A6 /* KPKTestKeyfileParsing.m */, 4C6FDD1F17BC4F4C004AEEC8 /* KPKTestPlaceholder.h */, 4C6FDD2017BC4F4C004AEEC8 /* KPKTestPlaceholder.m */, + 4CBA561417C2EA4900CE13D3 /* KPKTestXmlWriting.h */, + 4CBA561517C2EA4900CE13D3 /* KPKTestXmlWriting.m */, ); path = MacPassTests; sourceTree = ""; @@ -2062,6 +2067,7 @@ 4CE76DAD17B3AD010043B82B /* KPKHashedDataTest.m in Sources */, 4CEAF85B17BA9B44001307A6 /* KPKTestKeyfileParsing.m in Sources */, 4C6FDD2117BC4F4C004AEEC8 /* KPKTestPlaceholder.m in Sources */, + 4CBA561617C2EA4900CE13D3 /* KPKTestXmlWriting.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MacPassTests/KPKTestXmlWriting.h b/MacPassTests/KPKTestXmlWriting.h new file mode 100644 index 00000000..8421e726 --- /dev/null +++ b/MacPassTests/KPKTestXmlWriting.h @@ -0,0 +1,13 @@ +// +// KPKTestXmlWriting.h +// MacPass +// +// Created by Michael Starke on 20.08.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import + +@interface KPKTestXmlWriting : SenTestCase + +@end diff --git a/MacPassTests/KPKTestXmlWriting.m b/MacPassTests/KPKTestXmlWriting.m new file mode 100644 index 00000000..3efbe606 --- /dev/null +++ b/MacPassTests/KPKTestXmlWriting.m @@ -0,0 +1,31 @@ +// +// KPKTestXmlWriting.m +// MacPass +// +// Created by Michael Starke on 20.08.13. +// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved. +// + +#import "KPKTestXmlWriting.h" +#import "KPKPassword.h" +#import "KPKTree+Serializing.h" + +@implementation KPKTestXmlWriting + +- (void)testXmlWriting { + NSData *data = [self _loadTestDataBase:@"CustomIcon_Password_1234" extension:@"kdbx"]; + NSError *error; + KPKPassword *password = [[KPKPassword 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]; + //[saveData writeToFile:@"CustomIcon_Password_1234_save.kdbx" atomically:YES]; +} + +- (NSData *)_loadTestDataBase:(NSString *)name extension:(NSString *)extension { + NSBundle *myBundle = [NSBundle bundleForClass:[self class]]; + NSURL *url = [myBundle URLForResource:name withExtension:extension]; + return [NSData dataWithContentsOfURL:url]; +} + +@end