CryptoPassphrase  Check-in [43dbe5c8cb]

Overview
Comment:iOS: Add initial parts of support for key files
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 43dbe5c8cb6c4a376a982ad4c3ac24e575ded83cf5baa3d816d86b70aa385f0e
User & Date: js on 2017-11-26 20:09:53
Other Links: manifest | tags
Context
2017-11-26
21:51
iOS: Finish support for key files check-in: d49bbec74c user: js tags: trunk
20:09
iOS: Add initial parts of support for key files check-in: 43dbe5c8cb user: js tags: trunk
19:19
iOS: A few code modernizations check-in: 6205c4feae user: js tags: trunk
Changes

Modified LegacyPasswordGenerator.h from [8bad498857] to [7f1763dc99].

22
23
24
25
26
27
28
29

30
31
32
33
22
23
24
25
26
27
28

29
30
31
32
33







-
+





#import "PasswordGenerator.h"

@interface LegacyPasswordGenerator: OFObject <PasswordGenerator>
{
	size_t _length;
	OFString *_site;
	OFData *_keyfile;
	OFData *_keyFile;
	const char *_passphrase;
	unsigned char *_output;
}
@end

Modified LegacyPasswordGenerator.m from [aae98c4e4f] to [dded19427e].

19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33







-
+







 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "LegacyPasswordGenerator.h"

@implementation LegacyPasswordGenerator
@synthesize site = _site, keyfile = _keyfile, passphrase = _passphrase;
@synthesize site = _site, keyFile = _keyFile, passphrase = _passphrase;
@synthesize output = _output;

+ (instancetype)generator
{
	return [[[self alloc] init] autorelease];
}

66
67
68
69
70
71
72
73
74


75
76
77

78
79
80
81
82
83
84
85
86

87
88

89
90
91
92
93
94
95
66
67
68
69
70
71
72


73
74
75
76

77
78
79
80
81
82
83
84
85

86
87

88
89
90
91
92
93
94
95







-
-
+
+


-
+








-
+

-
+







		of_explicit_memset(_output, 0, _length);
		[self freeMemory: _output];
	}

	_output = [self allocMemoryWithSize: _length + 1];

	passphraseLength = combinedPassphraseLength = strlen(_passphrase);
	if (_keyfile != nil) {
		if (SIZE_MAX - combinedPassphraseLength < _keyfile.count)
	if (_keyFile != nil) {
		if (SIZE_MAX - combinedPassphraseLength < _keyFile.count)
			@throw [OFOutOfRangeException exception];

		combinedPassphraseLength += _keyfile.count;
		combinedPassphraseLength += _keyFile.count;
	}

	if ((combinedPassphrase = malloc(combinedPassphraseLength)) == NULL)
		@throw [OFOutOfMemoryException
		    exceptionWithRequestedSize: combinedPassphraseLength];
	@try {
		memcpy(combinedPassphrase, _passphrase, passphraseLength);

		if (_keyfile != nil)
		if (_keyFile != nil)
			memcpy(combinedPassphrase + passphraseLength,
			    _keyfile.items, _keyfile.count);
			    _keyFile.items, _keyFile.count);

		of_scrypt(8, 524288, 2, siteHash.digest,
		    [siteHash.class digestSize], combinedPassphrase,
		    combinedPassphraseLength, _output, _length);
	} @finally {
		of_explicit_memset(combinedPassphrase, 0,
		    combinedPassphraseLength);

Modified NewPasswordGenerator.h from [47a42d209c] to [e075899521].

22
23
24
25
26
27
28
29

30
31
32
33
22
23
24
25
26
27
28

29
30
31
32
33







-
+





#import "PasswordGenerator.h"

@interface NewPasswordGenerator: OFObject <PasswordGenerator>
{
	size_t _length;
	OFString *_site;
	OFData *_keyfile;
	OFData *_keyFile;
	const char *_passphrase;
	unsigned char *_output;
}
@end

Modified NewPasswordGenerator.m from [80bcaa862e] to [a9b0ef1bc2].

19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33







-
+







 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#import "NewPasswordGenerator.h"

@implementation NewPasswordGenerator
@synthesize length = _length, site = _site, keyfile = _keyfile;
@synthesize length = _length, site = _site, keyFile = _keyFile;
@synthesize passphrase = _passphrase, output = _output;

+ (instancetype)generator
{
	return [[[self alloc] init] autorelease];
}

53
54
55
56
57
58
59
60
61


62
63
64

65
66
67
68
69
70
71
72
73

74
75

76
77
78
79
80
81
82
53
54
55
56
57
58
59


60
61
62
63

64
65
66
67
68
69
70
71
72

73
74

75
76
77
78
79
80
81
82







-
-
+
+


-
+








-
+

-
+







		of_explicit_memset(_output, 0, _length);
		[self freeMemory: _output];
	}

	_output = [self allocMemoryWithSize: _length + 1];

	passphraseLength = combinedPassphraseLength = strlen(_passphrase);
	if (_keyfile != nil) {
		if (SIZE_MAX - combinedPassphraseLength < _keyfile.count)
	if (_keyFile != nil) {
		if (SIZE_MAX - combinedPassphraseLength < _keyFile.count)
			@throw [OFOutOfRangeException exception];

		combinedPassphraseLength += _keyfile.count;
		combinedPassphraseLength += _keyFile.count;
	}

	if ((combinedPassphrase = malloc(combinedPassphraseLength)) == NULL)
		@throw [OFOutOfMemoryException
		    exceptionWithRequestedSize: combinedPassphraseLength];
	@try {
		memcpy(combinedPassphrase, _passphrase, passphraseLength);

		if (_keyfile != nil)
		if (_keyFile != nil)
			memcpy(combinedPassphrase + passphraseLength,
			    _keyfile.items, _keyfile.count);
			    _keyFile.items, _keyFile.count);

		of_scrypt(8, 524288, 2, siteHash.digest,
		    [siteHash.class digestSize], combinedPassphrase,
		    combinedPassphraseLength, _output, _length);
	} @finally {
		of_explicit_memset(combinedPassphrase, 0,
		    combinedPassphraseLength);

Modified PasswordGenerator.h from [20269debc0] to [db2e07f394].

21
22
23
24
25
26
27
28

29
30
31
32
33
34
21
22
23
24
25
26
27

28
29
30
31
32
33
34







-
+






 */

#import <ObjFW/ObjFW.h>

@protocol PasswordGenerator
@property (nonatomic) size_t length;
@property (copy, nonatomic) OFString *site;
@property (retain, nonatomic) OFData *keyfile;
@property (retain, nonatomic) OFData *keyFile;
@property (nonatomic) const char *passphrase;
@property (readonly, nonatomic) unsigned char *output;

+ (instancetype)generator;
- (void)derivePassword;
@end

Modified ScryptPWGen.m from [15e8c24529] to [864e5952d2].

45
46
47
48
49
50
51
52

53
54
55

56
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
45
46
47
48
49
50
51

52
53
54

55
56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
71







-
+


-
+








-
+







		    @"(compatible with scrypt-genpass)\n"
		    @"    -r  --repeat  Repeat input\n"];
}

