Updated KeePassKit submodule

Added save to Kdbx test
This commit is contained in:
michael starke
2013-08-20 03:30:57 +02:00
parent f80226ee6c
commit e8124b0415
4 changed files with 51 additions and 1 deletions

View File

@@ -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 <SenTestingKit/SenTestingKit.h>
@interface KPKTestXmlWriting : SenTestCase
@end

View File

@@ -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