Update for prefixed Pearl.
This commit is contained in:
parent
f3196841f3
commit
50da5c0cb1
2
External/Pearl
vendored
2
External/Pearl
vendored
@ -1 +1 @@
|
|||||||
Subproject commit f1b86c1c9768e7f4f5ec4dd4196410c9d94d214d
|
Subproject commit bb0df3e88994972fe2af336c823211493a427139
|
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
@interface MPAppDelegate : AbstractAppDelegate
|
@interface MPAppDelegate : PearlAppDelegate
|
||||||
|
|
||||||
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
|
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
|
||||||
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
|
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
+ (void)initialize {
|
+ (void)initialize {
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
[Logger get].autoprintLevel = LogLevelTrace;
|
[PearlLogger get].autoprintLevel = PearlLogLevelTrace;
|
||||||
[NSClassFromString(@"WebView") performSelector:@selector(_enableRemoteInspector)];
|
[NSClassFromString(@"WebView") performSelector:@selector(_enableRemoteInspector)];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
static NSDictionary *MPKeyPhraseQuery = nil;
|
static NSDictionary *MPKeyPhraseQuery = nil;
|
||||||
if (!MPKeyPhraseQuery)
|
if (!MPKeyPhraseQuery)
|
||||||
MPKeyPhraseQuery = [KeyChain createQueryForClass:kSecClassGenericPassword
|
MPKeyPhraseQuery = [PearlKeyChain createQueryForClass:kSecClassGenericPassword
|
||||||
attributes:[NSDictionary dictionaryWithObject:@"MasterPassword"
|
attributes:[NSDictionary dictionaryWithObject:@"MasterPassword"
|
||||||
forKey:(__bridge id)kSecAttrService]
|
forKey:(__bridge id)kSecAttrService]
|
||||||
matches:nil];
|
matches:nil];
|
||||||
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
static NSDictionary *MPKeyPhraseHashQuery = nil;
|
static NSDictionary *MPKeyPhraseHashQuery = nil;
|
||||||
if (!MPKeyPhraseHashQuery)
|
if (!MPKeyPhraseHashQuery)
|
||||||
MPKeyPhraseHashQuery = [KeyChain createQueryForClass:kSecClassGenericPassword
|
MPKeyPhraseHashQuery = [PearlKeyChain createQueryForClass:kSecClassGenericPassword
|
||||||
attributes:[NSDictionary dictionaryWithObject:@"MasterPasswordHash"
|
attributes:[NSDictionary dictionaryWithObject:@"MasterPasswordHash"
|
||||||
forKey:(__bridge id)kSecAttrService]
|
forKey:(__bridge id)kSecAttrService]
|
||||||
matches:nil];
|
matches:nil];
|
||||||
@ -77,8 +77,8 @@
|
|||||||
[NSNumber numberWithBool:NO], @"logToSTDERR",
|
[NSNumber numberWithBool:NO], @"logToSTDERR",
|
||||||
nil]];
|
nil]];
|
||||||
[TestFlight passCheckpoint:MPTestFlightCheckpointLaunched];
|
[TestFlight passCheckpoint:MPTestFlightCheckpointLaunched];
|
||||||
[[Logger get] registerListener:^BOOL(LogMessage *message) {
|
[[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) {
|
||||||
if (message.level >= LogLevelInfo)
|
if (message.level >= PearlLogLevelInfo)
|
||||||
TFLog(@"%@", message);
|
TFLog(@"%@", message);
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
@ -203,7 +203,7 @@
|
|||||||
- (void)forgetKeyPhrase {
|
- (void)forgetKeyPhrase {
|
||||||
|
|
||||||
dbg(@"Forgetting key phrase.");
|
dbg(@"Forgetting key phrase.");
|
||||||
[AlertViewController showAlertWithTitle:@"Changing Master Password"
|
[PearlAlert showAlertWithTitle:@"Changing Master Password"
|
||||||
message:
|
message:
|
||||||
@"You've requested to change your master password.\n\n"
|
@"You've requested to change your master password.\n\n"
|
||||||
@"If you continue, your current sites and passwords will become unavailable.\n\n"
|
@"If you continue, your current sites and passwords will become unavailable.\n\n"
|
||||||
@ -214,8 +214,8 @@
|
|||||||
if (buttonIndex != [alert cancelButtonIndex]) {
|
if (buttonIndex != [alert cancelButtonIndex]) {
|
||||||
// Key phrase reset. Delete it.
|
// Key phrase reset. Delete it.
|
||||||
dbg(@"Deleting master key phrase and hash from key chain.");
|
dbg(@"Deleting master key phrase and hash from key chain.");
|
||||||
[KeyChain deleteItemForQuery:[MPAppDelegate keyPhraseQuery]];
|
[PearlKeyChain deleteItemForQuery:[MPAppDelegate keyPhraseQuery]];
|
||||||
[KeyChain deleteItemForQuery:[MPAppDelegate keyPhraseHashQuery]];
|
[PearlKeyChain deleteItemForQuery:[MPAppDelegate keyPhraseHashQuery]];
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationKeyForgotten object:self];
|
[[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationKeyForgotten object:self];
|
||||||
#ifndef PRODUCTION
|
#ifndef PRODUCTION
|
||||||
@ -239,12 +239,12 @@
|
|||||||
if ([[MPConfig get].storeKeyPhrase boolValue]) {
|
if ([[MPConfig get].storeKeyPhrase boolValue]) {
|
||||||
// Key phrase is stored in keychain. Load it.
|
// Key phrase is stored in keychain. Load it.
|
||||||
dbg(@"Loading master key phrase from key chain.");
|
dbg(@"Loading master key phrase from key chain.");
|
||||||
self.keyPhrase = [KeyChain dataOfItemForQuery:[MPAppDelegate keyPhraseQuery]];
|
self.keyPhrase = [PearlKeyChain dataOfItemForQuery:[MPAppDelegate keyPhraseQuery]];
|
||||||
dbg(@" -> Master key phrase %@.", self.keyPhrase? @"found": @"NOT found");
|
dbg(@" -> Master key phrase %@.", self.keyPhrase? @"found": @"NOT found");
|
||||||
} else {
|
} else {
|
||||||
// Key phrase should not be stored in keychain. Delete it.
|
// Key phrase should not be stored in keychain. Delete it.
|
||||||
dbg(@"Deleting master key phrase from key chain.");
|
dbg(@"Deleting master key phrase from key chain.");
|
||||||
[KeyChain deleteItemForQuery:[MPAppDelegate keyPhraseQuery]];
|
[PearlKeyChain deleteItemForQuery:[MPAppDelegate keyPhraseQuery]];
|
||||||
#ifndef PRODUCTION
|
#ifndef PRODUCTION
|
||||||
[TestFlight passCheckpoint:MPTestFlightCheckpointMPUnstored];
|
[TestFlight passCheckpoint:MPTestFlightCheckpointMPUnstored];
|
||||||
#endif
|
#endif
|
||||||
@ -303,7 +303,7 @@
|
|||||||
|
|
||||||
- (BOOL)tryMasterPassword:(NSString *)tryPassword {
|
- (BOOL)tryMasterPassword:(NSString *)tryPassword {
|
||||||
|
|
||||||
NSData *keyPhraseHash = [KeyChain dataOfItemForQuery:[MPAppDelegate keyPhraseHashQuery]];
|
NSData *keyPhraseHash = [PearlKeyChain dataOfItemForQuery:[MPAppDelegate keyPhraseHashQuery]];
|
||||||
dbg(@"Key phrase hash %@.", keyPhraseHash? @"known": @"NOT known");
|
dbg(@"Key phrase hash %@.", keyPhraseHash? @"known": @"NOT known");
|
||||||
|
|
||||||
if (![tryPassword length])
|
if (![tryPassword length])
|
||||||
@ -345,14 +345,14 @@
|
|||||||
self.keyPhraseHashHex = [self.keyPhraseHash encodeHex];
|
self.keyPhraseHashHex = [self.keyPhraseHash encodeHex];
|
||||||
|
|
||||||
dbg(@"Updating master key phrase hash to: %@.", self.keyPhraseHashHex);
|
dbg(@"Updating master key phrase hash to: %@.", self.keyPhraseHashHex);
|
||||||
[KeyChain addOrUpdateItemForQuery:[MPAppDelegate keyPhraseHashQuery]
|
[PearlKeyChain addOrUpdateItemForQuery:[MPAppDelegate keyPhraseHashQuery]
|
||||||
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
self.keyPhraseHash, (__bridge id)kSecValueData,
|
self.keyPhraseHash, (__bridge id)kSecValueData,
|
||||||
kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible,
|
kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible,
|
||||||
nil]];
|
nil]];
|
||||||
if ([[MPConfig get].storeKeyPhrase boolValue]) {
|
if ([[MPConfig get].storeKeyPhrase boolValue]) {
|
||||||
dbg(@"Storing master key phrase in key chain.");
|
dbg(@"Storing master key phrase in key chain.");
|
||||||
[KeyChain addOrUpdateItemForQuery:[MPAppDelegate keyPhraseQuery]
|
[PearlKeyChain addOrUpdateItemForQuery:[MPAppDelegate keyPhraseQuery]
|
||||||
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
keyPhrase, (__bridge id)kSecValueData,
|
keyPhrase, (__bridge id)kSecValueData,
|
||||||
kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible,
|
kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible,
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// Copyright (c) 2012 Lyndir. All rights reserved.
|
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
@interface MPConfig : Config
|
@interface MPConfig : PearlConfig
|
||||||
|
|
||||||
@property (nonatomic, retain) NSNumber *dataStoreError;
|
@property (nonatomic, retain) NSNumber *dataStoreError;
|
||||||
@property (nonatomic, retain) NSNumber *storeKeyPhrase;
|
@property (nonatomic, retain) NSNumber *storeKeyPhrase;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
+ (NSDictionary *)queryForDevicePrivateElementNamed:(NSString *)name {
|
+ (NSDictionary *)queryForDevicePrivateElementNamed:(NSString *)name {
|
||||||
|
|
||||||
return [KeyChain createQueryForClass:kSecClassGenericPassword
|
return [PearlKeyChain createQueryForClass:kSecClassGenericPassword
|
||||||
attributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
attributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
@"DevicePrivate", (__bridge id)kSecAttrService,
|
@"DevicePrivate", (__bridge id)kSecAttrService,
|
||||||
name, (__bridge id)kSecAttrAccount,
|
name, (__bridge id)kSecAttrAccount,
|
||||||
@ -35,22 +35,22 @@
|
|||||||
|
|
||||||
NSData *encryptedContent;
|
NSData *encryptedContent;
|
||||||
if (self.type == MPElementTypeStoredDevicePrivate)
|
if (self.type == MPElementTypeStoredDevicePrivate)
|
||||||
encryptedContent = [KeyChain dataOfItemForQuery:[MPElementStoredEntity queryForDevicePrivateElementNamed:self.name]];
|
encryptedContent = [PearlKeyChain dataOfItemForQuery:[MPElementStoredEntity queryForDevicePrivateElementNamed:self.name]];
|
||||||
else
|
else
|
||||||
encryptedContent = self.contentObject;
|
encryptedContent = self.contentObject;
|
||||||
|
|
||||||
NSData *decryptedContent = [encryptedContent decryptWithSymmetricKey:[[MPAppDelegate get] keyPhraseWithLength:kCipherKeySize]
|
NSData *decryptedContent = [encryptedContent decryptWithSymmetricKey:[[MPAppDelegate get] keyPhraseWithLength:PearlCryptKeySize]
|
||||||
usePadding:YES];
|
usePadding:YES];
|
||||||
return [[NSString alloc] initWithBytes:decryptedContent.bytes length:decryptedContent.length encoding:NSUTF8StringEncoding];
|
return [[NSString alloc] initWithBytes:decryptedContent.bytes length:decryptedContent.length encoding:NSUTF8StringEncoding];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setContent:(id)content {
|
- (void)setContent:(id)content {
|
||||||
|
|
||||||
NSData *encryptedContent = [[content description] encryptWithSymmetricKey:[[MPAppDelegate get] keyPhraseWithLength:kCipherKeySize]
|
NSData *encryptedContent = [[content description] encryptWithSymmetricKey:[[MPAppDelegate get] keyPhraseWithLength:PearlCryptKeySize]
|
||||||
usePadding:YES];
|
usePadding:YES];
|
||||||
|
|
||||||
if (self.type == MPElementTypeStoredDevicePrivate) {
|
if (self.type == MPElementTypeStoredDevicePrivate) {
|
||||||
[KeyChain addOrUpdateItemForQuery:[MPElementStoredEntity queryForDevicePrivateElementNamed:self.name]
|
[PearlKeyChain addOrUpdateItemForQuery:[MPElementStoredEntity queryForDevicePrivateElementNamed:self.name]
|
||||||
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
encryptedContent, (__bridge id)kSecValueData,
|
encryptedContent, (__bridge id)kSecValueData,
|
||||||
kSecAttrAccessibleWhenUnlockedThisDeviceOnly, (__bridge id)kSecAttrAccessible,
|
kSecAttrAccessibleWhenUnlockedThisDeviceOnly, (__bridge id)kSecAttrAccessible,
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
[UIUtils autoSizeContent:self.scrollView];
|
[PearlUIUtils autoSizeContent:self.scrollView];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewWillDisappear:(BOOL)animated {
|
- (void)viewWillDisappear:(BOOL)animated {
|
||||||
|
@ -333,7 +333,7 @@
|
|||||||
|
|
||||||
- (IBAction)action:(id)sender {
|
- (IBAction)action:(id)sender {
|
||||||
|
|
||||||
[SheetViewController showSheetWithTitle:nil message:nil viewStyle:UIActionSheetStyleAutomatic
|
[PearlSheet showSheetWithTitle:nil message:nil viewStyle:UIActionSheetStyleAutomatic
|
||||||
tappedButtonBlock:^(UIActionSheet *sheet, NSInteger buttonIndex) {
|
tappedButtonBlock:^(UIActionSheet *sheet, NSInteger buttonIndex) {
|
||||||
if (buttonIndex == [sheet cancelButtonIndex])
|
if (buttonIndex == [sheet cancelButtonIndex])
|
||||||
return;
|
return;
|
||||||
|
@ -251,7 +251,7 @@
|
|||||||
else {
|
else {
|
||||||
// "New" section.
|
// "New" section.
|
||||||
NSString *siteName = self.query;
|
NSString *siteName = self.query;
|
||||||
[AlertViewController showAlertWithTitle:@"New Site"
|
[PearlAlert showAlertWithTitle:@"New Site"
|
||||||
message:l(@"Do you want to create a new site named:\n%@", siteName)
|
message:l(@"Do you want to create a new site named:\n%@", siteName)
|
||||||
viewStyle:UIAlertViewStyleDefault
|
viewStyle:UIAlertViewStyleDefault
|
||||||
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
NSData *keyPhraseForPassword(NSString *password) {
|
NSData *keyPhraseForPassword(NSString *password) {
|
||||||
|
|
||||||
return [SCrypt deriveKeyWithLength:MP_dkLen fromPassword:[password dataUsingEncoding:NSUTF8StringEncoding]
|
return [PearlSCrypt deriveKeyWithLength:MP_dkLen fromPassword:[password dataUsingEncoding:NSUTF8StringEncoding]
|
||||||
usingSalt:MP_salt N:MP_N r:MP_r p:MP_p];
|
usingSalt:MP_salt N:MP_N r:MP_r p:MP_p];
|
||||||
}
|
}
|
||||||
NSData *keyPhraseHashForPassword(NSString *password) {
|
NSData *keyPhraseHashForPassword(NSString *password) {
|
||||||
|
@ -880,7 +880,7 @@ L4m3P4sSw0rD</string>
|
|||||||
</class>
|
</class>
|
||||||
</classes>
|
</classes>
|
||||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||||
<simulatedStatusBarMetrics key="statusBar" statusBarStyle="blackTranslucent"/>
|
<nil key="statusBar"/>
|
||||||
<simulatedOrientationMetrics key="orientation"/>
|
<simulatedOrientationMetrics key="orientation"/>
|
||||||
<simulatedScreenMetrics key="destination"/>
|
<simulatedScreenMetrics key="destination"/>
|
||||||
</simulatedMetricsContainer>
|
</simulatedMetricsContainer>
|
||||||
|
Loading…
Reference in New Issue
Block a user