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.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/doc/Imp.html +235 -0
- data/doc/Imp/Commands.html +1211 -0
- data/doc/Imp/Crypto.html +684 -0
- data/doc/Imp/EncryptedFile.html +539 -0
- data/doc/Imp/EncryptedTree.html +1108 -0
- data/doc/Imp/Tree.html +1073 -0
- data/doc/Imp/UI.html +528 -0
- data/doc/Imp/Util.html +359 -0
- data/doc/PasswdManage.html +153 -0
- data/doc/PasswdManage/Commands.html +1086 -0
- data/doc/PasswdManage/Crypto.html +684 -0
- data/doc/PasswdManage/EncryptedFile.html +533 -0
- data/doc/PasswdManage/EncryptedTree.html +1108 -0
- data/doc/PasswdManage/Tree.html +1063 -0
- data/doc/PasswdManage/UI.html +538 -0
- data/doc/PasswdManage/Util.html +224 -0
- data/doc/_index.html +191 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +338 -0
- data/doc/file.README.html +98 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +98 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +311 -0
- data/doc/top-level-namespace.html +112 -0
- data/imp.gemspec +1 -1
- data/lib/imp.rb +1 -1
- data/lib/imp/commands.rb +14 -1
- metadata +33 -3
data/doc/Imp/Crypto.html
ADDED
@@ -0,0 +1,684 @@
|
|
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
|
+
Module: Imp::Crypto
|
8
|
+
|
9
|
+
— 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 (C)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Imp.html" title="Imp (module)">Imp</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Crypto</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>Module: Imp::Crypto
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/imp/crypto.rb</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
<h2>Overview</h2><div class="docstring">
|
88
|
+
<div class="discussion">
|
89
|
+
|
90
|
+
<p>Contains methods for easily interfacing with ruby's encryption
|
91
|
+
algorithms. Uses 256 bit AES in CBC mode with keys generated by PBKDF2
|
92
|
+
using SHA1 and 10 000 iterations.</p>
|
93
|
+
|
94
|
+
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
<div class="tags">
|
98
|
+
|
99
|
+
|
100
|
+
</div>
|
101
|
+
<h2>Constant Summary</h2>
|
102
|
+
|
103
|
+
<dl class="constants">
|
104
|
+
|
105
|
+
<dt id="KEYLEN-constant" class="">KEYLEN =
|
106
|
+
<div class="docstring">
|
107
|
+
<div class="discussion">
|
108
|
+
|
109
|
+
<p>The length of the key to use. This module used AES-256, which has a key
|
110
|
+
length of 32 bytes.</p>
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div class="tags">
|
116
|
+
|
117
|
+
|
118
|
+
</div>
|
119
|
+
</dt>
|
120
|
+
<dd><pre class="code"><span class='int'>32</span></pre></dd>
|
121
|
+
|
122
|
+
<dt id="BLOCK_SIZE-constant" class="">BLOCK_SIZE =
|
123
|
+
<div class="docstring">
|
124
|
+
<div class="discussion">
|
125
|
+
|
126
|
+
<p>The block size of the cipher. As this module uses AES, this is 16 bytes.</p>
|
127
|
+
|
128
|
+
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
<div class="tags">
|
132
|
+
|
133
|
+
|
134
|
+
</div>
|
135
|
+
</dt>
|
136
|
+
<dd><pre class="code"><span class='int'>16</span></pre></dd>
|
137
|
+
|
138
|
+
<dt id="SALTLEN-constant" class="">SALTLEN =
|
139
|
+
<div class="docstring">
|
140
|
+
<div class="discussion">
|
141
|
+
|
142
|
+
<p>The length of the salts to generate. The length is used as that of the key.</p>
|
143
|
+
|
144
|
+
|
145
|
+
</div>
|
146
|
+
</div>
|
147
|
+
<div class="tags">
|
148
|
+
|
149
|
+
|
150
|
+
</div>
|
151
|
+
</dt>
|
152
|
+
<dd><pre class="code"><span class='const'>KEYLEN</span></pre></dd>
|
153
|
+
|
154
|
+
<dt id="ITER-constant" class="">ITER =
|
155
|
+
<div class="docstring">
|
156
|
+
<div class="discussion">
|
157
|
+
|
158
|
+
<p>The iteration of the PBKDF2 algorim to go through.</p>
|
159
|
+
|
160
|
+
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
<div class="tags">
|
164
|
+
|
165
|
+
|
166
|
+
</div>
|
167
|
+
</dt>
|
168
|
+
<dd><pre class="code"><span class='int'>10_000</span></pre></dd>
|
169
|
+
|
170
|
+
<dt id="MODE-constant" class="">MODE =
|
171
|
+
<div class="docstring">
|
172
|
+
<div class="discussion">
|
173
|
+
|
174
|
+
<p>The mode of AES to use.</p>
|
175
|
+
|
176
|
+
|
177
|
+
</div>
|
178
|
+
</div>
|
179
|
+
<div class="tags">
|
180
|
+
|
181
|
+
|
182
|
+
</div>
|
183
|
+
</dt>
|
184
|
+
<dd><pre class="code"><span class='symbol'>:CBC</span></pre></dd>
|
185
|
+
|
186
|
+
</dl>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
<h2>
|
197
|
+
Class Method Summary
|
198
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
199
|
+
</h2>
|
200
|
+
|
201
|
+
<ul class="summary">
|
202
|
+
|
203
|
+
<li class="public ">
|
204
|
+
<span class="summary_signature">
|
205
|
+
|
206
|
+
<a href="#decrypt-class_method" title="decrypt (class method)">+ (String) <strong>decrypt</strong>(key, data) </a>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
</span>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
<span class="summary_desc"><div class='inline'>
|
221
|
+
<p>Decrypts a string encrypted by ::encrypt.</p>
|
222
|
+
</div></span>
|
223
|
+
|
224
|
+
</li>
|
225
|
+
|
226
|
+
|
227
|
+
<li class="public ">
|
228
|
+
<span class="summary_signature">
|
229
|
+
|
230
|
+
<a href="#encrypt-class_method" title="encrypt (class method)">+ (String) <strong>encrypt</strong>(key, data) </a>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
</span>
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
<span class="summary_desc"><div class='inline'>
|
245
|
+
<p>Encrypts a string.</p>
|
246
|
+
</div></span>
|
247
|
+
|
248
|
+
</li>
|
249
|
+
|
250
|
+
|
251
|
+
<li class="public ">
|
252
|
+
<span class="summary_signature">
|
253
|
+
|
254
|
+
<a href="#get_key-class_method" title="get_key (class method)">+ (String) <strong>get_key</strong>(passwd, salt) </a>
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
</span>
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
<span class="summary_desc"><div class='inline'>
|
269
|
+
<p>Delegates key generation to PBKDF2.</p>
|
270
|
+
</div></span>
|
271
|
+
|
272
|
+
</li>
|
273
|
+
|
274
|
+
|
275
|
+
<li class="public ">
|
276
|
+
<span class="summary_signature">
|
277
|
+
|
278
|
+
<a href="#rand_salt-class_method" title="rand_salt (class method)">+ (String) <strong>rand_salt</strong> </a>
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
</span>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
<span class="summary_desc"><div class='inline'>
|
293
|
+
<p>Gets a random salt.</p>
|
294
|
+
</div></span>
|
295
|
+
|
296
|
+
</li>
|
297
|
+
|
298
|
+
|
299
|
+
</ul>
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
<div id="class_method_details" class="method_details_list">
|
305
|
+
<h2>Class Method Details</h2>
|
306
|
+
|
307
|
+
|
308
|
+
<div class="method_details first">
|
309
|
+
<h3 class="signature first" id="decrypt-class_method">
|
310
|
+
|
311
|
+
+ (<tt>String</tt>) <strong>decrypt</strong>(key, data)
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
</h3><div class="docstring">
|
318
|
+
<div class="discussion">
|
319
|
+
|
320
|
+
<p>Decrypts a string encrypted by ::encrypt</p>
|
321
|
+
|
322
|
+
|
323
|
+
</div>
|
324
|
+
</div>
|
325
|
+
<div class="tags">
|
326
|
+
<p class="tag_title">Parameters:</p>
|
327
|
+
<ul class="param">
|
328
|
+
|
329
|
+
<li>
|
330
|
+
|
331
|
+
<span class='name'>key</span>
|
332
|
+
|
333
|
+
|
334
|
+
<span class='type'>(<tt>String</tt>)</span>
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
—
|
339
|
+
<div class='inline'>
|
340
|
+
<p>The key.</p>
|
341
|
+
</div>
|
342
|
+
|
343
|
+
</li>
|
344
|
+
|
345
|
+
<li>
|
346
|
+
|
347
|
+
<span class='name'>data</span>
|
348
|
+
|
349
|
+
|
350
|
+
<span class='type'>(<tt>String</tt>)</span>
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
—
|
355
|
+
<div class='inline'>
|
356
|
+
<p>The encrypted data.</p>
|
357
|
+
</div>
|
358
|
+
|
359
|
+
</li>
|
360
|
+
|
361
|
+
</ul>
|
362
|
+
|
363
|
+
<p class="tag_title">Returns:</p>
|
364
|
+
<ul class="return">
|
365
|
+
|
366
|
+
<li>
|
367
|
+
|
368
|
+
|
369
|
+
<span class='type'>(<tt>String</tt>)</span>
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
—
|
374
|
+
<div class='inline'>
|
375
|
+
<p>The unencrypted data.</p>
|
376
|
+
</div>
|
377
|
+
|
378
|
+
</li>
|
379
|
+
|
380
|
+
</ul>
|
381
|
+
|
382
|
+
</div><table class="source_code">
|
383
|
+
<tr>
|
384
|
+
<td>
|
385
|
+
<pre class="lines">
|
386
|
+
|
387
|
+
|
388
|
+
60
|
389
|
+
61
|
390
|
+
62
|
391
|
+
63
|
392
|
+
64
|
393
|
+
65
|
394
|
+
66
|
395
|
+
67</pre>
|
396
|
+
</td>
|
397
|
+
<td>
|
398
|
+
<pre class="code"><span class="info file"># File 'lib/imp/crypto.rb', line 60</span>
|
399
|
+
|
400
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_decrypt'>decrypt</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
401
|
+
<span class='id identifier rubyid_cipher'>cipher</span> <span class='op'>=</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>Cipher</span><span class='op'>::</span><span class='const'>AES</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>KEYLEN</span> <span class='op'>*</span> <span class='int'>8</span><span class='comma'>,</span> <span class='const'>MODE</span><span class='rparen'>)</span>
|
402
|
+
<span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_decrypt'>decrypt</span>
|
403
|
+
<span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_iv'>iv</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_byteslice'>byteslice</span> <span class='int'>0</span><span class='op'>...</span><span class='const'>BLOCK_SIZE</span>
|
404
|
+
<span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span>
|
405
|
+
|
406
|
+
<span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_update'>update</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_byteslice'>byteslice</span> <span class='const'>BLOCK_SIZE</span><span class='op'>..</span><span class='op'>-</span><span class='int'>1</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_final'>final</span>
|
407
|
+
<span class='kw'>end</span></pre>
|
408
|
+
</td>
|
409
|
+
</tr>
|
410
|
+
</table>
|
411
|
+
</div>
|
412
|
+
|
413
|
+
<div class="method_details ">
|
414
|
+
<h3 class="signature " id="encrypt-class_method">
|
415
|
+
|
416
|
+
+ (<tt>String</tt>) <strong>encrypt</strong>(key, data)
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
</h3><div class="docstring">
|
423
|
+
<div class="discussion">
|
424
|
+
|
425
|
+
<p>Encrypts a string. The result is the IV, followed by the actual encrypted
|
426
|
+
string.</p>
|
427
|
+
|
428
|
+
|
429
|
+
</div>
|
430
|
+
</div>
|
431
|
+
<div class="tags">
|
432
|
+
<p class="tag_title">Parameters:</p>
|
433
|
+
<ul class="param">
|
434
|
+
|
435
|
+
<li>
|
436
|
+
|
437
|
+
<span class='name'>key</span>
|
438
|
+
|
439
|
+
|
440
|
+
<span class='type'>(<tt>String</tt>)</span>
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
—
|
445
|
+
<div class='inline'>
|
446
|
+
<p>The key.</p>
|
447
|
+
</div>
|
448
|
+
|
449
|
+
</li>
|
450
|
+
|
451
|
+
<li>
|
452
|
+
|
453
|
+
<span class='name'>data</span>
|
454
|
+
|
455
|
+
|
456
|
+
<span class='type'>(<tt>String</tt>)</span>
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
—
|
461
|
+
<div class='inline'>
|
462
|
+
<p>The unencrypted data.</p>
|
463
|
+
</div>
|
464
|
+
|
465
|
+
</li>
|
466
|
+
|
467
|
+
</ul>
|
468
|
+
|
469
|
+
<p class="tag_title">Returns:</p>
|
470
|
+
<ul class="return">
|
471
|
+
|
472
|
+
<li>
|
473
|
+
|
474
|
+
|
475
|
+
<span class='type'>(<tt>String</tt>)</span>
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
—
|
480
|
+
<div class='inline'>
|
481
|
+
<p>The encrypted data.</p>
|
482
|
+
</div>
|
483
|
+
|
484
|
+
</li>
|
485
|
+
|
486
|
+
</ul>
|
487
|
+
|
488
|
+
</div><table class="source_code">
|
489
|
+
<tr>
|
490
|
+
<td>
|
491
|
+
<pre class="lines">
|
492
|
+
|
493
|
+
|
494
|
+
46
|
495
|
+
47
|
496
|
+
48
|
497
|
+
49
|
498
|
+
50
|
499
|
+
51
|
500
|
+
52
|
501
|
+
53</pre>
|
502
|
+
</td>
|
503
|
+
<td>
|
504
|
+
<pre class="code"><span class="info file"># File 'lib/imp/crypto.rb', line 46</span>
|
505
|
+
|
506
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_encrypt'>encrypt</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
507
|
+
<span class='id identifier rubyid_cipher'>cipher</span> <span class='op'>=</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>Cipher</span><span class='op'>::</span><span class='const'>AES</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>KEYLEN</span> <span class='op'>*</span> <span class='int'>8</span><span class='comma'>,</span> <span class='const'>MODE</span><span class='rparen'>)</span>
|
508
|
+
<span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_encrypt'>encrypt</span>
|
509
|
+
<span class='id identifier rubyid_iv'>iv</span> <span class='op'>=</span> <span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_random_iv'>random_iv</span>
|
510
|
+
<span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span>
|
511
|
+
|
512
|
+
<span class='id identifier rubyid_iv'>iv</span> <span class='op'>+</span> <span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_update'>update</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='id identifier rubyid_cipher'>cipher</span><span class='period'>.</span><span class='id identifier rubyid_final'>final</span>
|
513
|
+
<span class='kw'>end</span></pre>
|
514
|
+
</td>
|
515
|
+
</tr>
|
516
|
+
</table>
|
517
|
+
</div>
|
518
|
+
|
519
|
+
<div class="method_details ">
|
520
|
+
<h3 class="signature " id="get_key-class_method">
|
521
|
+
|
522
|
+
+ (<tt>String</tt>) <strong>get_key</strong>(passwd, salt)
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
</h3><div class="docstring">
|
529
|
+
<div class="discussion">
|
530
|
+
|
531
|
+
<p>Delegates key generation to PBKDF2</p>
|
532
|
+
|
533
|
+
|
534
|
+
</div>
|
535
|
+
</div>
|
536
|
+
<div class="tags">
|
537
|
+
<p class="tag_title">Parameters:</p>
|
538
|
+
<ul class="param">
|
539
|
+
|
540
|
+
<li>
|
541
|
+
|
542
|
+
<span class='name'>passwd</span>
|
543
|
+
|
544
|
+
|
545
|
+
<span class='type'>(<tt>String</tt>)</span>
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
—
|
550
|
+
<div class='inline'>
|
551
|
+
<p>The password.</p>
|
552
|
+
</div>
|
553
|
+
|
554
|
+
</li>
|
555
|
+
|
556
|
+
<li>
|
557
|
+
|
558
|
+
<span class='name'>salt</span>
|
559
|
+
|
560
|
+
|
561
|
+
<span class='type'>(<tt>String</tt>)</span>
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
—
|
566
|
+
<div class='inline'>
|
567
|
+
<p>The salt.</p>
|
568
|
+
</div>
|
569
|
+
|
570
|
+
</li>
|
571
|
+
|
572
|
+
</ul>
|
573
|
+
|
574
|
+
<p class="tag_title">Returns:</p>
|
575
|
+
<ul class="return">
|
576
|
+
|
577
|
+
<li>
|
578
|
+
|
579
|
+
|
580
|
+
<span class='type'>(<tt>String</tt>)</span>
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
—
|
585
|
+
<div class='inline'>
|
586
|
+
<p>The key.</p>
|
587
|
+
</div>
|
588
|
+
|
589
|
+
</li>
|
590
|
+
|
591
|
+
</ul>
|
592
|
+
|
593
|
+
</div><table class="source_code">
|
594
|
+
<tr>
|
595
|
+
<td>
|
596
|
+
<pre class="lines">
|
597
|
+
|
598
|
+
|
599
|
+
29
|
600
|
+
30
|
601
|
+
31</pre>
|
602
|
+
</td>
|
603
|
+
<td>
|
604
|
+
<pre class="code"><span class="info file"># File 'lib/imp/crypto.rb', line 29</span>
|
605
|
+
|
606
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_key'>get_key</span><span class='lparen'>(</span><span class='id identifier rubyid_passwd'>passwd</span><span class='comma'>,</span> <span class='id identifier rubyid_salt'>salt</span><span class='rparen'>)</span>
|
607
|
+
<span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>PKCS5</span><span class='period'>.</span><span class='id identifier rubyid_pbkdf2_hmac_sha1'>pbkdf2_hmac_sha1</span><span class='lparen'>(</span><span class='id identifier rubyid_passwd'>passwd</span><span class='comma'>,</span> <span class='id identifier rubyid_salt'>salt</span><span class='comma'>,</span> <span class='const'>ITER</span><span class='comma'>,</span> <span class='const'>KEYLEN</span><span class='rparen'>)</span>
|
608
|
+
<span class='kw'>end</span></pre>
|
609
|
+
</td>
|
610
|
+
</tr>
|
611
|
+
</table>
|
612
|
+
</div>
|
613
|
+
|
614
|
+
<div class="method_details ">
|
615
|
+
<h3 class="signature " id="rand_salt-class_method">
|
616
|
+
|
617
|
+
+ (<tt>String</tt>) <strong>rand_salt</strong>
|
618
|
+
|
619
|
+
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
</h3><div class="docstring">
|
624
|
+
<div class="discussion">
|
625
|
+
|
626
|
+
<p>Gets a random salt.</p>
|
627
|
+
|
628
|
+
|
629
|
+
</div>
|
630
|
+
</div>
|
631
|
+
<div class="tags">
|
632
|
+
|
633
|
+
<p class="tag_title">Returns:</p>
|
634
|
+
<ul class="return">
|
635
|
+
|
636
|
+
<li>
|
637
|
+
|
638
|
+
|
639
|
+
<span class='type'>(<tt>String</tt>)</span>
|
640
|
+
|
641
|
+
|
642
|
+
|
643
|
+
—
|
644
|
+
<div class='inline'>
|
645
|
+
<p>A salt.</p>
|
646
|
+
</div>
|
647
|
+
|
648
|
+
</li>
|
649
|
+
|
650
|
+
</ul>
|
651
|
+
|
652
|
+
</div><table class="source_code">
|
653
|
+
<tr>
|
654
|
+
<td>
|
655
|
+
<pre class="lines">
|
656
|
+
|
657
|
+
|
658
|
+
36
|
659
|
+
37
|
660
|
+
38</pre>
|
661
|
+
</td>
|
662
|
+
<td>
|
663
|
+
<pre class="code"><span class="info file"># File 'lib/imp/crypto.rb', line 36</span>
|
664
|
+
|
665
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_rand_salt'>rand_salt</span>
|
666
|
+
<span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>Random</span><span class='period'>.</span><span class='id identifier rubyid_random_bytes'>random_bytes</span> <span class='const'>SALTLEN</span>
|
667
|
+
<span class='kw'>end</span></pre>
|
668
|
+
</td>
|
669
|
+
</tr>
|
670
|
+
</table>
|
671
|
+
</div>
|
672
|
+
|
673
|
+
</div>
|
674
|
+
|
675
|
+
</div>
|
676
|
+
|
677
|
+
<div id="footer">
|
678
|
+
Generated on Sun Nov 10 00:39:21 2013 by
|
679
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
680
|
+
0.8.7.3 (ruby-2.0.0).
|
681
|
+
</div>
|
682
|
+
|
683
|
+
</body>
|
684
|
+
</html>
|