@implementation ScryptPWGen
- (void)applicationDidFinishLaunching
{
	OFString *keyfilePath, *lengthString;
	OFString *keyFilePath, *lengthString;
	const of_options_parser_option_t options[] = {
		{ 'h', @"help", 0, NULL, NULL },
		{ 'k', @"keyfile", 1, NULL, &keyfilePath },
		{ 'k', @"keyfile", 1, NULL, &keyFilePath },
		{ 'l', @"length", 1, NULL, &lengthString },
		{ 'L', @"legacy", 0, &_legacy, NULL },
		{ 'r', @"repeat", 0, &_repeat, NULL },
		{ '\0', nil, 0, NULL, NULL }
	};
	OFOptionsParser *optionsParser =
	    [OFOptionsParser parserWithOptions: options];
	of_unichar_t option;
	OFMutableData *keyfile = nil;
	OFMutableData *keyFile = nil;
	OFString *prompt;
	const char *promptCString;
	char *passphrase;

	while ((option = [optionsParser nextOption]) != '\0') {
		switch (option) {
		case 'h':
136
137
138
139
140
141
142
143
144


145
146
147
148
149
150
151
136
137
138
139
140
141
142


143
144
145
146
147
148
149
150
151







-
-
+
+







		}
	}

	prompt = [OFString stringWithFormat: @"Passphrase for site \"%@\": ",
					     generator.site];
	promptCString = [prompt cStringWithEncoding: [OFLocalization encoding]];

	if (keyfilePath != nil)
		keyfile = [OFMutableData dataWithContentsOfFile: keyfilePath];
	if (keyFilePath != nil)
		keyFile = [OFMutableData dataWithContentsOfFile: keyFilePath];

	passphrase = getpass(promptCString);
	@try {
		if (_repeat) {
			char *passphraseCopy = of_strdup(passphrase);

			if (passphraseCopy == NULL)
169
170
171
172
173
174
175
176

177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193


194
195
196
197
198
169
170
171
172
173
174
175

176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191


192
193
194
195
196
197
198







-
+















-
-
+
+





			} @finally {
				of_explicit_memset(passphraseCopy, 0,
				    strlen(passphraseCopy));
				free(passphraseCopy);
			}
		}

		generator.keyfile = keyfile;
		generator.keyFile = keyFile;
		generator.passphrase = passphrase;

		[generator derivePassword];
		@try {
			[of_stdout writeBuffer: generator.output
					length: generator.length];
			[of_stdout writeBuffer: "\n"
					length: 1];
		} @finally {
			of_explicit_memset(generator.output, 0,
			    generator.length);
		}
	} @finally {
		of_explicit_memset(passphrase, 0, strlen(passphrase));

		if (keyfile != nil)
			of_explicit_memset(keyfile.items, 0, keyfile.count);
		if (keyFile != nil)
			of_explicit_memset(keyFile.items, 0, keyFile.count);
	}

	[OFApplication terminate];
}
@end

Modified iOS/AddSiteController.h from [8bcbc82352] to [a0b21e026a].

20
21
22
23
24
25
26
27

28
29
30

31
32
33
34
35
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35
36







-
+



+





 * POSSIBILITY OF SUCH DAMAGE.
 */

#import <UIKit/UIKit.h>

#import "MainViewController.h"

@interface AddSiteController: UITableViewController
@interface AddSiteController: UITableViewController <UITableViewDelegate>
@property (nonatomic, retain) IBOutlet UITextField *nameField;
@property (nonatomic, retain) IBOutlet UITextField *lengthField;
@property (nonatomic, retain) IBOutlet UISwitch *legacySwitch;
@property (nonatomic, retain) IBOutlet UILabel *keyFileLabel;
@property (retain) MainViewController *mainViewController;

- (IBAction)done: (id)sender;
- (IBAction)cancel: (id)sender;
@end

Modified iOS/AddSiteController.m from [ce1997b342] to [1b0750a97b].

43
44
45
46
47
48
49

50
51
52
53
























54
55
56
57
58
59
60
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85







+




+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+








@implementation AddSiteController
- (void)dealloc
{
	[_nameField release];
	[_lengthField release];
	[_legacySwitch release];
	[_keyFileLabel release];
	[_mainViewController release];

	[super dealloc];
}

-	  (void)tableView: (UITableView *)tableView
  didSelectRowAtIndexPath: (NSIndexPath *)indexPath
{
	[tableView deselectRowAtIndexPath: indexPath
				 animated: YES];

	if (indexPath.section == 1 && indexPath.row == 1)
		[self selectKeyFile];
}

- (NSIndexPath *)tableView: (UITableView *)tableView
  willSelectRowAtIndexPath: (NSIndexPath *)indexPath
{
	if (indexPath.section == 1 && indexPath.row == 1)
		return indexPath;

	return nil;
}

- (void)selectKeyFile
{
	showAlert(self, @"Not Supported", @"Key files are not supported yet");
}

