More cleanup on database settings windows. Memory display for Argon2 now uses stepper and NSByteCountFormatter

This commit is contained in:
michael starke
2017-10-17 19:23:23 +02:00
parent 008c446f3d
commit a09bc919f2
5 changed files with 36 additions and 48 deletions

View File

@@ -14,6 +14,7 @@
<outlet property="Argon2ThreadsTextField" destination="178-0f-guB" id="ATl-km-DSX"/>
<outlet property="aesEncryptionRoundsTextField" destination="8aq-34-rcd" id="WoJ-Kc-d8q"/>
<outlet property="argon2IterationsTextField" destination="39N-8Q-J8b" id="af4-Ft-aDX"/>
<outlet property="argon2MemoryStepper" destination="NfL-iP-SRk" id="eAW-kb-cLh"/>
<outlet property="argon2MemoryTextField" destination="eEW-oa-V7U" id="Wig-Rk-lm0"/>
<outlet property="argon2ThreadsTextField" destination="178-0f-guB" id="dHa-L6-gOs"/>
<outlet property="cipherPopupButton" destination="3ek-Rg-w82" id="LbB-Fd-rqC"/>
@@ -52,11 +53,11 @@
<rect key="contentRect" x="196" y="240" width="500" height="335"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<view key="contentView" id="2">
<rect key="frame" x="0.0" y="0.0" width="553" height="484"/>
<rect key="frame" x="0.0" y="0.0" width="458" height="388"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="288">
<rect key="frame" x="480" y="13" width="59" height="32"/>
<rect key="frame" x="385" y="13" width="59" height="32"/>
<buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="289">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -69,7 +70,7 @@ DQ
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="956">
<rect key="frame" x="398" y="13" width="82" height="32"/>
<rect key="frame" x="303" y="13" width="82" height="32"/>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="957">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -82,7 +83,7 @@ Gw
</connections>
</button>
<tabView translatesAutoresizingMaskIntoConstraints="NO" id="357">
<rect key="frame" x="13" y="41" width="527" height="437"/>
<rect key="frame" x="13" y="41" width="432" height="341"/>
<font key="font" metaFont="system"/>
<tabViewItems>
<tabViewItem label="General" identifier="1" id="358">
@@ -213,11 +214,11 @@ Gw
</tabViewItem>
<tabViewItem label="Security" identifier="" id="370">
<view key="view" id="371">
<rect key="frame" x="10" y="33" width="454" height="243"/>
<rect key="frame" x="10" y="33" width="412" height="295"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3ek-Rg-w82">
<rect key="frame" x="150" y="199" width="155" height="26"/>
<rect key="frame" x="129" y="251" width="155" height="26"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="150" id="F8Y-Uw-4mL"/>
</constraints>
@@ -228,7 +229,7 @@ Gw
</popUpButtonCell>
</popUpButton>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vH7-5a-52C">
<rect key="frame" x="73" y="206" width="73" height="17"/>
<rect key="frame" x="52" y="258" width="73" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Encryption:" id="gxY-UL-bEG">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -236,20 +237,20 @@ Gw
</textFieldCell>
</textField>
<box title="Key derivation" translatesAutoresizingMaskIntoConstraints="NO" id="pbl-Mb-r8V">
<rect key="frame" x="17" y="16" width="420" height="178"/>
<rect key="frame" x="17" y="16" width="378" height="230"/>
<view key="contentView" id="hkT-SX-Te1">
<rect key="frame" x="2" y="2" width="416" height="161"/>
<rect key="frame" x="2" y="2" width="374" height="213"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="P98-Cu-Tha">
<rect key="frame" x="253" y="18" width="143" height="25"/>
<rect key="frame" x="211" y="18" width="143" height="25"/>
<buttonCell key="cell" type="roundTextured" title="Generate Parameters" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="PoI-Er-Y8P">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<tabView drawsBackground="NO" type="noTabsNoBorder" translatesAutoresizingMaskIntoConstraints="NO" id="2MY-PW-kzL">
<rect key="frame" x="13" y="50" width="390" height="62"/>
<rect key="frame" x="13" y="50" width="348" height="114"/>
<font key="font" metaFont="system"/>
<tabViewItems>
<tabViewItem label="Aes" identifier="1" id="ft1-pl-lpO">
@@ -296,7 +297,7 @@ Gw
<rect key="frame" x="0.0" y="0.0" width="348" height="114"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aNy-eF-jKq">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="aNy-eF-jKq">
<rect key="frame" x="39" y="87" width="54" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Threads" id="2QI-ne-N5d">
<font key="font" metaFont="system"/>
@@ -304,7 +305,7 @@ Gw
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ml2-wP-EaZ">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="ml2-wP-EaZ">
<rect key="frame" x="32" y="55" width="61" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Iterations" id="2ZA-Gc-JdZ">
<font key="font" metaFont="system"/>
@@ -342,15 +343,13 @@ Gw
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eEW-oa-V7U">
<rect key="frame" x="99" y="20" width="129" height="22"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="M1E-89-YVm">
<numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" groupingSize="0" minimumIntegerDigits="0" maximumIntegerDigits="42" id="nQR-dh-won">
<real key="minimum" value="8192"/>
</numberFormatter>
<byteCountFormatter key="formatter" countStyle="binary" allowsNonnumericFormatting="NO" id="tSh-D8-DnC"/>
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9kV-19-lm6">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="9kV-19-lm6">
<rect key="frame" x="39" y="23" width="54" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Memory" id="iRY-If-Kwn">
<font key="font" metaFont="system"/>
@@ -393,7 +392,7 @@ Gw
</tabViewItems>
</tabView>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2cq-R3-Ksh">
<rect key="frame" x="131" y="117" width="155" height="26"/>
<rect key="frame" x="110" y="169" width="155" height="26"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="Pb9-YV-rYe">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
@@ -404,7 +403,7 @@ Gw
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4el-r1-iRL">
<rect key="frame" x="64" y="124" width="63" height="17"/>
<rect key="frame" x="43" y="176" width="63" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Algorithm" id="GVd-KH-pHc">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -728,7 +727,7 @@ Gw
<constraint firstItem="956" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="2" secondAttribute="leading" constant="20" symbolic="YES" id="Yla-YR-bgz"/>
</constraints>
</view>
<point key="canvasLocation" x="-1200" y="-504"/>
<point key="canvasLocation" x="-1217" y="-566"/>
</window>
</objects>
</document>

