r509-validity-redis 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +17 -14
- data/doc/Kernel.html +3 -3
- data/doc/R509.html +2 -2
- data/doc/R509/Validity.html +2 -2
- data/doc/R509/Validity/Redis.html +3 -3
- data/doc/R509/Validity/Redis/Checker.html +17 -17
- data/doc/R509/Validity/Redis/Writer.html +25 -25
- data/doc/_index.html +2 -2
- data/doc/file.README.html +18 -15
- data/doc/index.html +18 -15
- data/doc/top-level-namespace.html +2 -2
- data/lib/r509/validity/redis.rb +6 -6
- data/lib/r509/validity/redis/checker.rb +22 -22
- data/lib/r509/validity/redis/version.rb +4 -4
- data/lib/r509/validity/redis/writer.rb +34 -34
- data/spec/checker_spec.rb +60 -60
- data/spec/spec_helper.rb +2 -4
- data/spec/writer_spec.rb +113 -113
- metadata +74 -39
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e0c8daf706e8f0becb590914e70756a1451eb59f
|
4
|
+
data.tar.gz: a64b4f6c47b85e28475a8adc171bc299b3c29d99
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 734a18bc551efd533f15974dab436de6ea3f6ac5f334aa5a2210d42956a2ef0782771b364e6c2383af497118675e12e96434e3c985384f3a65f91696a586124b
|
7
|
+
data.tar.gz: 372f0aabb5b3f668fcd79e17e7a35a29216d99a2c9130cea10430b3875f26aa6919cab972e15c8484d4e46745251ea6f58988e94599633a4ae4bb07e8d0461f3
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/README.md
CHANGED
@@ -1,30 +1,33 @@
|
|
1
|
-
This project is related to [r509](http://github.com/reaperhulk/r509) and [ocsp-responder](http://github.com/reaperhulk/ocsp-responder), allowing certificate validity and revocation information to be read and written to a Redis backend.
|
1
|
+
This project is related to [r509](http://github.com/reaperhulk/r509), [r509-ca-http](http://github.com/sirsean/r509-ca-http), and [r509-ocsp-responder](http://github.com/reaperhulk/r509-ocsp-responder), allowing certificate validity and revocation information to be read and written to a Redis backend.
|
2
2
|
|
3
3
|
When a certificate is issued, we want this sent to Redis:
|
4
4
|
|
5
|
-
HMSET "cert:<serial>" status 0
|
5
|
+
HMSET "cert:<issuer>:<serial>" status 0
|
6
6
|
|
7
7
|
When revoked:
|
8
8
|
|
9
|
-
HMSET "cert:<serial>" status 1 revocation_time <timestamp> revocation_reason 0
|
9
|
+
HMSET "cert:<issuer>:<serial>" status 1 revocation_time <timestamp> revocation_reason 0
|
10
10
|
|
11
11
|
|
12
12
|
To get the status of a certificate:
|
13
13
|
|
14
|
-
HGETALL "cert:<serial>"
|
14
|
+
HGETALL "cert:<issuer>:<serial>"
|
15
15
|
|
16
16
|
The "status" field can be one of:
|
17
17
|
|
18
18
|
R509::Validity::VALID
|
19
19
|
R509::Validity::REVOKED
|
20
20
|
|
21
|
-
The "
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
)
|
30
|
-
|
21
|
+
The "revocation\_reason" field can be one of:
|
22
|
+
|
23
|
+
null
|
24
|
+
0 (unspecified)
|
25
|
+
1 (keyCompromise)
|
26
|
+
2 (cACompromise)
|
27
|
+
3 (affiliationChanged)
|
28
|
+
4 (superseded)
|
29
|
+
5 (cessationOfOperation)
|
30
|
+
6 (certificateHold)
|
31
|
+
8 (removeFromCRL)
|
32
|
+
9 (privilegeWithdrawn)
|
33
|
+
10 (aACompromise)
|
data/doc/Kernel.html
CHANGED
@@ -153,7 +153,7 @@
|
|
153
153
|
<pre class="code"><span class="info file"># File 'lib/r509/validity/redis.rb', line 5</span>
|
154
154
|
|
155
155
|
<span class='kw'>def</span> <span class='id identifier rubyid_require_relative'>require_relative</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
156
|
-
|
156
|
+
<span class='id identifier rubyid_require'>require</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='id identifier rubyid_caller'>caller</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_to_str'>to_str</span><span class='rparen'>)</span>
|
157
157
|
<span class='kw'>end</span></pre>
|
158
158
|
</td>
|
159
159
|
</tr>
|
@@ -165,9 +165,9 @@
|
|
165
165
|
</div>
|
166
166
|
|
167
167
|
<div id="footer">
|
168
|
-
Generated on
|
168
|
+
Generated on Sun Jan 26 14:17:21 2014 by
|
169
169
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
170
|
-
0.8.6.1 (ruby-
|
170
|
+
0.8.6.1 (ruby-2.0.0).
|
171
171
|
</div>
|
172
172
|
|
173
173
|
</body>
|
data/doc/R509.html
CHANGED
@@ -106,9 +106,9 @@
|
|
106
106
|
</div>
|
107
107
|
|
108
108
|
<div id="footer">
|
109
|
-
Generated on
|
109
|
+
Generated on Sun Jan 26 14:17:21 2014 by
|
110
110
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
|
-
0.8.6.1 (ruby-
|
111
|
+
0.8.6.1 (ruby-2.0.0).
|
112
112
|
</div>
|
113
113
|
|
114
114
|
</body>
|
data/doc/R509/Validity.html
CHANGED
@@ -106,9 +106,9 @@
|
|
106
106
|
</div>
|
107
107
|
|
108
108
|
<div id="footer">
|
109
|
-
Generated on
|
109
|
+
Generated on Sun Jan 26 14:17:21 2014 by
|
110
110
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
|
-
0.8.6.1 (ruby-
|
111
|
+
0.8.6.1 (ruby-2.0.0).
|
112
112
|
</div>
|
113
113
|
|
114
114
|
</body>
|
@@ -104,7 +104,7 @@
|
|
104
104
|
<dt id="VERSION-constant" class="">VERSION =
|
105
105
|
|
106
106
|
</dt>
|
107
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.4.
|
107
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.4.2</span><span class='tstring_end'>"</span></span></pre></dd>
|
108
108
|
|
109
109
|
</dl>
|
110
110
|
|
@@ -120,9 +120,9 @@
|
|
120
120
|
</div>
|
121
121
|
|
122
122
|
<div id="footer">
|
123
|
-
Generated on
|
123
|
+
Generated on Sun Jan 26 14:17:21 2014 by
|
124
124
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
125
|
-
0.8.6.1 (ruby-
|
125
|
+
0.8.6.1 (ruby-2.0.0).
|
126
126
|
</div>
|
127
127
|
|
128
128
|
</body>
|
@@ -241,8 +241,8 @@
|
|
241
241
|
<pre class="code"><span class="info file"># File 'lib/r509/validity/redis/checker.rb', line 5</span>
|
242
242
|
|
243
243
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_redis'>redis</span><span class='rparen'>)</span>
|
244
|
-
|
245
|
-
|
244
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Redis must be provided</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_redis'>redis</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
245
|
+
<span class='ivar'>@redis</span> <span class='op'>=</span> <span class='id identifier rubyid_redis'>redis</span>
|
246
246
|
<span class='kw'>end</span></pre>
|
247
247
|
</td>
|
248
248
|
</tr>
|
@@ -325,18 +325,18 @@
|
|
325
325
|
<pre class="code"><span class="info file"># File 'lib/r509/validity/redis/checker.rb', line 11</span>
|
326
326
|
|
327
327
|
<span class='kw'>def</span> <span class='id identifier rubyid_check'>check</span><span class='lparen'>(</span><span class='id identifier rubyid_issuer'>issuer</span><span class='comma'>,</span><span class='id identifier rubyid_serial'>serial</span><span class='rparen'>)</span>
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
328
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Serial and issuer must be provided</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_serial'>serial</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='kw'>or</span> <span class='id identifier rubyid_issuer'>issuer</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
329
|
+
|
330
|
+
<span class='id identifier rubyid_hash'>hash</span> <span class='op'>=</span> <span class='ivar'>@redis</span><span class='period'>.</span><span class='id identifier rubyid_hgetall'>hgetall</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cert:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_issuer'>issuer</span><span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_serial'>serial</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
331
|
+
<span class='kw'>if</span> <span class='kw'>not</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>and</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>status</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
332
|
+
<span class='const'>R509</span><span class='op'>::</span><span class='const'>Validity</span><span class='op'>::</span><span class='const'>Status</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
333
|
+
<span class='symbol'>:status</span> <span class='op'>=></span> <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>status</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='comma'>,</span>
|
334
|
+
<span class='symbol'>:revocation_time</span> <span class='op'>=></span> <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>revocation_time</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>||</span> <span class='kw'>nil</span><span class='comma'>,</span>
|
335
|
+
<span class='symbol'>:revocation_reason</span> <span class='op'>=></span> <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>revocation_reason</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>||</span> <span class='int'>0</span>
|
336
|
+
<span class='rparen'>)</span>
|
337
|
+
<span class='kw'>else</span>
|
338
|
+
<span class='const'>R509</span><span class='op'>::</span><span class='const'>Validity</span><span class='op'>::</span><span class='const'>Status</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:status</span> <span class='op'>=></span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>Validity</span><span class='op'>::</span><span class='const'>UNKNOWN</span><span class='rparen'>)</span>
|
339
|
+
<span class='kw'>end</span>
|
340
340
|
<span class='kw'>end</span></pre>
|
341
341
|
</td>
|
342
342
|
</tr>
|
@@ -388,7 +388,7 @@
|
|
388
388
|
<pre class="code"><span class="info file"># File 'lib/r509/validity/redis/checker.rb', line 26</span>
|
389
389
|
|
390
390
|
<span class='kw'>def</span> <span class='id identifier rubyid_is_available?'>is_available?</span>
|
391
|
-
|
391
|
+
<span class='lparen'>(</span><span class='ivar'>@redis</span><span class='period'>.</span><span class='id identifier rubyid_ping'>ping</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PONG</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
|
392
392
|
<span class='kw'>end</span></pre>
|
393
393
|
</td>
|
394
394
|
</tr>
|
@@ -400,9 +400,9 @@
|
|
400
400
|
</div>
|
401
401
|
|
402
402
|
<div id="footer">
|
403
|
-
Generated on
|
403
|
+
Generated on Sun Jan 26 14:17:21 2014 by
|
404
404
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
405
|
-
0.8.6.1 (ruby-
|
405
|
+
0.8.6.1 (ruby-2.0.0).
|
406
406
|
</div>
|
407
407
|
|
408
408
|
</body>
|
@@ -285,8 +285,8 @@
|
|
285
285
|
<pre class="code"><span class="info file"># File 'lib/r509/validity/redis/writer.rb', line 5</span>
|
286
286
|
|
287
287
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_redis'>redis</span><span class='rparen'>)</span>
|
288
|
-
|
289
|
-
|
288
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Redis must be provided</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_redis'>redis</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
289
|
+
<span class='ivar'>@redis</span> <span class='op'>=</span> <span class='id identifier rubyid_redis'>redis</span>
|
290
290
|
<span class='kw'>end</span></pre>
|
291
291
|
</td>
|
292
292
|
</tr>
|
@@ -345,7 +345,7 @@
|
|
345
345
|
<pre class="code"><span class="info file"># File 'lib/r509/validity/redis/writer.rb', line 39</span>
|
346
346
|
|
347
347
|
<span class='kw'>def</span> <span class='id identifier rubyid_is_available?'>is_available?</span>
|
348
|
-
|
348
|
+
<span class='lparen'>(</span><span class='ivar'>@redis</span><span class='period'>.</span><span class='id identifier rubyid_ping'>ping</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>PONG</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
|
349
349
|
<span class='kw'>end</span></pre>
|
350
350
|
</td>
|
351
351
|
</tr>
|
@@ -403,13 +403,13 @@
|
|
403
403
|
<pre class="code"><span class="info file"># File 'lib/r509/validity/redis/writer.rb', line 10</span>
|
404
404
|
|
405
405
|
<span class='kw'>def</span> <span class='id identifier rubyid_issue'>issue</span><span class='lparen'>(</span><span class='id identifier rubyid_issuer'>issuer</span><span class='comma'>,</span> <span class='id identifier rubyid_serial'>serial</span><span class='rparen'>)</span>
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
406
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Serial and issuer must be provided</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_serial'>serial</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='kw'>or</span> <span class='id identifier rubyid_issuer'>issuer</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
407
|
+
<span class='id identifier rubyid_cert'>cert</span> <span class='op'>=</span> <span class='ivar'>@redis</span><span class='period'>.</span><span class='id identifier rubyid_hgetall'>hgetall</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cert:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_issuer'>issuer</span><span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_serial'>serial</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
408
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_cert'>cert</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>or</span> <span class='kw'>not</span> <span class='id identifier rubyid_cert'>cert</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>status</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
409
|
+
<span class='ivar'>@redis</span><span class='period'>.</span><span class='id identifier rubyid_hmset'>hmset</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cert:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_issuer'>issuer</span><span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_serial'>serial</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>status</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='int'>0</span><span class='rparen'>)</span>
|
410
|
+
<span class='kw'>else</span>
|
411
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>R509Error</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Serial </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_serial'>serial</span><span class='embexpr_end'>}</span><span class='tstring_content'> for issuer </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_issuer'>issuer</span><span class='embexpr_end'>}</span><span class='tstring_content'> is already present</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
412
|
+
<span class='kw'>end</span>
|
413
413
|
<span class='kw'>end</span></pre>
|
414
414
|
</td>
|
415
415
|
</tr>
|
@@ -466,12 +466,12 @@
|
|
466
466
|
<pre class="code"><span class="info file"># File 'lib/r509/validity/redis/writer.rb', line 20</span>
|
467
467
|
|
468
468
|
<span class='kw'>def</span> <span class='id identifier rubyid_revoke'>revoke</span><span class='lparen'>(</span><span class='id identifier rubyid_issuer'>issuer</span><span class='comma'>,</span> <span class='id identifier rubyid_serial'>serial</span><span class='comma'>,</span> <span class='id identifier rubyid_revocation_time'>revocation_time</span><span class='op'>=</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='comma'>,</span> <span class='id identifier rubyid_reason'>reason</span><span class='op'>=</span><span class='int'>0</span><span class='rparen'>)</span>
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
469
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Serial and issuer must be provided</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_serial'>serial</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='kw'>or</span> <span class='id identifier rubyid_issuer'>issuer</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
470
|
+
<span class='ivar'>@redis</span><span class='period'>.</span><span class='id identifier rubyid_hmset'>hmset</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cert:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_issuer'>issuer</span><span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_serial'>serial</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
471
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>status</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='int'>1</span><span class='comma'>,</span>
|
472
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>revocation_time</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_revocation_time'>revocation_time</span> <span class='op'>||</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='comma'>,</span>
|
473
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>revocation_reason</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_reason'>reason</span> <span class='op'>||</span> <span class='int'>0</span>
|
474
|
+
<span class='rparen'>)</span>
|
475
475
|
<span class='kw'>end</span></pre>
|
476
476
|
</td>
|
477
477
|
</tr>
|
@@ -529,13 +529,13 @@
|
|
529
529
|
<pre class="code"><span class="info file"># File 'lib/r509/validity/redis/writer.rb', line 29</span>
|
530
530
|
|
531
531
|
<span class='kw'>def</span> <span class='id identifier rubyid_unrevoke'>unrevoke</span><span class='lparen'>(</span><span class='id identifier rubyid_issuer'>issuer</span><span class='comma'>,</span> <span class='id identifier rubyid_serial'>serial</span><span class='rparen'>)</span>
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
532
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Serial and issuer must be provided</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_serial'>serial</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='kw'>or</span> <span class='id identifier rubyid_issuer'>issuer</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
533
|
+
<span class='id identifier rubyid_cert'>cert</span> <span class='op'>=</span> <span class='ivar'>@redis</span><span class='period'>.</span><span class='id identifier rubyid_hgetall'>hgetall</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cert:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_issuer'>issuer</span><span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_serial'>serial</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
534
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_cert'>cert</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>or</span> <span class='kw'>not</span> <span class='id identifier rubyid_cert'>cert</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>status</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
535
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>R509Error</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Serial </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_serial'>serial</span><span class='embexpr_end'>}</span><span class='tstring_content'> for issuer </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_issuer'>issuer</span><span class='embexpr_end'>}</span><span class='tstring_content'> is not present</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
536
|
+
<span class='kw'>else</span>
|
537
|
+
<span class='ivar'>@redis</span><span class='period'>.</span><span class='id identifier rubyid_hmset'>hmset</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cert:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_issuer'>issuer</span><span class='embexpr_end'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_serial'>serial</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>status</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='int'>0</span><span class='rparen'>)</span>
|
538
|
+
<span class='kw'>end</span>
|
539
539
|
<span class='kw'>end</span></pre>
|
540
540
|
</td>
|
541
541
|
</tr>
|
@@ -547,9 +547,9 @@
|
|
547
547
|
</div>
|
548
548
|
|
549
549
|
<div id="footer">
|
550
|
-
Generated on
|
550
|
+
Generated on Sun Jan 26 14:17:21 2014 by
|
551
551
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
552
|
-
0.8.6.1 (ruby-
|
552
|
+
0.8.6.1 (ruby-2.0.0).
|
553
553
|
</div>
|
554
554
|
|
555
555
|
</body>
|
data/doc/_index.html
CHANGED
@@ -166,9 +166,9 @@
|
|
166
166
|
</div>
|
167
167
|
|
168
168
|
<div id="footer">
|
169
|
-
Generated on
|
169
|
+
Generated on Sun Jan 26 14:17:21 2014 by
|
170
170
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
171
|
-
0.8.6.1 (ruby-
|
171
|
+
0.8.6.1 (ruby-2.0.0).
|
172
172
|
</div>
|
173
173
|
|
174
174
|
</body>
|
data/doc/file.README.html
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
4
|
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
@@ -61,21 +61,21 @@
|
|
61
61
|
|
62
62
|
<iframe id="search_frame"></iframe>
|
63
63
|
|
64
|
-
<div id="content"><div id='filecontents'><p>This project is related to <a href="http://github.com/reaperhulk/r509">r509</a> and <a href="http://github.com/reaperhulk/ocsp-responder">ocsp-responder</a>, allowing certificate validity and revocation information to be read and written to a Redis backend.</p>
|
64
|
+
<div id="content"><div id='filecontents'><p>This project is related to <a href="http://github.com/reaperhulk/r509">r509</a>, <a href="http://github.com/sirsean/r509-ca-http">r509-ca-http</a>, and <a href="http://github.com/reaperhulk/r509-ocsp-responder">r509-ocsp-responder</a>, allowing certificate validity and revocation information to be read and written to a Redis backend.</p>
|
65
65
|
|
66
66
|
<p>When a certificate is issued, we want this sent to Redis:</p>
|
67
67
|
|
68
|
-
<pre class="code ruby"><code class="ruby">HMSET "cert:<serial>" status 0
|
68
|
+
<pre class="code ruby"><code class="ruby">HMSET "cert:<issuer>:<serial>" status 0
|
69
69
|
</code></pre>
|
70
70
|
|
71
71
|
<p>When revoked:</p>
|
72
72
|
|
73
|
-
<pre class="code ruby"><code class="ruby">HMSET "cert:<serial>" status 1 revocation_time <timestamp> revocation_reason 0
|
73
|
+
<pre class="code ruby"><code class="ruby">HMSET "cert:<issuer>:<serial>" status 1 revocation_time <timestamp> revocation_reason 0
|
74
74
|
</code></pre>
|
75
75
|
|
76
76
|
<p>To get the status of a certificate:</p>
|
77
77
|
|
78
|
-
<pre class="code ruby"><code class="ruby"><span class='const'>HGETALL</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cert:<serial></span><span class='tstring_end'>"</span></span>
|
78
|
+
<pre class="code ruby"><code class="ruby"><span class='const'>HGETALL</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cert:<issuer>:<serial></span><span class='tstring_end'>"</span></span>
|
79
79
|
</code></pre>
|
80
80
|
|
81
81
|
<p>The "status" field can be one of:</p>
|
@@ -86,21 +86,24 @@
|
|
86
86
|
|
87
87
|
<p>The "revocation_reason" field can be one of:</p>
|
88
88
|
|
89
|
-
<pre class="code ruby"><code class="ruby"
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
89
|
+
<pre class="code ruby"><code class="ruby">null
|
90
|
+
0 (unspecified)
|
91
|
+
1 (keyCompromise)
|
92
|
+
2 (cACompromise)
|
93
|
+
3 (affiliationChanged)
|
94
|
+
4 (superseded)
|
95
|
+
5 (cessationOfOperation)
|
96
|
+
6 (certificateHold)
|
97
|
+
8 (removeFromCRL)
|
98
|
+
9 (privilegeWithdrawn)
|
99
|
+
10 (aACompromise)
|
97
100
|
</code></pre>
|
98
101
|
</div></div>
|
99
102
|
|
100
103
|
<div id="footer">
|
101
|
-
Generated on
|
104
|
+
Generated on Sun Jan 26 14:17:21 2014 by
|
102
105
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
103
|
-
0.8.6.1 (ruby-
|
106
|
+
0.8.6.1 (ruby-2.0.0).
|
104
107
|
</div>
|
105
108
|
|
106
109
|
</body>
|
data/doc/index.html
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
4
|
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
@@ -61,21 +61,21 @@
|
|
61
61
|
|
62
62
|
<iframe id="search_frame"></iframe>
|
63
63
|
|
64
|
-
<div id="content"><div id='filecontents'><p>This project is related to <a href="http://github.com/reaperhulk/r509">r509</a> and <a href="http://github.com/reaperhulk/ocsp-responder">ocsp-responder</a>, allowing certificate validity and revocation information to be read and written to a Redis backend.</p>
|
64
|
+
<div id="content"><div id='filecontents'><p>This project is related to <a href="http://github.com/reaperhulk/r509">r509</a>, <a href="http://github.com/sirsean/r509-ca-http">r509-ca-http</a>, and <a href="http://github.com/reaperhulk/r509-ocsp-responder">r509-ocsp-responder</a>, allowing certificate validity and revocation information to be read and written to a Redis backend.</p>
|
65
65
|
|
66
66
|
<p>When a certificate is issued, we want this sent to Redis:</p>
|
67
67
|
|
68
|
-
<pre class="code ruby"><code class="ruby">HMSET "cert:<serial>" status 0
|
68
|
+
<pre class="code ruby"><code class="ruby">HMSET "cert:<issuer>:<serial>" status 0
|
69
69
|
</code></pre>
|
70
70
|
|
71
71
|
<p>When revoked:</p>
|
72
72
|
|
73
|
-
<pre class="code ruby"><code class="ruby">HMSET "cert:<serial>" status 1 revocation_time <timestamp> revocation_reason 0
|
73
|
+
<pre class="code ruby"><code class="ruby">HMSET "cert:<issuer>:<serial>" status 1 revocation_time <timestamp> revocation_reason 0
|
74
74
|
</code></pre>
|
75
75
|
|
76
76
|
<p>To get the status of a certificate:</p>
|
77
77
|
|
78
|
-
<pre class="code ruby"><code class="ruby"><span class='const'>HGETALL</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cert:<serial></span><span class='tstring_end'>"</span></span>
|
78
|
+
<pre class="code ruby"><code class="ruby"><span class='const'>HGETALL</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cert:<issuer>:<serial></span><span class='tstring_end'>"</span></span>
|
79
79
|
</code></pre>
|
80
80
|
|
81
81
|
<p>The "status" field can be one of:</p>
|
@@ -86,21 +86,24 @@
|
|
86
86
|
|
87
87
|
<p>The "revocation_reason" field can be one of:</p>
|
88
88
|
|
89
|
-
<pre class="code ruby"><code class="ruby"
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
89
|
+
<pre class="code ruby"><code class="ruby">null
|
90
|
+
0 (unspecified)
|
91
|
+
1 (keyCompromise)
|
92
|
+
2 (cACompromise)
|
93
|
+
3 (affiliationChanged)
|
94
|
+
4 (superseded)
|
95
|
+
5 (cessationOfOperation)
|
96
|
+
6 (certificateHold)
|
97
|
+
8 (removeFromCRL)
|
98
|
+
9 (privilegeWithdrawn)
|
99
|
+
10 (aACompromise)
|
97
100
|
</code></pre>
|
98
101
|
</div></div>
|
99
102
|
|
100
103
|
<div id="footer">
|
101
|
-
Generated on
|
104
|
+
Generated on Sun Jan 26 14:17:21 2014 by
|
102
105
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
103
|
-
0.8.6.1 (ruby-
|
106
|
+
0.8.6.1 (ruby-2.0.0).
|
104
107
|
</div>
|
105
108
|
|
106
109
|
</body>
|
@@ -103,9 +103,9 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Sun Jan 26 14:17:21 2014 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
|
-
0.8.6.1 (ruby-
|
108
|
+
0.8.6.1 (ruby-2.0.0).
|
109
109
|
</div>
|
110
110
|
|
111
111
|
</body>
|
data/lib/r509/validity/redis.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'r509'
|
2
2
|
|
3
3
|
unless Kernel.respond_to?(:require_relative)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
4
|
+
module Kernel
|
5
|
+
def require_relative(path)
|
6
|
+
require File.join(File.dirname(caller[0]), path.to_str)
|
8
7
|
end
|
8
|
+
end
|
9
9
|
end
|
10
10
|
|
11
11
|
module R509::Validity::Redis
|
12
|
-
|
13
|
-
|
12
|
+
require_relative('redis/checker.rb')
|
13
|
+
require_relative('redis/writer.rb')
|
14
14
|
end
|
15
15
|
|