- (IBAction)done: (id)sender
{
	OFString *name = self.nameField.text.OFObject;
	OFString *lengthString = self.lengthField.text.OFObject;
	bool lengthValid = true;
	size_t length;
83
84
85
86
87
88
89
90


91
92
93
94
95
96
97
98
99
100
108
109
110
111
112
113
114

115
116
117
118
119
120
121
122
123
124
125
126







-
+
+










		showAlert(self, @"Site Already Exists",
		    @"Please pick a name that does not exist yet.");
		return;
	}

	[self.mainViewController.siteStorage setSite: name
					      length: length
					      legacy: self.legacySwitch.on];
					      legacy: self.legacySwitch.on
					     keyFile: nil];
	[self.mainViewController reset];

	[self.navigationController popViewControllerAnimated: YES];
}

- (IBAction)cancel: (id)sender
{
	[self.navigationController popViewControllerAnimated: YES];
}
@end

Modified iOS/Base.lproj/Main.storyboard from [93bb709220] to [ce215435c7].

1
2

3
4
5
6
7
8

9
10
11
12
13
14
15
1

2
3
4
5
6
7

8
9
10
11
12
13
14
15

-
+





-
+







<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BN3-Y7-zvx">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BN3-Y7-zvx">
    <device id="retina4_7" orientation="portrait">
        <adaptation id="fullscreen"/>
    </device>
    <dependencies>
        <deployment identifier="iOS"/>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
        <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <scenes>
        <!--Navigation Controller-->
        <scene sceneID="edE-sY-0Cv">
            <objects>
127
128
129
130
131
132
133
134

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149

150
151
152
153
154
155
156
157
158

159
160
161
162
163
164
165
127
128
129
130
131
132
133

134
135
136
137
138
139
140
141
142
143
144
145
146
147
148

149
150
151
152
153
154
155
156
157

158
159
160
161
162
163
164
165







-
+














-
+








-
+







            </objects>
            <point key="canvasLocation" x="1992.8" y="326.98650674662673"/>
        </scene>
        <!--Add Site Controller-->
        <scene sceneID="IxZ-dn-p6h">
            <objects>
                <tableViewController id="mTn-Td-fIF" customClass="AddSiteController" sceneMemberID="viewController">
                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="cum-L6-K1B">
                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="cum-L6-K1B">
                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                        <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
                        <sections>
                            <tableViewSection id="Whg-Qc-bTG">
                                <cells>
                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="En5-ry-3SM">
                                        <rect key="frame" x="0.0" y="35" width="375" height="44"/>
                                        <autoresizingMask key="autoresizingMask"/>
                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="En5-ry-3SM" id="fh3-TO-M9D">
                                            <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
                                            <autoresizingMask key="autoresizingMask"/>
                                            <subviews>
                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yq7-aM-PNl">
                                                    <rect key="frame" x="8" y="11.5" width="100" height="20.5"/>
                                                    <rect key="frame" x="16" y="11.5" width="100" height="20.5"/>
                                                    <constraints>
                                                        <constraint firstAttribute="width" constant="100" id="nTn-vs-RDo"/>
                                                    </constraints>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <nil key="textColor"/>
                                                    <nil key="highlightedColor"/>
                                                </label>
                                                <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="apple.com" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="AXY-MA-LhE">
                                                    <rect key="frame" x="116" y="11.5" width="251" height="21"/>
                                                    <rect key="frame" x="124" y="11.5" width="235" height="21"/>
                                                    <nil key="textColor"/>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" returnKeyType="next"/>
                                                </textField>
                                            </subviews>
                                            <constraints>
                                                <constraint firstItem="AXY-MA-LhE" firstAttribute="leading" secondItem="Yq7-aM-PNl" secondAttribute="trailing" constant="8" symbolic="YES" id="0YS-Qe-KVC"/>
174
175
176
177
178
179
180
181

182
183
184
185
186
187
188
189
190

191
192
193
194
195
196
197
174
175
176
177
178
179
180

181
182
183
184
185
186
187
188
189

190
191
192
193
194
195
196
197







-
+








-
+







                                        <rect key="frame" x="0.0" y="79" width="375" height="44"/>
                                        <autoresizingMask key="autoresizingMask"/>
                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="GI4-iS-21j" id="zSC-vR-CCb">
                                            <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
                                            <autoresizingMask key="autoresizingMask"/>
                                            <subviews>
                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Length" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eFJ-jF-rxJ">
                                                    <rect key="frame" x="8" y="11.5" width="100" height="20.5"/>
                                                    <rect key="frame" x="16" y="11.5" width="100" height="20.5"/>
                                                    <constraints>
                                                        <constraint firstAttribute="width" constant="100" id="4bi-Kp-8mJ"/>
                                                    </constraints>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <nil key="textColor"/>
                                                    <nil key="highlightedColor"/>
                                                </label>
                                                <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="16" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="KQA-JL-1zl">
                                                    <rect key="frame" x="116" y="11.5" width="251" height="21"/>
                                                    <rect key="frame" x="124" y="11.5" width="235" height="21"/>
                                                    <nil key="textColor"/>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="numberPad" returnKeyType="next"/>
                                                </textField>
                                            </subviews>
                                            <constraints>
                                                <constraint firstItem="KQA-JL-1zl" firstAttribute="leading" secondItem="eFJ-jF-rxJ" secondAttribute="trailing" constant="8" symbolic="YES" id="hHI-nW-gN4"/>
210
211
212
213
214
215
216
217

218
219
220
221
222
223
224
225
226

227
228
229
230
231
232
233
234
235
236
































237
238
239
240
241
242

243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259

260
261
262
263
264
265
266
267
268
269
270

271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291

292
293
294
295
296
297
298
299
300

301
302
303
304
305
306
307
210
211
212
213
214
215
216

217
218
219
220
221
222
223
224
225

226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273

274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302

303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323

324
325
326
327
328
329
330
331
332

333
334
335
336
337
338
339
340







-
+








-
+










+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+





-
+

















+










-
+




















-
+








-
+







                                        <rect key="frame" x="0.0" y="159" width="375" height="44"/>
                                        <autoresizingMask key="autoresizingMask"/>
                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="jgd-dy-HQH" id="eqZ-BJ-5O0">
                                            <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
                                            <autoresizingMask key="autoresizingMask"/>
                                            <subviews>
                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Legacy" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SVA-v8-zP8">
                                                    <rect key="frame" x="8" y="11.5" width="100" height="20.5"/>
                                                    <rect key="frame" x="16" y="11.5" width="100" height="20.5"/>
                                                    <constraints>
                                                        <constraint firstAttribute="width" constant="100" id="KzI-6Z-fGE"/>
                                                    </constraints>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <nil key="textColor"/>
                                                    <nil key="highlightedColor"/>
                                                </label>
                                                <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="jcs-6K-Sbe">
                                                    <rect key="frame" x="318" y="6.5" width="51" height="31"/>
                                                    <rect key="frame" x="310" y="6.5" width="51" height="31"/>
                                                </switch>
                                            </subviews>
                                            <constraints>
                                                <constraint firstItem="jcs-6K-Sbe" firstAttribute="trailing" secondItem="eqZ-BJ-5O0" secondAttribute="trailingMargin" id="JvE-mo-ax9"/>
                                                <constraint firstItem="SVA-v8-zP8" firstAttribute="centerY" secondItem="jcs-6K-Sbe" secondAttribute="centerY" id="NGb-0A-N0b"/>
                                                <constraint firstItem="SVA-v8-zP8" firstAttribute="leading" secondItem="eqZ-BJ-5O0" secondAttribute="leadingMargin" id="QZr-gB-8NO"/>
                                                <constraint firstItem="SVA-v8-zP8" firstAttribute="centerY" secondItem="eqZ-BJ-5O0" secondAttribute="centerY" id="QhS-hk-7e0"/>
                                            </constraints>
                                        </tableViewCellContentView>
                                    </tableViewCell>
                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="Oqt-88-vl9">
                                        <rect key="frame" x="0.0" y="203" width="375" height="44"/>
                                        <autoresizingMask key="autoresizingMask"/>
                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Oqt-88-vl9" id="j4y-Zr-ep4">
                                            <rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
                                            <autoresizingMask key="autoresizingMask"/>
                                            <subviews>
                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Key file" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Uyw-CW-atj">
                                                    <rect key="frame" x="16" y="12" width="100" height="21"/>
                                                    <constraints>
                                                        <constraint firstAttribute="width" constant="100" id="5d9-re-aJA"/>
                                                    </constraints>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <nil key="textColor"/>
                                                    <nil key="highlightedColor"/>
                                                </label>
                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="None" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wv8-GU-ahj">
                                                    <rect key="frame" x="124" y="11.5" width="208" height="21"/>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <nil key="textColor"/>
                                                    <nil key="highlightedColor"/>
                                                </label>
                                            </subviews>
                                            <constraints>
                                                <constraint firstAttribute="trailingMargin" secondItem="wv8-GU-ahj" secondAttribute="trailing" constant="1" id="0sM-gC-XNC" userLabel="trailingMargin = Label.trailing"/>
                                                <constraint firstItem="wv8-GU-ahj" firstAttribute="leading" secondItem="Uyw-CW-atj" secondAttribute="trailing" constant="8" symbolic="YES" id="McA-uD-gbN"/>
                                                <constraint firstItem="wv8-GU-ahj" firstAttribute="centerY" secondItem="j4y-Zr-ep4" secondAttribute="centerY" id="W3H-tA-b2r"/>
                                                <constraint firstItem="Uyw-CW-atj" firstAttribute="centerY" secondItem="j4y-Zr-ep4" secondAttribute="centerY" id="frr-aH-KZB"/>
                                                <constraint firstItem="Uyw-CW-atj" firstAttribute="leading" secondItem="j4y-Zr-ep4" secondAttribute="leadingMargin" id="oqY-IE-chq"/>
                                            </constraints>
                                        </tableViewCellContentView>
                                    </tableViewCell>
                                </cells>
                            </tableViewSection>
                        </sections>
                        <connections>
                            <outlet property="dataSource" destination="mTn-Td-fIF" id="lRR-7B-Rbz"/>
                            <outlet property="delegate" destination="mTn-Td-fIF" id="UJl-VI-MdQ"/>
                            <outlet property="delegate" destination="mTn-Td-fIF" id="Ved-aO-x8G"/>
                        </connections>
                    </tableView>
                    <toolbarItems/>
                    <navigationItem key="navigationItem" id="J31-Gi-K4T">
                        <barButtonItem key="leftBarButtonItem" systemItem="cancel" id="3KI-rs-foM">
                            <connections>
                                <action selector="cancel:" destination="mTn-Td-fIF" id="v8I-jq-oIa"/>
                            </connections>
                        </barButtonItem>
                        <barButtonItem key="rightBarButtonItem" systemItem="done" id="CYY-ws-1nV">
                            <connections>
                                <action selector="done:" destination="mTn-Td-fIF" id="OfX-Jt-hUG"/>
                            </connections>
                        </barButtonItem>
                    </navigationItem>
                    <simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
                    <connections>
                        <outlet property="keyFileLabel" destination="wv8-GU-ahj" id="Tdf-2p-DSb"/>
                        <outlet property="legacySwitch" destination="jcs-6K-Sbe" id="sCo-l6-9n7"/>
                        <outlet property="lengthField" destination="KQA-JL-1zl" id="tdI-mj-8Ng"/>
                        <outlet property="nameField" destination="AXY-MA-LhE" id="Noo-It-VNV"/>
                    </connections>
                </tableViewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="6ti-F1-srK" userLabel="First Responder" sceneMemberID="firstResponder"/>
                <tableViewSection id="s3j-z4-wEb">
                    <cells/>
                </tableViewSection>
            </objects>
            <point key="canvasLocation" x="1994" y="-1102"/>
            <point key="canvasLocation" x="1992.8" y="-1102.3988005997003"/>
        </scene>
        <!--Show Details Controller-->
        <scene sceneID="rn9-fJ-mg7">
            <objects>
                <tableViewController id="ayJ-fs-aIU" customClass="ShowDetailsController" sceneMemberID="viewController">
                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="vWS-Yc-qQ5">
                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                        <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
                        <sections>
                            <tableViewSection id="pum-yC-c7w">
                                <cells>
                                    <tableViewCell clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="LQ8-yL-l4p">
                                        <rect key="frame" x="0.0" y="35" width="375" height="44"/>
                                        <autoresizingMask key="autoresizingMask"/>
                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="LQ8-yL-l4p" id="Drc-sv-gqn">
                                            <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
                                            <autoresizingMask key="autoresizingMask"/>
                                            <subviews>
                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SAI-3c-VBt">
                                                    <rect key="frame" x="8" y="11.5" width="100" height="20.5"/>
                                                    <rect key="frame" x="16" y="11.5" width="100" height="20.5"/>
                                                    <constraints>
                                                        <constraint firstAttribute="width" constant="100" id="9uC-jX-ZTa"/>
                                                    </constraints>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <nil key="textColor"/>
                                                    <nil key="highlightedColor"/>
                                                </label>
                                                <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="4Le-mO-AdY">
                                                    <rect key="frame" x="116" y="11.5" width="251" height="21"/>
                                                    <rect key="frame" x="124" y="11.5" width="235" height="21"/>
                                                    <nil key="textColor"/>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <textInputTraits key="textInputTraits"/>
                                                </textField>
                                            </subviews>
                                            <constraints>
                                                <constraint firstItem="SAI-3c-VBt" firstAttribute="leading" secondItem="Drc-sv-gqn" secondAttribute="leadingMargin" id="1S9-wd-uDV"/>
316
317
318
319
320
321
322
323

324
325
326
327
328
329
330
331
332

333
334
335
336
337
338
339
349
350
351
352
353
354
355

356
357
358
359
360
361
362
363
364

365
366
367
368
369
370
371
372







-
+








-
+







                                        <rect key="frame" x="0.0" y="79" width="375" height="44"/>
                                        <autoresizingMask key="autoresizingMask"/>
                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="6NO-g9-dsf" id="UWL-vW-ZHk">
                                            <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
                                            <autoresizingMask key="autoresizingMask"/>
                                            <subviews>
                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Length" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EKx-FZ-XDX">
                                                    <rect key="frame" x="8" y="11.5" width="100" height="20.5"/>
                                                    <rect key="frame" x="16" y="11.5" width="100" height="20.5"/>
                                                    <constraints>
                                                        <constraint firstAttribute="width" constant="100" id="ZLB-KT-EH6"/>
                                                    </constraints>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <nil key="textColor"/>
                                                    <nil key="highlightedColor"/>
                                                </label>
                                                <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="left" contentVerticalAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Lp1-jC-8cn">
                                                    <rect key="frame" x="116" y="11.5" width="251" height="21"/>
                                                    <rect key="frame" x="124" y="11.5" width="235" height="21"/>
                                                    <nil key="textColor"/>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <textInputTraits key="textInputTraits" keyboardType="numberPad"/>
                                                </textField>
                                            </subviews>
                                            <constraints>
                                                <constraint firstItem="EKx-FZ-XDX" firstAttribute="centerY" secondItem="Lp1-jC-8cn" secondAttribute="centerY" id="EZm-yW-Ckn"/>
352
353
354
355
356
357
358
359

360
361
362
363
364
365
366
367
368

369
370
371
372
373
374
375
376
377
378
































379
380
381
382
383
384

385
386
387
388
389
390
391

392
393
394
395
396
397
398
399
400

401
402
403
404
405
406
407
385
386
387
388
389
390
391

392
393
394
395
396
397
398
399
400

401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448

449
450
451
452
453
454
455

456
457
458
459
460
461
462
463
464

465
466
467
468
469
470
471
472







-
+








-
+










+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+





-
+






-
+








