2
0

Stored passwords completed.

[FIXED]     Lock keychain items while device is locked.
[ADDED]     Implemented Device-Private passwords by storing them in the
            keychain.
[ADDED]     Implemented encryption for stored passwords.
This commit is contained in:
Maarten Billemont 2012-02-05 10:31:08 +01:00
parent 7c36ff6acd
commit 018a544cfe
46 changed files with 206 additions and 17 deletions

View File

@ -204,6 +204,7 @@
DA84819514CB521E00A2FA22 /* tip_location_teal.png in Resources */ = {isa = PBXBuildFile; fileRef = DA84817714CB521E00A2FA22 /* tip_location_teal.png */; }; DA84819514CB521E00A2FA22 /* tip_location_teal.png in Resources */ = {isa = PBXBuildFile; fileRef = DA84817714CB521E00A2FA22 /* tip_location_teal.png */; };
DA84819614CB521E00A2FA22 /* tip_location_wood.png in Resources */ = {isa = PBXBuildFile; fileRef = DA84817814CB521E00A2FA22 /* tip_location_wood.png */; }; DA84819614CB521E00A2FA22 /* tip_location_wood.png in Resources */ = {isa = PBXBuildFile; fileRef = DA84817814CB521E00A2FA22 /* tip_location_wood.png */; };
DA8E8E4614DD7C1D0044257E /* logo-bare.png in Resources */ = {isa = PBXBuildFile; fileRef = DA8E8E4514DD7C1D0044257E /* logo-bare.png */; }; DA8E8E4614DD7C1D0044257E /* logo-bare.png in Resources */ = {isa = PBXBuildFile; fileRef = DA8E8E4514DD7C1D0044257E /* logo-bare.png */; };
DA8E8E5114DE78C20044257E /* OPMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DA8E8E5014DE78C20044257E /* OPMenuViewController.m */; };
DAA3B68E14CCCEE700F35AF6 /* icon_addressbook-person@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DAA3B53814CCCEE700F35AF6 /* icon_addressbook-person@2x.png */; }; DAA3B68E14CCCEE700F35AF6 /* icon_addressbook-person@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DAA3B53814CCCEE700F35AF6 /* icon_addressbook-person@2x.png */; };
DAA3B68F14CCCEE700F35AF6 /* icon_addressbook.png in Resources */ = {isa = PBXBuildFile; fileRef = DAA3B53914CCCEE700F35AF6 /* icon_addressbook.png */; }; DAA3B68F14CCCEE700F35AF6 /* icon_addressbook.png in Resources */ = {isa = PBXBuildFile; fileRef = DAA3B53914CCCEE700F35AF6 /* icon_addressbook.png */; };
DAA3B69014CCCEE700F35AF6 /* icon_addressbook@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DAA3B53A14CCCEE700F35AF6 /* icon_addressbook@2x.png */; }; DAA3B69014CCCEE700F35AF6 /* icon_addressbook@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DAA3B53A14CCCEE700F35AF6 /* icon_addressbook@2x.png */; };
@ -907,6 +908,8 @@
DA84817814CB521E00A2FA22 /* tip_location_wood.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tip_location_wood.png; sourceTree = "<group>"; }; DA84817814CB521E00A2FA22 /* tip_location_wood.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tip_location_wood.png; sourceTree = "<group>"; };
DA8E8E4514DD7C1D0044257E /* logo-bare.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "logo-bare.png"; path = "Resources/logo-bare.png"; sourceTree = "<group>"; }; DA8E8E4514DD7C1D0044257E /* logo-bare.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "logo-bare.png"; path = "Resources/logo-bare.png"; sourceTree = "<group>"; };
DA8E8E4714DDA62D0044257E /* MasterPassword.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = MasterPassword.entitlements; sourceTree = "<group>"; }; DA8E8E4714DDA62D0044257E /* MasterPassword.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = MasterPassword.entitlements; sourceTree = "<group>"; };
DA8E8E4F14DE78C20044257E /* OPMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OPMenuViewController.h; sourceTree = "<group>"; };
DA8E8E5014DE78C20044257E /* OPMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OPMenuViewController.m; sourceTree = "<group>"; };
DAA3B53814CCCEE700F35AF6 /* icon_addressbook-person@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_addressbook-person@2x.png"; sourceTree = "<group>"; }; DAA3B53814CCCEE700F35AF6 /* icon_addressbook-person@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_addressbook-person@2x.png"; sourceTree = "<group>"; };
DAA3B53914CCCEE700F35AF6 /* icon_addressbook.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon_addressbook.png; sourceTree = "<group>"; }; DAA3B53914CCCEE700F35AF6 /* icon_addressbook.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon_addressbook.png; sourceTree = "<group>"; };
DAA3B53A14CCCEE700F35AF6 /* icon_addressbook@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_addressbook@2x.png"; sourceTree = "<group>"; }; DAA3B53A14CCCEE700F35AF6 /* icon_addressbook@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_addressbook@2x.png"; sourceTree = "<group>"; };
@ -1825,6 +1828,8 @@
DAE2C646148247E500BA6B10 /* OPTypeViewController.m */, DAE2C646148247E500BA6B10 /* OPTypeViewController.m */,
DA55B29C14B38272001131B7 /* OPContentViewController.h */, DA55B29C14B38272001131B7 /* OPContentViewController.h */,
DA55B29D14B38272001131B7 /* OPContentViewController.m */, DA55B29D14B38272001131B7 /* OPContentViewController.m */,
DA8E8E4F14DE78C20044257E /* OPMenuViewController.h */,
DA8E8E5014DE78C20044257E /* OPMenuViewController.m */,
DA34DA1414B1BEA100F721C1 /* OPTypes.h */, DA34DA1414B1BEA100F721C1 /* OPTypes.h */,
DA34DA1514B1BEA100F721C1 /* OPTypes.m */, DA34DA1514B1BEA100F721C1 /* OPTypes.m */,
DA007F5014B24DCC00251337 /* OPConfig.h */, DA007F5014B24DCC00251337 /* OPConfig.h */,
@ -3040,6 +3045,7 @@
DA0A848C14C4DFCB0090EA8E /* OPElementGeneratedEntity.m in Sources */, DA0A848C14C4DFCB0090EA8E /* OPElementGeneratedEntity.m in Sources */,
DAA3B81414CDC77100F35AF6 /* jquery-1.6.1.min.js in Sources */, DAA3B81414CDC77100F35AF6 /* jquery-1.6.1.min.js in Sources */,
DA65570614D731F000841C99 /* OPGuideViewController.m in Sources */, DA65570614D731F000841C99 /* OPGuideViewController.m in Sources */,
DA8E8E5114DE78C20044257E /* OPMenuViewController.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -241,7 +241,7 @@ The passwords aren't saved anywhere. This is a major advantage: if you loose yo
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<rect key="contentStretch" x="0.10000000000000001" y="0.20000000000000001" width="0.79999999999999982" height="0.59999999999999964"/> <rect key="contentStretch" x="0.10000000000000001" y="0.20000000000000001" width="0.79999999999999982" height="0.59999999999999964"/>
</imageView> </imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Personal" lineBreakMode="tailTruncation" minimumFontSize="10" id="kzc-rQ-74F"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Personal Password" lineBreakMode="tailTruncation" minimumFontSize="10" id="kzc-rQ-74F">
<rect key="frame" x="20" y="120" width="280" height="24"/> <rect key="frame" x="20" y="120" width="280" height="24"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" name="GillSans" family="Gill Sans" pointSize="18"/> <fontDescription key="fontDescription" name="GillSans" family="Gill Sans" pointSize="18"/>
@ -250,7 +250,7 @@ The passwords aren't saved anywhere. This is a major advantage: if you loose yo
<color key="shadowColor" cocoaTouchSystemColor="darkTextColor"/> <color key="shadowColor" cocoaTouchSystemColor="darkTextColor"/>
<size key="shadowOffset" width="0.0" height="1"/> <size key="shadowOffset" width="0.0" height="1"/>
</label> </label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="AES-encrypted, backed up with iTunes/iCloud." lineBreakMode="tailTruncation" minimumFontSize="10" id="vNa-Yq-XIJ"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="AES-encrypted, iTunes backup, iCloud sync." lineBreakMode="tailTruncation" minimumFontSize="10" id="vNa-Yq-XIJ">
<rect key="frame" x="20" y="144" width="280" height="20"/> <rect key="frame" x="20" y="144" width="280" height="20"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" name="GillSans-Light" family="Gill Sans" pointSize="14"/> <fontDescription key="fontDescription" name="GillSans-Light" family="Gill Sans" pointSize="14"/>
@ -274,7 +274,7 @@ The passwords aren't saved anywhere. This is a major advantage: if you loose yo
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<rect key="contentStretch" x="0.10000000000000001" y="0.20000000000000001" width="0.79999999999999982" height="0.59999999999999964"/> <rect key="contentStretch" x="0.10000000000000001" y="0.20000000000000001" width="0.79999999999999982" height="0.59999999999999964"/>
</imageView> </imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Device Private" lineBreakMode="tailTruncation" minimumFontSize="10" id="2kB-0P-FeR"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Device Private Password" lineBreakMode="tailTruncation" minimumFontSize="10" id="2kB-0P-FeR">
<rect key="frame" x="20" y="0.0" width="280" height="24"/> <rect key="frame" x="20" y="0.0" width="280" height="24"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" name="GillSans" family="Gill Sans" pointSize="18"/> <fontDescription key="fontDescription" name="GillSans" family="Gill Sans" pointSize="18"/>
@ -283,7 +283,7 @@ The passwords aren't saved anywhere. This is a major advantage: if you loose yo
<color key="shadowColor" cocoaTouchSystemColor="darkTextColor"/> <color key="shadowColor" cocoaTouchSystemColor="darkTextColor"/>
<size key="shadowOffset" width="0.0" height="1"/> <size key="shadowOffset" width="0.0" height="1"/>
</label> </label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="AES-encrypted, not backed up." lineBreakMode="tailTruncation" minimumFontSize="10" id="6S8-9Y-pzj"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="AES-encrypted, stays on this device only." lineBreakMode="tailTruncation" minimumFontSize="10" id="6S8-9Y-pzj">
<rect key="frame" x="20" y="24" width="280" height="20"/> <rect key="frame" x="20" y="24" width="280" height="20"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" name="GillSans-Light" family="Gill Sans" pointSize="14"/> <fontDescription key="fontDescription" name="GillSans-Light" family="Gill Sans" pointSize="14"/>
@ -308,6 +308,107 @@ The passwords aren't saved anywhere. This is a major advantage: if you loose yo
</objects> </objects>
<point key="canvasLocation" x="996" y="182"/> <point key="canvasLocation" x="996" y="182"/>
</scene> </scene>
<scene sceneID="CAy-bQ-C6H">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="QZd-tS-GZh" userLabel="First Responder" sceneMemberID="firstResponder"/>
<tableViewController id="kOI-sP-Sdw" sceneMemberID="viewController">
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="plain" rowHeight="30" sectionHeaderHeight="22" sectionFooterHeight="22" id="M67-lE-Qs9">
<rect key="frame" x="0.0" y="0.0" width="150" height="460"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<sections>
<tableViewSection id="bkW-yw-n1W">
<cells>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="Rwj-wk-t0i" style="IBUITableViewCellStyleDefault" id="xKQ-NU-gzm">
<rect key="frame" x="0.0" y="0.0" width="150" height="30"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="150" height="29"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="Help" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Rwj-wk-t0i">
<rect key="frame" x="10" y="0.0" width="130" height="29"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="QyJ-9R-TKX" style="IBUITableViewCellStyleDefault" id="HEh-hy-Oxe">
<rect key="frame" x="0.0" y="30" width="150" height="30"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="150" height="29"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="FAQ" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="QyJ-9R-TKX">
<rect key="frame" x="10" y="0.0" width="130" height="29"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="2ed-5N-kNd" style="IBUITableViewCellStyleDefault" id="jWC-3d-Lyf">
<rect key="frame" x="0.0" y="60" width="150" height="30"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="150" height="29"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="Quick Start" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="2ed-5N-kNd">
<rect key="frame" x="10" y="0.0" width="130" height="29"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="CHx-Q6-JUu" style="IBUITableViewCellStyleDefault" id="FeB-b2-cca">
<rect key="frame" x="0.0" y="90" width="150" height="30"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="150" height="29"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" text="Settings" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="CHx-Q6-JUu">
<rect key="frame" x="10" y="0.0" width="130" height="29"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="kOI-sP-Sdw" id="vsf-0U-eMd"/>
<outlet property="delegate" destination="kOI-sP-Sdw" id="utR-L0-FDy"/>
</connections>
</tableView>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</tableViewController>
</objects>
<point key="canvasLocation" x="996" y="785"/>
</scene>
<scene sceneID="U26-Zf-euQ"> <scene sceneID="U26-Zf-euQ">
<objects> <objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="mK2-p1-3zC" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="mK2-p1-3zC" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -751,6 +852,7 @@ L4m3P4sSw0rD</string>
<relationship kind="outlet" name="contentTipEditIcon" candidateClass="UIImageView"/> <relationship kind="outlet" name="contentTipEditIcon" candidateClass="UIImageView"/>
<relationship kind="outlet" name="helpContainer" candidateClass="UIView"/> <relationship kind="outlet" name="helpContainer" candidateClass="UIView"/>
<relationship kind="outlet" name="helpView" candidateClass="UIWebView"/> <relationship kind="outlet" name="helpView" candidateClass="UIWebView"/>
<relationship kind="outlet" name="menuContainer" candidateClass="UIView"/>
<relationship kind="outlet" name="passwordCounter" candidateClass="UILabel"/> <relationship kind="outlet" name="passwordCounter" candidateClass="UILabel"/>
<relationship kind="outlet" name="passwordEdit" candidateClass="UIButton"/> <relationship kind="outlet" name="passwordEdit" candidateClass="UIButton"/>
<relationship kind="outlet" name="passwordIncrementer" candidateClass="UIButton"/> <relationship kind="outlet" name="passwordIncrementer" candidateClass="UIButton"/>

View File

@ -289,13 +289,17 @@
dbg(@"Updating master key phrase hash to: %@.", self.keyPhraseHashHex); dbg(@"Updating master key phrase hash to: %@.", self.keyPhraseHashHex);
[KeyChain addOrUpdateItemForQuery:[OPAppDelegate keyPhraseHashQuery] [KeyChain addOrUpdateItemForQuery:[OPAppDelegate keyPhraseHashQuery]
withAttributes:[NSDictionary dictionaryWithObject:self.keyPhraseHash withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
forKey:(__bridge id)kSecValueData]]; self.keyPhraseHash, (__bridge id)kSecValueData,
kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible,
nil]];
if ([[OPConfig get].storeKeyPhrase boolValue]) { if ([[OPConfig get].storeKeyPhrase boolValue]) {
dbg(@"Storing master key phrase in key chain."); dbg(@"Storing master key phrase in key chain.");
[KeyChain addOrUpdateItemForQuery:[OPAppDelegate keyPhraseQuery] [KeyChain addOrUpdateItemForQuery:[OPAppDelegate keyPhraseQuery]
withAttributes:[NSDictionary dictionaryWithObject:[keyPhrase dataUsingEncoding:NSUTF8StringEncoding] withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
forKey:(__bridge id)kSecValueData]]; [keyPhrase dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecValueData,
kSecAttrAccessibleWhenUnlocked, (__bridge id)kSecAttrAccessible,
nil]];
} }
} }
} }

View File

@ -14,10 +14,10 @@
@property (nonatomic, retain) NSString *name; @property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *mpHashHex; @property (nonatomic, retain) NSString *mpHashHex;
@property (nonatomic) int16_t type; @property (nonatomic, assign) int16_t type;
@property (nonatomic) int16_t uses; @property (nonatomic, assign) int16_t uses;
@property (nonatomic) NSTimeInterval lastUsed; @property (nonatomic, assign) NSTimeInterval lastUsed;
@property (nonatomic, readonly) id content; @property (nonatomic, retain, readonly) id content;
- (void)use; - (void)use;

View File

@ -13,6 +13,6 @@
@interface OPElementGeneratedEntity : OPElementEntity @interface OPElementGeneratedEntity : OPElementEntity
@property (nonatomic) int16_t counter; @property (nonatomic, assign) int16_t counter;
@end @end

View File

@ -13,6 +13,6 @@
@interface OPElementStoredEntity : OPElementEntity @interface OPElementStoredEntity : OPElementEntity
@property (nonatomic, retain) id contentObject; @property (nonatomic, retain, readwrite) id content;
@end @end

View File

@ -7,17 +7,59 @@
// //
#import "OPElementStoredEntity.h" #import "OPElementStoredEntity.h"
#import "OPAppDelegate.h"
@interface OPElementStoredEntity ()
@property (nonatomic, retain, readwrite) id contentObject;
@end
@implementation OPElementStoredEntity @implementation OPElementStoredEntity
@dynamic contentObject; @dynamic contentObject;
+ (NSDictionary *)queryForDevicePrivateElementNamed:(NSString *)name {
return [KeyChain createQueryForClass:kSecClassGenericPassword
attributes:[NSDictionary dictionaryWithObjectsAndKeys:
@"DevicePrivate", (__bridge id)kSecAttrService,
name, (__bridge id)kSecAttrAccount,
nil]
matches:nil];
}
- (id)content { - (id)content {
assert(self.type & OPElementTypeClassStored); assert(self.type & OPElementTypeClassStored);
return self.contentObject; NSData *encryptedContent;
if (self.type == OPElementTypeStoredDevicePrivate)
encryptedContent = [KeyChain dataOfItemForQuery:[OPElementStoredEntity queryForDevicePrivateElementNamed:self.name]];
else
encryptedContent = self.contentObject;
NSData *decryptedContent = [encryptedContent decryptWithSymmetricKey:[[OPAppDelegate get].keyPhrase
dataUsingEncoding:NSUTF8StringEncoding]
usePadding:YES];
return [[NSString alloc] initWithBytes:decryptedContent.bytes length:decryptedContent.length encoding:NSUTF8StringEncoding];
}
- (void)setContent:(id)content {
NSData *encryptedContent = [[content description] encryptWithSymmetricKey:[[OPAppDelegate get].keyPhrase
dataUsingEncoding:NSUTF8StringEncoding]
usePadding:YES];
if (self.type == OPElementTypeStoredDevicePrivate) {
[KeyChain addOrUpdateItemForQuery:[OPElementStoredEntity queryForDevicePrivateElementNamed:self.name]
withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
encryptedContent, (__bridge id)kSecValueData,
kSecAttrAccessibleWhenUnlockedThisDeviceOnly, (__bridge id)kSecAttrAccessible,
nil]];
self.contentObject = nil;
} else
self.contentObject = encryptedContent;
} }
@end @end

View File

@ -369,12 +369,12 @@
// Not of a type whose content can be edited. // Not of a type whose content can be edited.
return; return;
if ([((OPElementStoredEntity *) self.activeElement).contentObject isEqual:self.contentField.text]) if ([((OPElementStoredEntity *) self.activeElement).content isEqual:self.contentField.text])
// Content hasn't changed. // Content hasn't changed.
return; return;
[self updateElement:^{ [self updateElement:^{
((OPElementStoredEntity *) self.activeElement).contentObject = self.contentField.text; ((OPElementStoredEntity *) self.activeElement).content = self.contentField.text;
}]; }];
} }
} }

View File

@ -0,0 +1,13 @@
//
// OPMenuViewController.h
// MasterPassword
//
// Created by Maarten Billemont on 05/02/12.
// Copyright (c) 2012 Lyndir. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface OPMenuViewController : UITableViewController
@end

View File

@ -0,0 +1,22 @@
//
// OPMenuViewController.m
// MasterPassword
//
// Created by Maarten Billemont on 05/02/12.
// Copyright (c) 2012 Lyndir. All rights reserved.
//
#import "OPMenuViewController.h"
@implementation OPMenuViewController
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == 4)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=Apps&path=MasterPassword"]];
}
@end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB