imp 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,533 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: PasswdManage::EncryptedFile
8
+
9
+ &mdash; Documentation by YARD 0.8.7.3
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../';
20
+ framesUrl = "../frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (E)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../PasswdManage.html" title="PasswdManage (module)">PasswdManage</a></span></span>
36
+ &raquo;
37
+ <span class="title">EncryptedFile</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: PasswdManage::EncryptedFile
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">PasswdManage::EncryptedFile</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/passwd_manage/crypto.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <div class="note notetag">
106
+ <strong>Note:</strong>
107
+ <div class='inline'>
108
+ <p>This is NOT a file object. The file&#39;s content is loaded entirely into
109
+ memory.</p>
110
+ </div>
111
+ </div>
112
+
113
+
114
+ <p>A rudimentary wrapper to interface with encrypted files.</p>
115
+
116
+ <p>Files are saved as a concatination of the password&#39;s salt and a string
117
+ encrypted with Crypto#encrypt. The string may be marshalled content, or it
118
+ may be the content itself.</p>
119
+
120
+
121
+ </div>
122
+ </div>
123
+ <div class="tags">
124
+
125
+
126
+ </div><div id="subclasses">
127
+ <h2>Direct Known Subclasses</h2>
128
+ <p class="children"><span class='object_link'><a href="EncryptedTree.html" title="PasswdManage::EncryptedTree (class)">EncryptedTree</a></span></p>
129
+ </div>
130
+
131
+
132
+
133
+
134
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
135
+ <ul class="summary">
136
+
137
+ <li class="public ">
138
+ <span class="summary_signature">
139
+
140
+ <a href="#cont-instance_method" title="#cont (instance method)">- (Object) <strong>cont</strong> </a>
141
+
142
+
143
+
144
+ </span>
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+ <span class="summary_desc"><div class='inline'>
158
+ <p>The plaintext content of the encrypted file.</p>
159
+ </div></span>
160
+
161
+ </li>
162
+
163
+
164
+ </ul>
165
+
166
+
167
+
168
+
169
+
170
+ <h2>
171
+ Instance Method Summary
172
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
173
+ </h2>
174
+
175
+ <ul class="summary">
176
+
177
+ <li class="public ">
178
+ <span class="summary_signature">
179
+
180
+ <a href="#close-instance_method" title="#close (instance method)">- (Object) <strong>close</strong> </a>
181
+
182
+
183
+
184
+ </span>
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+ <span class="summary_desc"><div class='inline'>
195
+ <p>Nulls the key.</p>
196
+ </div></span>
197
+
198
+ </li>
199
+
200
+
201
+ <li class="public ">
202
+ <span class="summary_signature">
203
+
204
+ <a href="#flush-instance_method" title="#flush (instance method)">- (Object) <strong>flush</strong> </a>
205
+
206
+
207
+
208
+ </span>
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+ <span class="summary_desc"><div class='inline'>
219
+ <p>Writes the content to the file.</p>
220
+ </div></span>
221
+
222
+ </li>
223
+
224
+
225
+ <li class="public ">
226
+ <span class="summary_signature">
227
+
228
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (EncryptedFile) <strong>initialize</strong>(passwd, file, marshal = true) </a>
229
+
230
+
231
+
232
+ </span>
233
+
234
+
235
+ <span class="note title constructor">constructor</span>
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+ <span class="summary_desc"><div class='inline'>
245
+ <p>If the file exists, load the content from it.</p>
246
+ </div></span>
247
+
248
+ </li>
249
+
250
+
251
+ </ul>
252
+
253
+
254
+ <div id="constructor_details" class="method_details_list">
255
+ <h2>Constructor Details</h2>
256
+
257
+ <div class="method_details first">
258
+ <h3 class="signature first" id="initialize-instance_method">
259
+
260
+ - (<tt><span class='object_link'><a href="" title="PasswdManage::EncryptedFile (class)">EncryptedFile</a></span></tt>) <strong>initialize</strong>(passwd, file, marshal = true)
261
+
262
+
263
+
264
+
265
+
266
+ </h3><div class="docstring">
267
+ <div class="discussion">
268
+
269
+ <p>If the file exists, load the content from it. Otherwise load the content as
270
+ nil, generate a salt and key to prepare for writing.</p>
271
+
272
+
273
+ </div>
274
+ </div>
275
+ <div class="tags">
276
+ <p class="tag_title">Parameters:</p>
277
+ <ul class="param">
278
+
279
+ <li>
280
+
281
+ <span class='name'>passwd</span>
282
+
283
+
284
+ <span class='type'>(<tt>String</tt>)</span>
285
+
286
+
287
+
288
+ &mdash;
289
+ <div class='inline'>
290
+ <p>The password.</p>
291
+ </div>
292
+
293
+ </li>
294
+
295
+ <li>
296
+
297
+ <span class='name'>file</span>
298
+
299
+
300
+ <span class='type'>(<tt>String</tt>)</span>
301
+
302
+
303
+
304
+ &mdash;
305
+ <div class='inline'>
306
+ <p>The location of the file.</p>
307
+ </div>
308
+
309
+ </li>
310
+
311
+ <li>
312
+
313
+ <span class='name'>marshal</span>
314
+
315
+
316
+ <span class='type'>(<tt>Boolean</tt>)</span>
317
+
318
+
319
+ <em class="default">(defaults to: <tt>true</tt>)</em>
320
+
321
+
322
+ &mdash;
323
+ <div class='inline'>
324
+ <p>Whether or not the content is marshalled.</p>
325
+ </div>
326
+
327
+ </li>
328
+
329
+ </ul>
330
+
331
+
332
+ </div><table class="source_code">
333
+ <tr>
334
+ <td>
335
+ <pre class="lines">
336
+
337
+
338
+ 93
339
+ 94
340
+ 95
341
+ 96
342
+ 97
343
+ 98
344
+ 99
345
+ 100
346
+ 101</pre>
347
+ </td>
348
+ <td>
349
+ <pre class="code"><span class="info file"># File 'lib/passwd_manage/crypto.rb', line 93</span>
350
+
351
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_passwd'>passwd</span><span class='comma'>,</span> <span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_marshal'>marshal</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
352
+ <span class='ivar'>@file</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
353
+ <span class='ivar'>@marshal</span> <span class='op'>=</span> <span class='id identifier rubyid_marshal'>marshal</span>
354
+ <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span> <span class='ivar'>@file</span>
355
+ <span class='id identifier rubyid_init_with_file'>init_with_file</span><span class='lparen'>(</span><span class='id identifier rubyid_passwd'>passwd</span><span class='rparen'>)</span>
356
+ <span class='kw'>else</span>
357
+ <span class='id identifier rubyid_first_time_init'>first_time_init</span><span class='lparen'>(</span><span class='id identifier rubyid_passwd'>passwd</span><span class='rparen'>)</span>
358
+ <span class='kw'>end</span>
359
+ <span class='kw'>end</span></pre>
360
+ </td>
361
+ </tr>
362
+ </table>
363
+ </div>
364
+
365
+ </div>
366
+
367
+ <div id="instance_attr_details" class="attr_details">
368
+ <h2>Instance Attribute Details</h2>
369
+
370
+
371
+ <span id="cont=-instance_method"></span>
372
+ <div class="method_details first">
373
+ <h3 class="signature first" id="cont-instance_method">
374
+
375
+ - (<tt>Object</tt>) <strong>cont</strong>
376
+
377
+
378
+
379
+
380
+
381
+ </h3><div class="docstring">
382
+ <div class="discussion">
383
+
384
+ <p>The plaintext content of the encrypted file.</p>
385
+
386
+
387
+ </div>
388
+ </div>
389
+ <div class="tags">
390
+
391
+
392
+ </div><table class="source_code">
393
+ <tr>
394
+ <td>
395
+ <pre class="lines">
396
+
397
+
398
+ 85
399
+ 86
400
+ 87</pre>
401
+ </td>
402
+ <td>
403
+ <pre class="code"><span class="info file"># File 'lib/passwd_manage/crypto.rb', line 85</span>
404
+
405
+ <span class='kw'>def</span> <span class='id identifier rubyid_cont'>cont</span>
406
+ <span class='ivar'>@cont</span>
407
+ <span class='kw'>end</span></pre>
408
+ </td>
409
+ </tr>
410
+ </table>
411
+ </div>
412
+
413
+ </div>
414
+
415
+
416
+ <div id="instance_method_details" class="method_details_list">
417
+ <h2>Instance Method Details</h2>
418
+
419
+
420
+ <div class="method_details first">
421
+ <h3 class="signature first" id="close-instance_method">
422
+
423
+ - (<tt>Object</tt>) <strong>close</strong>
424
+
425
+
426
+
427
+
428
+
429
+ </h3><div class="docstring">
430
+ <div class="discussion">
431
+
432
+ <p>Nulls the key. (It may still be in memory!)</p>
433
+
434
+
435
+ </div>
436
+ </div>
437
+ <div class="tags">
438
+
439
+
440
+ </div><table class="source_code">
441
+ <tr>
442
+ <td>
443
+ <pre class="lines">
444
+
445
+
446
+ 118
447
+ 119
448
+ 120
449
+ 121</pre>
450
+ </td>
451
+ <td>
452
+ <pre class="code"><span class="info file"># File 'lib/passwd_manage/crypto.rb', line 118</span>
453
+
454
+ <span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
455
+ <span class='ivar'>@cont</span> <span class='op'>=</span> <span class='kw'>nil</span>
456
+ <span class='ivar'>@key</span> <span class='op'>=</span> <span class='kw'>nil</span>
457
+ <span class='kw'>end</span></pre>
458
+ </td>
459
+ </tr>
460
+ </table>
461
+ </div>
462
+
463
+ <div class="method_details ">
464
+ <h3 class="signature " id="flush-instance_method">
465
+
466
+ - (<tt>Object</tt>) <strong>flush</strong>
467
+
468
+
469
+
470
+
471
+
472
+ </h3><div class="docstring">
473
+ <div class="discussion">
474
+
475
+ <p>Writes the content to the file.</p>
476
+
477
+
478
+ </div>
479
+ </div>
480
+ <div class="tags">
481
+
482
+
483
+ </div><table class="source_code">
484
+ <tr>
485
+ <td>
486
+ <pre class="lines">
487
+
488
+
489
+ 104
490
+ 105
491
+ 106
492
+ 107
493
+ 108
494
+ 109
495
+ 110
496
+ 111
497
+ 112
498
+ 113
499
+ 114
500
+ 115</pre>
501
+ </td>
502
+ <td>
503
+ <pre class="code"><span class="info file"># File 'lib/passwd_manage/crypto.rb', line 104</span>
504
+
505
+ <span class='kw'>def</span> <span class='id identifier rubyid_flush'>flush</span>
506
+ <span class='id identifier rubyid_f'>f</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@file</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>w</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
507
+ <span class='id identifier rubyid_f'>f</span> <span class='op'>&lt;&lt;</span> <span class='ivar'>@salt</span>
508
+ <span class='kw'>if</span> <span class='ivar'>@marshal</span>
509
+ <span class='id identifier rubyid_cont'>cont</span> <span class='op'>=</span> <span class='const'>Marshal</span><span class='period'>.</span><span class='id identifier rubyid_dump'>dump</span> <span class='ivar'>@cont</span>
510
+ <span class='kw'>else</span>
511
+ <span class='id identifier rubyid_cont'>cont</span> <span class='op'>=</span> <span class='ivar'>@cont</span>
512
+ <span class='kw'>end</span>
513
+ <span class='id identifier rubyid_f'>f</span> <span class='op'>&lt;&lt;</span> <span class='const'>Crypto</span><span class='period'>.</span><span class='id identifier rubyid_encrypt'>encrypt</span><span class='lparen'>(</span><span class='ivar'>@key</span><span class='comma'>,</span> <span class='id identifier rubyid_cont'>cont</span><span class='rparen'>)</span>
514
+ <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
515
+ <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
516
+ <span class='kw'>end</span></pre>
517
+ </td>
518
+ </tr>
519
+ </table>
520
+ </div>
521
+
522
+ </div>
523
+
524
+ </div>
525
+
526
+ <div id="footer">
527
+ Generated on Sat Nov 9 18:07:46 2013 by
528
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
529
+ 0.8.7.3 (ruby-2.0.0).
530
+ </div>
531
+
532
+ </body>
533
+ </html>