-
+







                                        <rect key="frame" x="0.0" y="159" width="375" height="44"/>
                                        <autoresizingMask key="autoresizingMask"/>
                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="b0f-WS-wGd" id="Tej-UW-yK7">
                                            <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
                                            <autoresizingMask key="autoresizingMask"/>
                                            <subviews>
                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Legacy" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sLx-Wk-oJm">
                                                    <rect key="frame" x="8" y="11.5" width="100" height="20.5"/>
                                                    <rect key="frame" x="16" y="11.5" width="100" height="20.5"/>
                                                    <constraints>
                                                        <constraint firstAttribute="width" constant="100" id="47g-NW-zSf"/>
                                                    </constraints>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <nil key="textColor"/>
                                                    <nil key="highlightedColor"/>
                                                </label>
                                                <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="qW3-51-hZP">
                                                    <rect key="frame" x="318" y="6.5" width="51" height="31"/>
                                                    <rect key="frame" x="310" y="6.5" width="51" height="31"/>
                                                </switch>
                                            </subviews>
                                            <constraints>
                                                <constraint firstItem="sLx-Wk-oJm" firstAttribute="centerY" secondItem="qW3-51-hZP" secondAttribute="centerY" id="D1R-xs-cHg"/>
                                                <constraint firstItem="sLx-Wk-oJm" firstAttribute="centerY" secondItem="Tej-UW-yK7" secondAttribute="centerY" id="D8l-CY-P1l"/>
                                                <constraint firstItem="sLx-Wk-oJm" firstAttribute="leading" secondItem="Tej-UW-yK7" secondAttribute="leadingMargin" id="p4T-Nx-CZ7"/>
                                                <constraint firstItem="qW3-51-hZP" firstAttribute="trailing" secondItem="Tej-UW-yK7" secondAttribute="trailingMargin" id="ze1-Zm-Lsu"/>
                                            </constraints>
                                        </tableViewCellContentView>
                                    </tableViewCell>
                                    <tableViewCell clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="RPi-sp-ryP">
                                        <rect key="frame" x="0.0" y="203" width="375" height="44"/>
                                        <autoresizingMask key="autoresizingMask"/>
                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="RPi-sp-ryP" id="4am-uF-Se2">
                                            <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
                                            <autoresizingMask key="autoresizingMask"/>
                                            <subviews>
                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Key file" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PyO-Yg-5aA">
                                                    <rect key="frame" x="16" y="11.5" width="100" height="21"/>
                                                    <constraints>
                                                        <constraint firstAttribute="width" constant="100" id="w67-w2-NBo"/>
                                                    </constraints>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <nil key="textColor"/>
                                                    <nil key="highlightedColor"/>
                                                </label>
                                                <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="None" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="pZW-y5-2H8">
                                                    <rect key="frame" x="124" y="11.5" width="235" height="21"/>
                                                    <nil key="textColor"/>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <textInputTraits key="textInputTraits"/>
                                                </textField>
                                            </subviews>
                                            <constraints>
                                                <constraint firstItem="pZW-y5-2H8" firstAttribute="trailing" secondItem="4am-uF-Se2" secondAttribute="trailingMargin" id="LNC-PD-z2J"/>
                                                <constraint firstItem="PyO-Yg-5aA" firstAttribute="leading" secondItem="4am-uF-Se2" secondAttribute="leadingMargin" id="g1g-dd-t6P"/>
                                                <constraint firstItem="pZW-y5-2H8" firstAttribute="centerY" secondItem="4am-uF-Se2" secondAttribute="centerY" id="lcF-a8-qo5"/>
                                                <constraint firstItem="PyO-Yg-5aA" firstAttribute="centerY" secondItem="pZW-y5-2H8" secondAttribute="centerY" id="pCt-QO-MUH"/>
                                                <constraint firstItem="pZW-y5-2H8" firstAttribute="leading" secondItem="PyO-Yg-5aA" secondAttribute="trailing" constant="8" symbolic="YES" id="sxD-pQ-cka"/>
                                            </constraints>
                                        </tableViewCellContentView>
                                    </tableViewCell>
                                </cells>
                            </tableViewSection>
                            <tableViewSection id="pLW-Tc-sKf">
                                <cells>
                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="HHm-l0-c0d">
                                        <rect key="frame" x="0.0" y="239" width="375" height="44"/>
                                        <rect key="frame" x="0.0" y="283" width="375" height="44"/>
                                        <autoresizingMask key="autoresizingMask"/>
                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="HHm-l0-c0d" id="4qT-tm-wo7">
                                            <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
                                            <autoresizingMask key="autoresizingMask"/>
                                            <subviews>
                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Passphrase" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fAW-aP-GN9">
                                                    <rect key="frame" x="8" y="11.5" width="100" height="20.5"/>
                                                    <rect key="frame" x="16" y="11.5" width="100" height="20.5"/>
                                                    <constraints>
                                                        <constraint firstAttribute="width" constant="100" id="wRI-ys-67O"/>
                                                    </constraints>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <nil key="textColor"/>
                                                    <nil key="highlightedColor"/>
                                                </label>
                                                <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" highlighted="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Required" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="DJv-Ey-Hka">
                                                    <rect key="frame" x="116" y="11.5" width="251" height="21"/>
                                                    <rect key="frame" x="124" y="11.5" width="235" height="21"/>
                                                    <nil key="textColor"/>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" returnKeyType="done" secureTextEntry="YES"/>
                                                    <connections>
                                                        <outlet property="delegate" destination="ayJ-fs-aIU" id="IuL-Kw-qIq"/>
                                                    </connections>
                                                </textField>
416
417
418
419
420
421
422
423

424
425
426
427
428
429
430

431
432
433
434
435
436
437
438
439
440
441
442
443
444
445

446
447
448
449
450
451
452

453
454
455
456
457
458
459
481
482
483
484
485
486
487

488
489
490
491
492
493
494

495
496
497
498
499
500
501
502
503
504
505
506
507
508
509

510
511
512
513
514
515
516

517
518
519
520
521
522
523
524







-
+






-
+














-
+






-
+







                                        </tableViewCellContentView>
                                    </tableViewCell>
                                </cells>
                            </tableViewSection>
                            <tableViewSection id="3SB-Gu-7Nb">
                                <cells>
                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="zL5-5B-O5f">
                                        <rect key="frame" x="0.0" y="319" width="375" height="44"/>
                                        <rect key="frame" x="0.0" y="363" width="375" height="44"/>
                                        <autoresizingMask key="autoresizingMask"/>
                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="zL5-5B-O5f" id="WMu-8w-qhO">
                                            <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
                                            <autoresizingMask key="autoresizingMask"/>
                                            <subviews>
                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Generate and Copy to Clipboard" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sss-5e-vm2">
                                                    <rect key="frame" x="8" y="8" width="359" height="27.5"/>
                                                    <rect key="frame" x="16" y="11" width="343" height="21.5"/>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <color key="textColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                    <nil key="highlightedColor"/>
                                                </label>
                                            </subviews>
                                            <constraints>
                                                <constraint firstItem="sss-5e-vm2" firstAttribute="leading" secondItem="WMu-8w-qhO" secondAttribute="leadingMargin" id="Gm5-eD-xPi"/>
                                                <constraint firstItem="sss-5e-vm2" firstAttribute="centerY" secondItem="WMu-8w-qhO" secondAttribute="centerY" id="OXC-y2-7gS"/>
                                                <constraint firstItem="sss-5e-vm2" firstAttribute="top" secondItem="WMu-8w-qhO" secondAttribute="topMargin" id="joe-t9-o2R"/>
                                                <constraint firstItem="sss-5e-vm2" firstAttribute="trailing" secondItem="WMu-8w-qhO" secondAttribute="trailingMargin" id="r2a-xm-CaS"/>
                                            </constraints>
                                        </tableViewCellContentView>
                                    </tableViewCell>
                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="ojF-JZ-yCg">
                                        <rect key="frame" x="0.0" y="363" width="375" height="44"/>
                                        <rect key="frame" x="0.0" y="407" width="375" height="44"/>
                                        <autoresizingMask key="autoresizingMask"/>
                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ojF-JZ-yCg" id="bbw-fx-dOK">
                                            <rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
                                            <autoresizingMask key="autoresizingMask"/>
                                            <subviews>
                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Generate and Show" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Tib-hU-gDm">
                                                    <rect key="frame" x="8" y="8" width="359" height="27.5"/>
                                                    <rect key="frame" x="16" y="11" width="343" height="21.5"/>
                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                    <color key="textColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                                    <nil key="highlightedColor"/>
                                                </label>
                                            </subviews>
                                            <constraints>
                                                <constraint firstItem="Tib-hU-gDm" firstAttribute="centerY" secondItem="bbw-fx-dOK" secondAttribute="centerY" id="BBD-RX-b7u"/>