View File

@@ -54,6 +54,7 @@ typedef NS_ENUM(NSUInteger, MPDatabaseSettingsTab) {
@property (weak) IBOutlet NSTextField *argon2ThreadsTextField;
@property (weak) IBOutlet NSTextField *argon2IterationsTextField;
@property (weak) IBOutlet NSTextField *argon2MemoryTextField;
@property (weak) IBOutlet NSStepper *argon2MemoryStepper;
/* Advanced Tab*/
@property (weak) IBOutlet NSButton *enableHistoryCheckButton;

View File

@@ -39,6 +39,8 @@
NSString *_missingFeature;
}
@property (assign) NSInteger argon2Memory;
@property (assign) BOOL enableHistory;
@property (assign) NSInteger maxiumHistoryItems;
@property (assign) NSInteger maxiumHistorySize;
@@ -170,7 +172,7 @@
}
else if([selectedKdfUUID isEqual:argon2Kdf.uuid]) {
argon2Kdf.iterations = self.argon2IterationsTextField.integerValue;
argon2Kdf.memory = self.argon2MemoryTextField.integerValue;
argon2Kdf.memory = self.argon2Memory;
argon2Kdf.threads = self.argon2ThreadsTextField.intValue;
metaData.keyDerivationParameters = argon2Kdf.parameters;
}
@@ -259,12 +261,12 @@
/* fill defaults for Argon2 */
KPKArgon2KeyDerivation *argon2Kdf = [[KPKArgon2KeyDerivation alloc] initWithParameters:[KPKArgon2KeyDerivation defaultParameters]];
self.argon2IterationsTextField.integerValue = argon2Kdf.iterations;
self.argon2MemoryTextField.integerValue = argon2Kdf.memory;
self.argon2Memory = argon2Kdf.memory;
self.argon2ThreadsTextField.integerValue = argon2Kdf.threads;
}
else if([keyDerivation isKindOfClass:[KPKArgon2KeyDerivation class]]) {
KPKArgon2KeyDerivation *argon2Kdf = (KPKArgon2KeyDerivation *)keyDerivation;
self.argon2MemoryTextField.integerValue = argon2Kdf.memory;
self.argon2Memory = argon2Kdf.memory;
self.argon2ThreadsTextField.integerValue = argon2Kdf.threads;
self.argon2IterationsTextField.integerValue = argon2Kdf.iterations;
@@ -276,6 +278,13 @@
NSAssert(NO, @"Unkown key derivation");
}
self.argon2MemoryStepper.minValue = 8*1024; // 8KB minimum
self.argon2MemoryStepper.maxValue = NSIntegerMax;
self.argon2MemoryStepper.increment = 1024*1024; // 1 megabytes steps
[self.argon2MemoryTextField bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(argon2Memory)) options:nil];
[self.argon2MemoryStepper bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(argon2Memory)) options:nil];
NSUInteger cipherIndex = [self.cipherPopupButton.menu indexOfItemWithRepresentedObject:metaData.cipherUUID];
[self.cipherPopupButton selectItemAtIndex:cipherIndex];
}

View File

@@ -2,13 +2,13 @@
"1.title" = "Fenster";
/* Class = "NSTextFieldCell"; title = "Threads"; ObjectID = "2QI-ne-N5d"; */
"2QI-ne-N5d.title" = "ThreadsThreads";
"2QI-ne-N5d.title" = "Threads";
/* Class = "NSTextFieldCell"; title = "Iterations"; ObjectID = "2ZA-Gc-JdZ"; */
"2ZA-Gc-JdZ.title" = "WiederholungenWiederholungen";
"2ZA-Gc-JdZ.title" = "Wiederholungen";
/* Class = "NSTextFieldCell"; title = "Enforce key change"; ObjectID = "5QH-N1-FHK"; */
"5QH-N1-FHK.title" = "Erzwingen der Änderung des SchlüsselsErzwingen der Änderung des Schlüssels";
"5QH-N1-FHK.title" = "Erzwingen der Änderung des Schlüssels";
/* Class = "NSTabViewItem"; label = "Argon2"; ObjectID = "6qB-sH-9FI"; */
"6qB-sH-9FI.label" = "Argon 2";
@@ -32,14 +32,11 @@
"370.label" = "Sicherheit";
/* Class = "NSButtonCell"; title = "Enable Entry History"; ObjectID = "532"; */
"532.title" = "Eintragsversionen aktivieren";
"532.title" = "Historie für Einträge aktivieren";
/* Class = "NSButtonCell"; title = "Enable Recycle Bin"; ObjectID = "536"; */
"536.title" = "Papierkorb aktivieren";
/* (No Comment) */
"540.title" = "Papierkorb beim Beenden leeren";
/* Class = "NSTextFieldCell"; title = "Maximum items in history:"; ObjectID = "558"; */
"558.title" = "Maximale Einträge:";
@@ -79,18 +76,6 @@
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "1740"; */
"1740.title" = "OtherViews";
/* Class = "NSMenuItem"; title = "Item 1"; ObjectID = "1741"; */
"1741.title" = "Eintrag 1";
/* Class = "NSMenuItem"; title = "Item 2"; ObjectID = "1742"; */
"1742.title" = "Eintrag 2";
/* Class = "NSMenuItem"; title = "Item 3"; ObjectID = "1743"; */
"1743.title" = "Eintrag 3";
/* (No Comment) */
"1775.title" = "Benchmark";
/* Class = "NSButtonCell"; title = "Recommend key change"; ObjectID = "CtU-Eq-dgy"; */
"CtU-Eq-dgy.title" = "Änderung des Schlüssels empfehlen";

View File

@@ -26,9 +26,6 @@
/* Class = "NSButtonCell"; title = "Enable Recycle Bin"; ObjectID = "536"; */
"536.title" = "Enable Recycle Bin";
/* Class = "NSButtonCell"; title = "Empty Recycle Bin on Quit"; ObjectID = "540"; */
"540.title" = "Empty Recycle Bin on Quit";
/* Class = "NSTextFieldCell"; title = "Maximum Items:"; ObjectID = "558"; */
"558.title" = "Maximum Items:";
@@ -67,6 +64,3 @@
/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "1740"; */
"1740.title" = "OtherViews";
/* Class = "NSButtonCell"; title = "Benchmark"; ObjectID = "1775"; */
"1775.title" = "Benchmark";