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