476
477
478
479
480
481
482

483
484
485
486
487
488
489
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555







+







                            <color key="tintColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
                            <connections>
                                <action selector="remove:" destination="ayJ-fs-aIU" id="0mA-Jx-Oqa"/>
                            </connections>
                        </barButtonItem>
                    </navigationItem>
                    <connections>
                        <outlet property="keyFileField" destination="pZW-y5-2H8" id="oXl-vz-5JQ"/>
                        <outlet property="legacySwitch" destination="qW3-51-hZP" id="NsI-F3-hVQ"/>
                        <outlet property="lengthField" destination="Lp1-jC-8cn" id="05B-m5-JnB"/>
                        <outlet property="nameField" destination="4Le-mO-AdY" id="kSd-Rz-Zai"/>
                        <outlet property="passphraseField" destination="DJv-Ey-Hka" id="zkA-6v-zc1"/>
                    </connections>
                </tableViewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="o5r-z3-hVF" userLabel="First Responder" sceneMemberID="firstResponder"/>

Modified iOS/ShowDetailsController.h from [e5d1d1c4ed] to [7882b18344].

26
27
28
29
30
31
32

33
34
35
36
37

38
39
40
41
42
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44







+





+






@interface ShowDetailsController: UITableViewController <UITableViewDelegate,
    UITextFieldDelegate>
{
	OFString *_name;
	size_t _length;
	bool _legacy;
	OFString *_keyFile;
}

@property (retain, nonatomic) IBOutlet UITextField *nameField;
@property (retain, nonatomic) IBOutlet UITextField *lengthField;
@property (retain, nonatomic) IBOutlet UISwitch *legacySwitch;
@property (retain, nonatomic) IBOutlet UITextField *keyFileField;
@property (retain, nonatomic) IBOutlet UITextField *passphraseField;
@property (retain) MainViewController *mainViewController;

- (IBAction)remove: (id)sender;
@end

Modified iOS/ShowDetailsController.m from [2b5b06f627] to [3e64773eef].

52
53
54
55
56
57
58


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

77
78

79
80
81
82

83
84
85
86
87
88
89
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93







+
+

















-
+


+




+







@implementation ShowDetailsController
- (void)dealloc
{
	[_name release];
	[_nameField release];
	[_lengthField release];
	[_legacySwitch release];
	[_keyFile release];
	[_keyFileField release];
	[_passphraseField release];
	[_mainViewController release];

	[super dealloc];
}

- (void)viewWillAppear: (BOOL)animated
{
	SiteStorage *siteStorage;
	NSIndexPath *indexPath;

	[super viewWillAppear: animated];

	siteStorage = self.mainViewController.siteStorage;
	indexPath = self.mainViewController.tableView.indexPathForSelectedRow;

	[_name release];
	_name = [self.mainViewController.sites[indexPath.row] retain];
	_name = [self.mainViewController.sites[indexPath.row] copy];
	_length = [siteStorage lengthForSite: _name];
	_legacy = [siteStorage isSiteLegacy: _name];
	_keyFile = [[siteStorage keyFileForSite: _name] copy];

	self.nameField.text = _name.NSObject;
	self.lengthField.text = [NSString stringWithFormat: @"%zu", _length];
	self.legacySwitch.on = _legacy;
	self.keyFileField.text = _keyFile.NSObject;

	[self.mainViewController.tableView deselectRowAtIndexPath: indexPath
							 animated: YES];
}

- (void)viewDidAppear: (BOOL)animated
{

Modified iOS/SiteStorage.h from [0d8dca83ec] to [8a1dad4503].

21
22
23
24
25
26
27
28

29
30
31
32
33
34
35
36

37
38
39


40
41
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35
36
37
38
39

40
41
42
43







-
+








+


-
+
+


 */

#import <ObjFW/ObjFW.h>

@interface SiteStorage: OFObject
{
	OFString *_path;
	OFMutableDictionary<OFString *, OFDictionary<OFNumber *, OFNumber *> *>
	OFMutableDictionary<OFString *, OFDictionary<OFNumber *, id> *>
	    *_storage;
	OFArray *_sites;
}

- (OFArray<OFString *> *)sitesWithFilter: (OFString *)filter;
- (bool)hasSite: (OFString *)name;
- (size_t)lengthForSite: (OFString *)name;
- (bool)isSiteLegacy: (OFString *)name;
- (OFString *)keyFileForSite: (OFString *)name;
- (void)setSite: (OFString *)site
	 length: (size_t)length
	 legacy: (bool)legacy;
	 legacy: (bool)legacy
	keyFile: (OFString *)keyFile;
- (void)removeSite: (OFString *)name;
@end

Modified iOS/SiteStorage.m from [5a420f4ea2] to [47936472f3].

24
25
26
27
28
29
30
31

32
33
34
35
36
37

38
39
40

41
42
43
44
45
46
47




48
49
50



51
52
53


54
55
56
57
58
59
60






61
62
63


64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83


84
85
86
87
88
89
90
91
92










93
94
95


96
97
98



99
100
101
102
103
104
105
106
107
108
109

110
111
112
113
114
115
116
117
118
119

120
121
122
123
124
125
126
















127
128
129

130
131



132






133
134


135
136
137
138


139
140
141
142
143
144
145
146
147
148
149
150

151
152

153
154
155
156



157
158
159
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38
39
40

41
42
43
44
45



46
47
48
49
50


51
52
53
54


55
56
57






58
59
60
61
62
63
64


65
66

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87









88
89
90
91
92
93
94
95
96
97
98


99
100
101


102
103
104
105
106
107
108
109
110
111
112
113
114

115
116
117
118
119
120
121
122
123
124

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153

154
155
156
157
158
159
160
161
162
163


164
165




166
167

168
169
170
171
172
173
174
175
176
177

178


179
180



181
182
183

184
185







-
+






+


-
+




-
-
-
+
+
+
+

-
-
+
+
+

-
-
+
+

-
-
-
-
-
-
+
+
+
+
+
+

-
-
+
+
-



















+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+

-
-
+
+

-
-
+
+
+










-
+









-
+







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+



+

-
+
+
+

+
+
+
+
+
+
-
-
+
+
-
-
-
-
+
+
-










-
+
-
-
+

-
-
-
+
+
+
-



#import "SiteStorage.h"

@interface SiteStorage ()
- (void)_update;
@end

static OFNumber *lengthField, *legacyField;
static OFNumber *lengthField, *legacyField, *keyFileField;

@implementation SiteStorage
+ (void)initialize
{
	lengthField = [@(UINT8_C(0)) retain];
	legacyField = [@(UINT8_C(1)) retain];
	keyFileField = [@(UINT8_C(2)) retain];
}

- init
- (instancetype)init
{
	self = [super init];

	@try {
		void *pool = objc_autoreleasePoolPush();
		OFFileManager *fileManager = [OFFileManager defaultManager];
		OFString *userDataPath = [OFSystemInfo userDataPath];
		@autoreleasepool {
			OFFileManager *fileManager =
			    OFFileManager.defaultManager;
			OFString *userDataPath = OFSystemInfo.userDataPath;

		if (![fileManager directoryExistsAtPath: userDataPath])
			[fileManager createDirectoryAtPath: userDataPath];
			if (![fileManager directoryExistsAtPath: userDataPath])
				[fileManager
				    createDirectoryAtPath: userDataPath];

		_path = [[userDataPath stringByAppendingPathComponent:
		    @"sites.msgpack"] retain];
			_path = [[userDataPath stringByAppendingPathComponent:
			    @"sites.msgpack"] copy];

		@try {
			_storage = [[[OFData dataWithContentsOfFile: _path]
			    messagePackValue] mutableCopy];
		} @catch (id e) {
			_storage = [[OFMutableDictionary alloc] init];
		}
			@try {
				_storage = [[OFData dataWithContentsOfFile:
				    _path].messagePackValue mutableCopy];
			} @catch (id e) {
				_storage = [[OFMutableDictionary alloc] init];
			}

		_sites = [[[_storage allKeys] sortedArray] retain];

			_sites = [_storage.allKeys.sortedArray retain];
		}
		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (void)dealloc
{
	[_path release];
	[_storage release];
	[_sites release];

	[super dealloc];
}

- (OFArray<OFString *> *)sitesWithFilter: (OFString *)filter
{
	OFArray<OFString *> *sites;

	void *pool = objc_autoreleasePoolPush();
	/*
	 * FIXME: We need case folding here, but there is no method for it yet.
	 */
	filter = [filter lowercaseString];
	OFArray *sites = [[[_storage allKeys] sortedArray]
	    filteredArrayUsingBlock: ^ (id name, size_t index) {
		if (filter == nil)
			return true;
	@autoreleasepool {
		/*
		 * FIXME: We need case folding here, but there is no method for
		 *	  it yet.
		 */
		filter = filter.lowercaseString;
		sites = [_storage.allKeys.sortedArray
		    filteredArrayUsingBlock: ^ (OFString *name, size_t index) {
			if (filter == nil)
				return true;

		return [[name lowercaseString] containsString: filter];
	}];
			return [name.lowercaseString containsString: filter];
		}];

	[sites retain];
	objc_autoreleasePoolPop(pool);
		[sites retain];
	}

	return [sites autorelease];
}

- (bool)hasSite: (OFString *)name
{
	return (_storage[name] != nil);
}

- (size_t)lengthForSite: (OFString *)name
{
	OFDictionary *site = _storage[name];
	OFDictionary<OFNumber *, id> *site = _storage[name];

	if (site == nil)
		@throw [OFInvalidArgumentException exception];

	return [site[lengthField] sizeValue];
}

- (bool)isSiteLegacy: (OFString *)name
{
	OFDictionary *site = _storage[name];
	OFDictionary<OFNumber *, id> *site = _storage[name];

	if (site == nil)
		@throw [OFInvalidArgumentException exception];

	return [site[legacyField] boolValue];
}

- (OFString *)keyFileForSite: (OFString *)name
{
	OFDictionary<OFNumber *, id> *site = _storage[name];
	OFString *keyFile;

	if (site == nil)
		@throw [OFInvalidArgumentException exception];

	keyFile = site[keyFileField];

	if ([keyFile isEqual: [OFNull null]])
		return nil;

	return keyFile;
}

- (void)setSite: (OFString *)site
	 length: (size_t)length
	 legacy: (bool)legacy
	keyFile: (OFString *)keyFile
{
	void *pool = objc_autoreleasePoolPush();
	@autoreleasepool {
		OFMutableDictionary *siteDictionary =
		    [OFMutableDictionary dictionary];

		siteDictionary[lengthField] = @(length);
		siteDictionary[legacyField] = @(legacy);
		siteDictionary[keyFileField] = keyFile;

		[siteDictionary makeImmutable];

	_storage[site] = @{
		lengthField: @(length),
		_storage[site] = siteDictionary;

		legacyField: @(legacy)
	};
	[self _update];

		[self _update];
	}
	objc_autoreleasePoolPop(pool);
}

- (void)removeSite: (OFString *)name
{
	[_storage removeObjectForKey: name];
	[self _update];
}

- (void)_update
{
	void *pool = objc_autoreleasePoolPush();
	@autoreleasepool {

	[[_storage messagePackRepresentation] writeToFile: _path];
		[_storage.messagePackRepresentation writeToFile: _path];

	[_sites release];
	_sites = [[[_storage allKeys] sortedArray] retain];

		[_sites release];
		_sites = [_storage.allKeys.sortedArray retain];
	}
	objc_autoreleasePoolPop(pool);
}
@end