r509 0.8

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.
Files changed (162) hide show
  1. data/README.md +447 -0
  2. data/Rakefile +38 -0
  3. data/bin/r509 +96 -0
  4. data/bin/r509-parse +35 -0
  5. data/doc/R509.html +154 -0
  6. data/doc/R509/Cert.html +3954 -0
  7. data/doc/R509/Cert/Extensions.html +360 -0
  8. data/doc/R509/Cert/Extensions/AuthorityInfoAccess.html +391 -0
  9. data/doc/R509/Cert/Extensions/AuthorityKeyIdentifier.html +148 -0
  10. data/doc/R509/Cert/Extensions/BasicConstraints.html +482 -0
  11. data/doc/R509/Cert/Extensions/CrlDistributionPoints.html +316 -0
  12. data/doc/R509/Cert/Extensions/ExtendedKeyUsage.html +780 -0
  13. data/doc/R509/Cert/Extensions/KeyUsage.html +1230 -0
  14. data/doc/R509/Cert/Extensions/SubjectAlternativeName.html +467 -0
  15. data/doc/R509/Cert/Extensions/SubjectKeyIdentifier.html +216 -0
  16. data/doc/R509/CertificateAuthority.html +126 -0
  17. data/doc/R509/CertificateAuthority/Signer.html +855 -0
  18. data/doc/R509/Config.html +127 -0
  19. data/doc/R509/Config/CaConfig.html +2144 -0
  20. data/doc/R509/Config/CaConfigPool.html +599 -0
  21. data/doc/R509/Config/CaProfile.html +656 -0
  22. data/doc/R509/Config/SubjectItemPolicy.html +578 -0
  23. data/doc/R509/Crl.html +126 -0
  24. data/doc/R509/Crl/Administrator.html +2077 -0
  25. data/doc/R509/Crl/Parser.html +1224 -0
  26. data/doc/R509/Csr.html +2248 -0
  27. data/doc/R509/IOHelpers.html +564 -0
  28. data/doc/R509/MessageDigest.html +396 -0
  29. data/doc/R509/NameSanitizer.html +319 -0
  30. data/doc/R509/Ocsp.html +128 -0
  31. data/doc/R509/Ocsp/Request.html +126 -0
  32. data/doc/R509/Ocsp/Request/Nonce.html +160 -0
  33. data/doc/R509/Ocsp/Response.html +837 -0
  34. data/doc/R509/OidMapper.html +393 -0
  35. data/doc/R509/PrivateKey.html +1647 -0
  36. data/doc/R509/R509Error.html +134 -0
  37. data/doc/R509/Spki.html +1424 -0
  38. data/doc/R509/Subject.html +836 -0
  39. data/doc/R509/Validity.html +160 -0
  40. data/doc/R509/Validity/Checker.html +320 -0
  41. data/doc/R509/Validity/DefaultChecker.html +283 -0
  42. data/doc/R509/Validity/DefaultWriter.html +330 -0
  43. data/doc/R509/Validity/Status.html +561 -0
  44. data/doc/R509/Validity/Writer.html +394 -0
  45. data/doc/_index.html +501 -0
  46. data/doc/class_list.html +53 -0
  47. data/doc/css/common.css +1 -0
  48. data/doc/css/full_list.css +57 -0
  49. data/doc/css/style.css +328 -0
  50. data/doc/file.README.html +534 -0
  51. data/doc/file.r509.html +149 -0
  52. data/doc/file_list.html +58 -0
  53. data/doc/frames.html +28 -0
  54. data/doc/index.html +534 -0
  55. data/doc/js/app.js +208 -0
  56. data/doc/js/full_list.js +173 -0
  57. data/doc/js/jquery.js +4 -0
  58. data/doc/methods_list.html +1932 -0
  59. data/doc/top-level-namespace.html +112 -0
  60. data/lib/r509.rb +22 -0
  61. data/lib/r509/cert.rb +414 -0
  62. data/lib/r509/cert/extensions.rb +309 -0
  63. data/lib/r509/certificateauthority.rb +290 -0
  64. data/lib/r509/config.rb +407 -0
  65. data/lib/r509/crl.rb +379 -0
  66. data/lib/r509/csr.rb +324 -0
  67. data/lib/r509/exceptions.rb +5 -0
  68. data/lib/r509/io_helpers.rb +52 -0
  69. data/lib/r509/messagedigest.rb +49 -0
  70. data/lib/r509/ocsp.rb +85 -0
  71. data/lib/r509/oidmapper.rb +32 -0
  72. data/lib/r509/privatekey.rb +185 -0
  73. data/lib/r509/spki.rb +112 -0
  74. data/lib/r509/subject.rb +133 -0
  75. data/lib/r509/validity.rb +92 -0
  76. data/lib/r509/version.rb +4 -0
  77. data/r509.yaml +73 -0
  78. data/spec/cert/extensions_spec.rb +632 -0
  79. data/spec/cert_spec.rb +321 -0
  80. data/spec/certificate_authority_spec.rb +260 -0
  81. data/spec/config_spec.rb +349 -0
  82. data/spec/crl_spec.rb +215 -0
  83. data/spec/csr_spec.rb +302 -0
  84. data/spec/fixtures.rb +233 -0
  85. data/spec/fixtures/cert1.der +0 -0
  86. data/spec/fixtures/cert1.pem +24 -0
  87. data/spec/fixtures/cert1_public_key_modulus.txt +1 -0
  88. data/spec/fixtures/cert3.p12 +0 -0
  89. data/spec/fixtures/cert3.pem +28 -0
  90. data/spec/fixtures/cert3_key.pem +27 -0
  91. data/spec/fixtures/cert3_key_des3.pem +30 -0
  92. data/spec/fixtures/cert4.pem +14 -0
  93. data/spec/fixtures/cert5.pem +30 -0
  94. data/spec/fixtures/cert6.pem +26 -0
  95. data/spec/fixtures/cert_expired.pem +26 -0
  96. data/spec/fixtures/cert_not_yet_valid.pem +26 -0
  97. data/spec/fixtures/cert_san.pem +27 -0
  98. data/spec/fixtures/cert_san2.pem +22 -0
  99. data/spec/fixtures/config_pool_test_minimal.yaml +15 -0
  100. data/spec/fixtures/config_test.yaml +41 -0
  101. data/spec/fixtures/config_test_engine_key.yaml +7 -0
  102. data/spec/fixtures/config_test_engine_no_key_name.yaml +6 -0
  103. data/spec/fixtures/config_test_minimal.yaml +7 -0
  104. data/spec/fixtures/config_test_password.yaml +7 -0
  105. data/spec/fixtures/config_test_various.yaml +100 -0
  106. data/spec/fixtures/crl_list_file.txt +1 -0
  107. data/spec/fixtures/crl_with_reason.pem +17 -0
  108. data/spec/fixtures/csr1.der +0 -0
  109. data/spec/fixtures/csr1.pem +17 -0
  110. data/spec/fixtures/csr1_key.der +0 -0
  111. data/spec/fixtures/csr1_key.pem +27 -0
  112. data/spec/fixtures/csr1_key_encrypted_des3.pem +30 -0
  113. data/spec/fixtures/csr1_newlines.pem +32 -0
  114. data/spec/fixtures/csr1_no_begin_end.pem +15 -0
  115. data/spec/fixtures/csr1_public_key_modulus.txt +1 -0
  116. data/spec/fixtures/csr2.pem +15 -0
  117. data/spec/fixtures/csr2_key.pem +27 -0
  118. data/spec/fixtures/csr3.pem +16 -0
  119. data/spec/fixtures/csr4.pem +25 -0
  120. data/spec/fixtures/csr_dsa.pem +15 -0
  121. data/spec/fixtures/csr_invalid_signature.pem +13 -0
  122. data/spec/fixtures/dsa_key.pem +20 -0
  123. data/spec/fixtures/key4.pem +27 -0
  124. data/spec/fixtures/key4_encrypted_des3.pem +30 -0
  125. data/spec/fixtures/missing_key_identifier_ca.cer +21 -0
  126. data/spec/fixtures/missing_key_identifier_ca.key +27 -0
  127. data/spec/fixtures/ocsptest.r509.local.pem +27 -0
  128. data/spec/fixtures/ocsptest.r509.local_ocsp_request.der +0 -0
  129. data/spec/fixtures/ocsptest2.r509.local.pem +27 -0
  130. data/spec/fixtures/second_ca.cer +26 -0
  131. data/spec/fixtures/second_ca.key +27 -0
  132. data/spec/fixtures/spkac.der +0 -0
  133. data/spec/fixtures/spkac.txt +1 -0
  134. data/spec/fixtures/spkac_dsa.txt +1 -0
  135. data/spec/fixtures/stca.pem +22 -0
  136. data/spec/fixtures/stca_ocsp_request.der +0 -0
  137. data/spec/fixtures/stca_ocsp_response.der +0 -0
  138. data/spec/fixtures/test1.csr +17 -0
  139. data/spec/fixtures/test_ca.cer +22 -0
  140. data/spec/fixtures/test_ca.key +28 -0
  141. data/spec/fixtures/test_ca.p12 +0 -0
  142. data/spec/fixtures/test_ca_des3.key +30 -0
  143. data/spec/fixtures/test_ca_ocsp.cer +26 -0
  144. data/spec/fixtures/test_ca_ocsp.key +27 -0
  145. data/spec/fixtures/test_ca_ocsp.p12 +0 -0
  146. data/spec/fixtures/test_ca_ocsp_chain.txt +48 -0
  147. data/spec/fixtures/test_ca_ocsp_response.der +0 -0
  148. data/spec/fixtures/test_ca_subroot.cer +26 -0
  149. data/spec/fixtures/test_ca_subroot.key +27 -0
  150. data/spec/fixtures/test_ca_subroot_ocsp.cer +25 -0
  151. data/spec/fixtures/test_ca_subroot_ocsp.key +27 -0
  152. data/spec/fixtures/test_ca_subroot_ocsp_response.der +0 -0
  153. data/spec/fixtures/unknown_oid.csr +17 -0
  154. data/spec/message_digest_spec.rb +89 -0
  155. data/spec/ocsp_spec.rb +111 -0
  156. data/spec/oid_mapper_spec.rb +31 -0
  157. data/spec/privatekey_spec.rb +198 -0
  158. data/spec/spec_helper.rb +14 -0
  159. data/spec/spki_spec.rb +157 -0
  160. data/spec/subject_spec.rb +203 -0
  161. data/spec/validity_spec.rb +98 -0
  162. metadata +257 -0
data/doc/R509/Csr.html ADDED
@@ -0,0 +1,2248 @@
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: R509::Csr
8
+
9
+ &mdash; Documentation by YARD 0.8.0
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" 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> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../R509.html" title="R509 (module)">R509</a></span></span>
36
+ &raquo;
37
+ <span class="title">Csr</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: R509::Csr
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">R509::Csr</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+ <dt class="r2">Includes:</dt>
94
+ <dd class="r2"><span class='object_link'><a href="IOHelpers.html" title="R509::IOHelpers (module)">IOHelpers</a></span></dd>
95
+
96
+
97
+
98
+
99
+
100
+ <dt class="r1 last">Defined in:</dt>
101
+ <dd class="r1 last">lib/r509/csr.rb</dd>
102
+
103
+ </dl>
104
+ <div class="clear"></div>
105
+
106
+ <h2>Overview</h2><div class="docstring">
107
+ <div class="discussion">
108
+
109
+ <p>The primary certificate signing request object</p>
110
+
111
+
112
+ </div>
113
+ </div>
114
+ <div class="tags">
115
+
116
+
117
+ </div>
118
+
119
+
120
+
121
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
122
+ <ul class="summary">
123
+
124
+ <li class="public ">
125
+ <span class="summary_signature">
126
+
127
+ <a href="#attributes-instance_method" title="#attributes (instance method)">- (Object) <strong>attributes</strong> </a>
128
+
129
+
130
+
131
+ </span>
132
+
133
+
134
+
135
+
136
+ <span class="note title readonly">readonly</span>
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+ <span class="summary_desc"><div class='inline'>
147
+ <p>Returns the value of attribute attributes.</p>
148
+ </div></span>
149
+
150
+ </li>
151
+
152
+
153
+ <li class="public ">
154
+ <span class="summary_signature">
155
+
156
+ <a href="#key-instance_method" title="#key (instance method)">- (Object) <strong>key</strong> </a>
157
+
158
+
159
+
160
+ </span>
161
+
162
+
163
+
164
+
165
+ <span class="note title readonly">readonly</span>
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+ <span class="summary_desc"><div class='inline'>
176
+ <p>Returns the value of attribute key.</p>
177
+ </div></span>
178
+
179
+ </li>
180
+
181
+
182
+ <li class="public ">
183
+ <span class="summary_signature">
184
+
185
+ <a href="#message_digest-instance_method" title="#message_digest (instance method)">- (Object) <strong>message_digest</strong> </a>
186
+
187
+
188
+
189
+ </span>
190
+
191
+
192
+
193
+
194
+ <span class="note title readonly">readonly</span>
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+ <span class="summary_desc"><div class='inline'>
205
+ <p>Returns the value of attribute message_digest.</p>
206
+ </div></span>
207
+
208
+ </li>
209
+
210
+
211
+ <li class="public ">
212
+ <span class="summary_signature">
213
+
214
+ <a href="#req-instance_method" title="#req (instance method)">- (Object) <strong>req</strong> </a>
215
+
216
+
217
+
218
+ </span>
219
+
220
+
221
+
222
+
223
+ <span class="note title readonly">readonly</span>
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+ <span class="summary_desc"><div class='inline'>
234
+ <p>Returns the value of attribute req.</p>
235
+ </div></span>
236
+
237
+ </li>
238
+
239
+
240
+ <li class="public ">
241
+ <span class="summary_signature">
242
+
243
+ <a href="#san_names-instance_method" title="#san_names (instance method)">- (Object) <strong>san_names</strong> </a>
244
+
245
+
246
+
247
+ </span>
248
+
249
+
250
+
251
+
252
+ <span class="note title readonly">readonly</span>
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+ <span class="summary_desc"><div class='inline'>
263
+ <p>Returns the value of attribute san_names.</p>
264
+ </div></span>
265
+
266
+ </li>
267
+
268
+
269
+ <li class="public ">
270
+ <span class="summary_signature">
271
+
272
+ <a href="#subject-instance_method" title="#subject (instance method)">- (Object) <strong>subject</strong> </a>
273
+
274
+
275
+
276
+ </span>
277
+
278
+
279
+
280
+
281
+ <span class="note title readonly">readonly</span>
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+ <span class="summary_desc"><div class='inline'>
292
+ <p>Returns the value of attribute subject.</p>
293
+ </div></span>
294
+
295
+ </li>
296
+
297
+
298
+ </ul>
299
+
300
+
301
+
302
+
303
+
304
+ <h2>
305
+ Class Method Summary
306
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
307
+ </h2>
308
+
309
+ <ul class="summary">
310
+
311
+ <li class="public ">
312
+ <span class="summary_signature">
313
+
314
+ <a href="#load_from_file-class_method" title="load_from_file (class method)">+ (R509::Csr) <strong>load_from_file</strong>(filename) </a>
315
+
316
+
317
+
318
+ </span>
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+ <span class="summary_desc"><div class='inline'>
329
+ <p>Helper method to quickly load a CSR from the filesystem.</p>
330
+ </div></span>
331
+
332
+ </li>
333
+
334
+
335
+ </ul>
336
+
337
+ <h2>
338
+ Instance Method Summary
339
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
340
+ </h2>
341
+
342
+ <ul class="summary">
343
+
344
+ <li class="public ">
345
+ <span class="summary_signature">
346
+
347
+ <a href="#bit_strength-instance_method" title="#bit_strength (instance method)">- (Integer) <strong>bit_strength</strong> </a>
348
+
349
+
350
+
351
+ </span>
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+ <span class="summary_desc"><div class='inline'>
362
+ <p>Returns the bit strength of the key used to create the CSR.</p>
363
+ </div></span>
364
+
365
+ </li>
366
+
367
+
368
+ <li class="public ">
369
+ <span class="summary_signature">
370
+
371
+ <a href="#dsa%3F-instance_method" title="#dsa? (instance method)">- (Boolean) <strong>dsa?</strong> </a>
372
+
373
+
374
+
375
+ </span>
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+
384
+
385
+ <span class="summary_desc"><div class='inline'>
386
+ <p>Returns whether the public key is DSA.</p>
387
+ </div></span>
388
+
389
+ </li>
390
+
391
+
392
+ <li class="public ">
393
+ <span class="summary_signature">
394
+
395
+ <a href="#has_private_key%3F-instance_method" title="#has_private_key? (instance method)">- (Boolean) <strong>has_private_key?</strong> </a>
396
+
397
+
398
+
399
+ </span>
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+
409
+ <span class="summary_desc"><div class='inline'>
410
+ <p>Boolean of whether the object contains a private key.</p>
411
+ </div></span>
412
+
413
+ </li>
414
+
415
+
416
+ <li class="public ">
417
+ <span class="summary_signature">
418
+
419
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Csr) <strong>initialize</strong>(opts = {}) </a>
420
+
421
+
422
+
423
+ </span>
424
+
425
+
426
+ <span class="note title constructor">constructor</span>
427
+
428
+
429
+
430
+
431
+
432
+
433
+
434
+
435
+ <span class="summary_desc"><div class='inline'>
436
+ <p>you can also pass OIDs (see tests).</p>
437
+ </div></span>
438
+
439
+ </li>
440
+
441
+
442
+ <li class="public ">
443
+ <span class="summary_signature">
444
+
445
+ <a href="#key_algorithm-instance_method" title="#key_algorithm (instance method)">- (String) <strong>key_algorithm</strong> </a>
446
+
447
+
448
+
449
+ </span>
450
+
451
+
452
+
453
+
454
+
455
+
456
+
457
+
458
+
459
+ <span class="summary_desc"><div class='inline'>
460
+ <p>Returns key algorithm (RSA/DSA).</p>
461
+ </div></span>
462
+
463
+ </li>
464
+
465
+
466
+ <li class="public ">
467
+ <span class="summary_signature">
468
+
469
+ <a href="#public_key-instance_method" title="#public_key (instance method)">- (OpenSSL::PKey::RSA) <strong>public_key</strong> </a>
470
+
471
+
472
+
473
+ </span>
474
+
475
+
476
+
477
+
478
+
479
+
480
+
481
+
482
+
483
+ <span class="summary_desc"><div class='inline'>
484
+ <p>Public key.</p>
485
+ </div></span>
486
+
487
+ </li>
488
+
489
+
490
+ <li class="public ">
491
+ <span class="summary_signature">
492
+
493
+ <a href="#rsa%3F-instance_method" title="#rsa? (instance method)">- (Boolean) <strong>rsa?</strong> </a>
494
+
495
+
496
+
497
+ </span>
498
+
499
+
500
+
501
+
502
+
503
+
504
+
505
+
506
+
507
+ <span class="summary_desc"><div class='inline'>
508
+ <p>Returns whether the public key is RSA.</p>
509
+ </div></span>
510
+
511
+ </li>
512
+
513
+
514
+ <li class="public ">
515
+ <span class="summary_signature">
516
+
517
+ <a href="#signature_algorithm-instance_method" title="#signature_algorithm (instance method)">- (String) <strong>signature_algorithm</strong> </a>
518
+
519
+
520
+
521
+ </span>
522
+
523
+
524
+
525
+
526
+
527
+
528
+
529
+
530
+
531
+ <span class="summary_desc"><div class='inline'>
532
+ <p>Returns signature algorithm.</p>
533
+ </div></span>
534
+
535
+ </li>
536
+
537
+
538
+ <li class="public ">
539
+ <span class="summary_signature">
540
+
541
+ <a href="#subject_component-instance_method" title="#subject_component (instance method)">- (String) <strong>subject_component</strong>(short_name) </a>
542
+
543
+
544
+
545
+ </span>
546
+
547
+
548
+
549
+
550
+
551
+
552
+
553
+
554
+
555
+ <span class="summary_desc"><div class='inline'>
556
+ <p>Returns subject component.</p>
557
+ </div></span>
558
+
559
+ </li>
560
+
561
+
562
+ <li class="public ">
563
+ <span class="summary_signature">
564
+
565
+ <a href="#to_der-instance_method" title="#to_der (instance method)">- (String) <strong>to_der</strong> </a>
566
+
567
+
568
+
569
+ </span>
570
+
571
+
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+ <span class="summary_desc"><div class='inline'>
580
+ <p>Converts the CSR into the DER format.</p>
581
+ </div></span>
582
+
583
+ </li>
584
+
585
+
586
+ <li class="public ">
587
+ <span class="summary_signature">
588
+
589
+ <a href="#to_hash-instance_method" title="#to_hash (instance method)">- (Hash) <strong>to_hash</strong> </a>
590
+
591
+
592
+
593
+ </span>
594
+
595
+
596
+
597
+
598
+
599
+
600
+
601
+
602
+
603
+ <span class="summary_desc"><div class='inline'>
604
+ <p>Returns a hash structure you can pass to the Ca.</p>
605
+ </div></span>
606
+
607
+ </li>
608
+
609
+
610
+ <li class="public ">
611
+ <span class="summary_signature">
612
+
613
+ <a href="#to_pem-instance_method" title="#to_pem (instance method)">- (String) <strong>to_pem</strong> </a>
614
+
615
+
616
+
617
+ (also: #to_s)
618
+
619
+ </span>
620
+
621
+
622
+
623
+
624
+
625
+
626
+
627
+
628
+
629
+ <span class="summary_desc"><div class='inline'>
630
+ <p>Converts the CSR into the PEM format.</p>
631
+ </div></span>
632
+
633
+ </li>
634
+
635
+
636
+ <li class="public ">
637
+ <span class="summary_signature">
638
+
639
+ <a href="#verify_signature-instance_method" title="#verify_signature (instance method)">- (Boolean) <strong>verify_signature</strong> </a>
640
+
641
+
642
+
643
+ </span>
644
+
645
+
646
+
647
+
648
+
649
+
650
+
651
+
652
+
653
+ <span class="summary_desc"><div class='inline'>
654
+ <p>Verifies the integrity of the signature on the request.</p>
655
+ </div></span>
656
+
657
+ </li>
658
+
659
+
660
+ <li class="public ">
661
+ <span class="summary_signature">
662
+
663
+ <a href="#write_der-instance_method" title="#write_der (instance method)">- (Object) <strong>write_der</strong>(filename_or_io) </a>
664
+
665
+
666
+
667
+ </span>
668
+
669
+
670
+
671
+
672
+
673
+
674
+
675
+
676
+
677
+ <span class="summary_desc"><div class='inline'>
678
+ <p>Writes the CSR into the DER format.</p>
679
+ </div></span>
680
+
681
+ </li>
682
+
683
+
684
+ <li class="public ">
685
+ <span class="summary_signature">
686
+
687
+ <a href="#write_pem-instance_method" title="#write_pem (instance method)">- (Object) <strong>write_pem</strong>(filename_or_io) </a>
688
+
689
+
690
+
691
+ </span>
692
+
693
+
694
+
695
+
696
+
697
+
698
+
699
+
700
+
701
+ <span class="summary_desc"><div class='inline'>
702
+ <p>Writes the CSR into the PEM format.</p>
703
+ </div></span>
704
+
705
+ </li>
706
+
707
+
708
+ </ul>
709
+
710
+
711
+
712
+
713
+
714
+
715
+
716
+
717
+
718
+
719
+
720
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="IOHelpers.html" title="R509::IOHelpers (module)">IOHelpers</a></span></h3>
721
+ <p class="inherited"><span class='object_link'><a href="IOHelpers.html#read_data-instance_method" title="R509::IOHelpers#read_data (method)">#read_data</a></span>, <span class='object_link'><a href="IOHelpers.html#read_data-class_method" title="R509::IOHelpers.read_data (method)">read_data</a></span>, <span class='object_link'><a href="IOHelpers.html#write_data-instance_method" title="R509::IOHelpers#write_data (method)">#write_data</a></span>, <span class='object_link'><a href="IOHelpers.html#write_data-class_method" title="R509::IOHelpers.write_data (method)">write_data</a></span></p>
722
+ <div id="constructor_details" class="method_details_list">
723
+ <h2>Constructor Details</h2>
724
+
725
+ <div class="method_details first">
726
+ <h3 class="signature first" id="initialize-instance_method">
727
+
728
+ - (<tt><span class='object_link'><a href="" title="R509::Csr (class)">Csr</a></span></tt>) <strong>initialize</strong>(opts = {})
729
+
730
+
731
+
732
+
733
+
734
+ </h3><div class="docstring">
735
+ <div class="discussion">
736
+
737
+ <p>you can also pass OIDs (see tests)</p>
738
+
739
+
740
+ </div>
741
+ </div>
742
+ <div class="tags">
743
+
744
+ <div class="examples">
745
+ <p class="tag_title">Examples:</p>
746
+
747
+
748
+ <p class="example_title"><div class='inline'><dl class="rdoc-list"><dt>['<a href="http://'ST','Illinois'">CN','langui.sh'],</a>,['<a href="http://'C','US'">L','Chicago'],</a>,['emailAddress','ca@langui.sh']</dt>
749
+ <dd></dd></dl>
750
+ </div></p>
751
+
752
+ <pre class="example code"></pre>
753
+
754
+ </div>
755
+ <p class="tag_title">Parameters:</p>
756
+ <ul class="param">
757
+
758
+ <li>
759
+
760
+ <span class='name'>opts</span>
761
+
762
+
763
+ <span class='type'>(<tt>Hash</tt>)</span>
764
+
765
+
766
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
767
+
768
+
769
+ &mdash;
770
+ <div class='inline'>
771
+ <p>a customizable set of options</p>
772
+ </div>
773
+
774
+ </li>
775
+
776
+ </ul>
777
+
778
+
779
+
780
+
781
+ <p class="tag_title">Options Hash (<tt>opts</tt>):</p>
782
+ <ul class="option">
783
+
784
+ <li>
785
+ <span class="name">:csr</span>
786
+ <span class="type">(<tt>String</tt>, <tt>OpenSSL::X509::Request</tt>)</span>
787
+ <span class="default">
788
+
789
+ </span>
790
+ &mdash; <div class='inline'>
791
+ <p>a csr</p>
792
+ </div>
793
+ </li>
794
+
795
+ <li>
796
+ <span class="name">:type</span>
797
+ <span class="type">(<tt>Symbol</tt>)</span>
798
+ <span class="default">
799
+
800
+ </span>
801
+ &mdash; <div class='inline'>
802
+ <p>:rsa/:dsa</p>
803
+ </div>
804
+ </li>
805
+
806
+ <li>
807
+ <span class="name">:bit_strength</span>
808
+ <span class="type">(<tt>Integer</tt>)</span>
809
+ <span class="default">
810
+
811
+ </span>
812
+
813
+ </li>
814
+
815
+ <li>
816
+ <span class="name">:san_names</span>
817
+ <span class="type">(<tt>Array</tt>)</span>
818
+ <span class="default">
819
+
820
+ </span>
821
+ &mdash; <div class='inline'>
822
+ <p>List of domains to encode as subjectAltNames</p>
823
+ </div>
824
+ </li>
825
+
826
+ <li>
827
+ <span class="name">:subject</span>
828
+ <span class="type">(<tt><span class='object_link'><a href="Subject.html" title="R509::Subject (class)">R509::Subject</a></span></tt>, <tt>Array</tt>, <tt>OpenSSL::X509::Name</tt>)</span>
829
+ <span class="default">
830
+
831
+ </span>
832
+ &mdash; <div class='inline'>
833
+ <p>array of subject items</p>
834
+ </div>
835
+ </li>
836
+
837
+ <li>
838
+ <span class="name">:cert</span>
839
+ <span class="type">(<tt>String</tt>, <tt><span class='object_link'><a href="Cert.html" title="R509::Cert (class)">R509::Cert</a></span></tt>, <tt>OpenSSL::X509::Certificate</tt>)</span>
840
+ <span class="default">
841
+
842
+ </span>
843
+ &mdash; <div class='inline'>
844
+ <p>takes a cert (used for generating a CSR with the certificate's values)</p>
845
+ </div>
846
+ </li>
847
+
848
+ <li>
849
+ <span class="name">:key</span>
850
+ <span class="type">(<tt><span class='object_link'><a href="PrivateKey.html" title="R509::PrivateKey (class)">R509::PrivateKey</a></span></tt>, <tt>String</tt>)</span>
851
+ <span class="default">
852
+
853
+ </span>
854
+ &mdash; <div class='inline'>
855
+ <p>optional private key to supply. either an unencrypted PEM/DER string or an
856
+ R509::PrivateKey object (use the latter if you need password/hardware
857
+ support)</p>
858
+ </div>
859
+ </li>
860
+
861
+ </ul>
862
+
863
+
864
+
865
+ </div><table class="source_code">
866
+ <tr>
867
+ <td>
868
+ <pre class="lines">
869
+
870
+
871
+ 21
872
+ 22
873
+ 23
874
+ 24
875
+ 25
876
+ 26
877
+ 27
878
+ 28
879
+ 29
880
+ 30
881
+ 31
882
+ 32
883
+ 33
884
+ 34
885
+ 35
886
+ 36
887
+ 37
888
+ 38
889
+ 39
890
+ 40
891
+ 41
892
+ 42
893
+ 43
894
+ 44
895
+ 45
896
+ 46
897
+ 47
898
+ 48
899
+ 49
900
+ 50
901
+ 51
902
+ 52
903
+ 53
904
+ 54
905
+ 55
906
+ 56
907
+ 57
908
+ 58
909
+ 59
910
+ 60
911
+ 61
912
+ 62
913
+ 63
914
+ 64
915
+ 65
916
+ 66
917
+ 67
918
+ 68
919
+ 69
920
+ 70
921
+ 71
922
+ 72
923
+ 73
924
+ 74
925
+ 75
926
+ 76
927
+ 77
928
+ 78
929
+ 79
930
+ 80
931
+ 81
932
+ 82</pre>
933
+ </td>
934
+ <td>
935
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 21</span>
936
+
937
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
938
+ <span class='kw'>if</span> <span class='kw'>not</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
939
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Must provide a hash of options</span><span class='tstring_end'>'</span></span>
940
+ <span class='kw'>end</span>
941
+ <span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:cert</span><span class='rparen'>)</span> <span class='kw'>and</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:subject</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>or</span>
942
+ <span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:cert</span><span class='rparen'>)</span> <span class='kw'>and</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:csr</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>or</span>
943
+ <span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:subject</span><span class='rparen'>)</span> <span class='kw'>and</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:csr</span><span class='rparen'>)</span><span class='rparen'>)</span>
944
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Can only provide one of cert, subject, or csr</span><span class='tstring_end'>&quot;</span></span>
945
+ <span class='kw'>end</span>
946
+ <span class='ivar'>@bit_strength</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:bit_strength</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='int'>2048</span>
947
+
948
+ <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:key</span><span class='rparen'>)</span>
949
+ <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>R509</span><span class='op'>::</span><span class='const'>PrivateKey</span><span class='rparen'>)</span>
950
+ <span class='ivar'>@key</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:key</span><span class='rbracket'>]</span>
951
+ <span class='kw'>else</span>
952
+ <span class='ivar'>@key</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>PrivateKey</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:key</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:key</span><span class='rbracket'>]</span><span class='rparen'>)</span>
953
+ <span class='kw'>end</span>
954
+ <span class='kw'>end</span>
955
+
956
+ <span class='ivar'>@type</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='symbol'>:rsa</span>
957
+ <span class='kw'>if</span> <span class='ivar'>@type</span> <span class='op'>!=</span> <span class='symbol'>:rsa</span> <span class='kw'>and</span> <span class='ivar'>@type</span> <span class='op'>!=</span> <span class='symbol'>:dsa</span> <span class='kw'>and</span> <span class='ivar'>@key</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
958
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Must provide :rsa or :dsa as type when key is nil</span><span class='tstring_end'>'</span></span>
959
+ <span class='kw'>end</span>
960
+
961
+ <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:cert</span><span class='rparen'>)</span>
962
+ <span class='id identifier rubyid_domains'>domains</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:san_names</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
963
+ <span class='id identifier rubyid_parsed_domains'>parsed_domains</span> <span class='op'>=</span> <span class='id identifier rubyid_prefix_domains'>prefix_domains</span><span class='lparen'>(</span><span class='id identifier rubyid_domains'>domains</span><span class='rparen'>)</span>
964
+ <span class='id identifier rubyid_cert_data'>cert_data</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_cert'>parse_cert</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:cert</span><span class='rbracket'>]</span><span class='rparen'>)</span>
965
+ <span class='id identifier rubyid_merged_domains'>merged_domains</span> <span class='op'>=</span> <span class='id identifier rubyid_cert_data'>cert_data</span><span class='lbracket'>[</span><span class='symbol'>:subjectAltName</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_concat'>concat</span><span class='lparen'>(</span><span class='id identifier rubyid_parsed_domains'>parsed_domains</span><span class='rparen'>)</span>
966
+ <span class='id identifier rubyid_create_request'>create_request</span><span class='lparen'>(</span><span class='id identifier rubyid_cert_data'>cert_data</span><span class='lbracket'>[</span><span class='symbol'>:subject</span><span class='rbracket'>]</span><span class='comma'>,</span><span class='id identifier rubyid_merged_domains'>merged_domains</span><span class='rparen'>)</span> <span class='comment'>#sets @req
967
+ </span> <span class='kw'>elsif</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:subject</span><span class='rparen'>)</span>
968
+ <span class='id identifier rubyid_domains'>domains</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:san_names</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
969
+ <span class='id identifier rubyid_parsed_domains'>parsed_domains</span> <span class='op'>=</span> <span class='id identifier rubyid_prefix_domains'>prefix_domains</span><span class='lparen'>(</span><span class='id identifier rubyid_domains'>domains</span><span class='rparen'>)</span>
970
+ <span class='id identifier rubyid_create_request'>create_request</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:subject</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_parsed_domains'>parsed_domains</span><span class='rparen'>)</span> <span class='comment'>#sets @req
971
+ </span> <span class='kw'>elsif</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:csr</span><span class='rparen'>)</span>
972
+ <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:san_names</span><span class='rparen'>)</span>
973
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>You can't add domains to an existing CSR</span><span class='tstring_end'>&quot;</span></span>
974
+ <span class='kw'>end</span>
975
+ <span class='id identifier rubyid_parse_csr'>parse_csr</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:csr</span><span class='rbracket'>]</span><span class='rparen'>)</span>
976
+ <span class='kw'>else</span>
977
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Must provide one of cert, subject, or csr</span><span class='tstring_end'>&quot;</span></span>
978
+ <span class='kw'>end</span>
979
+
980
+ <span class='kw'>if</span> <span class='id identifier rubyid_dsa?'>dsa?</span>
981
+ <span class='comment'>#only DSS1 is acceptable for DSA signing in OpenSSL &lt; 1.0
982
+ </span> <span class='comment'>#post-1.0 you can sign with anything, but let's be conservative
983
+ </span> <span class='comment'>#see: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/PKey/DSA.html
984
+ </span> <span class='ivar'>@message_digest</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>MessageDigest</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'>dss1</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
985
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:message_digest</span><span class='rparen'>)</span>
986
+ <span class='ivar'>@message_digest</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>MessageDigest</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:message_digest</span><span class='rbracket'>]</span><span class='rparen'>)</span>
987
+ <span class='kw'>else</span>
988
+ <span class='ivar'>@message_digest</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>MessageDigest</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'>sha1</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
989
+ <span class='kw'>end</span>
990
+
991
+ <span class='kw'>if</span> <span class='kw'>not</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:csr</span><span class='rparen'>)</span>
992
+ <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_sign'>sign</span><span class='lparen'>(</span><span class='ivar'>@key</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='ivar'>@message_digest</span><span class='period'>.</span><span class='id identifier rubyid_digest'>digest</span><span class='rparen'>)</span>
993
+ <span class='kw'>end</span>
994
+ <span class='kw'>if</span> <span class='kw'>not</span> <span class='ivar'>@key</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>and</span> <span class='kw'>not</span> <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_verify'>verify</span><span class='lparen'>(</span><span class='ivar'>@key</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='rparen'>)</span> <span class='kw'>then</span>
995
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>R509Error</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Key does not match request.</span><span class='tstring_end'>'</span></span>
996
+ <span class='kw'>end</span>
997
+
998
+ <span class='kw'>end</span></pre>
999
+ </td>
1000
+ </tr>
1001
+ </table>
1002
+ </div>
1003
+
1004
+ </div>
1005
+
1006
+ <div id="instance_attr_details" class="attr_details">
1007
+ <h2>Instance Attribute Details</h2>
1008
+
1009
+
1010
+ <span id=""></span>
1011
+ <span id="attributes-instance_method"></span>
1012
+ <div class="method_details first">
1013
+ <h3 class="signature first" id="attributes-instance_method">
1014
+
1015
+ - (<tt>Object</tt>) <strong>attributes</strong> <span class="extras">(readonly)</span>
1016
+
1017
+
1018
+
1019
+
1020
+
1021
+ </h3><div class="docstring">
1022
+ <div class="discussion">
1023
+
1024
+ <p>Returns the value of attribute attributes</p>
1025
+
1026
+
1027
+ </div>
1028
+ </div>
1029
+ <div class="tags">
1030
+
1031
+
1032
+ </div><table class="source_code">
1033
+ <tr>
1034
+ <td>
1035
+ <pre class="lines">
1036
+
1037
+
1038
+ 11
1039
+ 12
1040
+ 13</pre>
1041
+ </td>
1042
+ <td>
1043
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 11</span>
1044
+
1045
+ <span class='kw'>def</span> <span class='id identifier rubyid_attributes'>attributes</span>
1046
+ <span class='ivar'>@attributes</span>
1047
+ <span class='kw'>end</span></pre>
1048
+ </td>
1049
+ </tr>
1050
+ </table>
1051
+ </div>
1052
+
1053
+
1054
+ <span id=""></span>
1055
+ <span id="key-instance_method"></span>
1056
+ <div class="method_details ">
1057
+ <h3 class="signature " id="key-instance_method">
1058
+
1059
+ - (<tt>Object</tt>) <strong>key</strong> <span class="extras">(readonly)</span>
1060
+
1061
+
1062
+
1063
+
1064
+
1065
+ </h3><div class="docstring">
1066
+ <div class="discussion">
1067
+
1068
+ <p>Returns the value of attribute key</p>
1069
+
1070
+
1071
+ </div>
1072
+ </div>
1073
+ <div class="tags">
1074
+
1075
+
1076
+ </div><table class="source_code">
1077
+ <tr>
1078
+ <td>
1079
+ <pre class="lines">
1080
+
1081
+
1082
+ 11
1083
+ 12
1084
+ 13</pre>
1085
+ </td>
1086
+ <td>
1087
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 11</span>
1088
+
1089
+ <span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span>
1090
+ <span class='ivar'>@key</span>
1091
+ <span class='kw'>end</span></pre>
1092
+ </td>
1093
+ </tr>
1094
+ </table>
1095
+ </div>
1096
+
1097
+
1098
+ <span id=""></span>
1099
+ <span id="message_digest-instance_method"></span>
1100
+ <div class="method_details ">
1101
+ <h3 class="signature " id="message_digest-instance_method">
1102
+
1103
+ - (<tt>Object</tt>) <strong>message_digest</strong> <span class="extras">(readonly)</span>
1104
+
1105
+
1106
+
1107
+
1108
+
1109
+ </h3><div class="docstring">
1110
+ <div class="discussion">
1111
+
1112
+ <p>Returns the value of attribute message_digest</p>
1113
+
1114
+
1115
+ </div>
1116
+ </div>
1117
+ <div class="tags">
1118
+
1119
+
1120
+ </div><table class="source_code">
1121
+ <tr>
1122
+ <td>
1123
+ <pre class="lines">
1124
+
1125
+
1126
+ 11
1127
+ 12
1128
+ 13</pre>
1129
+ </td>
1130
+ <td>
1131
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 11</span>
1132
+
1133
+ <span class='kw'>def</span> <span class='id identifier rubyid_message_digest'>message_digest</span>
1134
+ <span class='ivar'>@message_digest</span>
1135
+ <span class='kw'>end</span></pre>
1136
+ </td>
1137
+ </tr>
1138
+ </table>
1139
+ </div>
1140
+
1141
+
1142
+ <span id=""></span>
1143
+ <span id="req-instance_method"></span>
1144
+ <div class="method_details ">
1145
+ <h3 class="signature " id="req-instance_method">
1146
+
1147
+ - (<tt>Object</tt>) <strong>req</strong> <span class="extras">(readonly)</span>
1148
+
1149
+
1150
+
1151
+
1152
+
1153
+ </h3><div class="docstring">
1154
+ <div class="discussion">
1155
+
1156
+ <p>Returns the value of attribute req</p>
1157
+
1158
+
1159
+ </div>
1160
+ </div>
1161
+ <div class="tags">
1162
+
1163
+
1164
+ </div><table class="source_code">
1165
+ <tr>
1166
+ <td>
1167
+ <pre class="lines">
1168
+
1169
+
1170
+ 11
1171
+ 12
1172
+ 13</pre>
1173
+ </td>
1174
+ <td>
1175
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 11</span>
1176
+
1177
+ <span class='kw'>def</span> <span class='id identifier rubyid_req'>req</span>
1178
+ <span class='ivar'>@req</span>
1179
+ <span class='kw'>end</span></pre>
1180
+ </td>
1181
+ </tr>
1182
+ </table>
1183
+ </div>
1184
+
1185
+
1186
+ <span id=""></span>
1187
+ <span id="san_names-instance_method"></span>
1188
+ <div class="method_details ">
1189
+ <h3 class="signature " id="san_names-instance_method">
1190
+
1191
+ - (<tt>Object</tt>) <strong>san_names</strong> <span class="extras">(readonly)</span>
1192
+
1193
+
1194
+
1195
+
1196
+
1197
+ </h3><div class="docstring">
1198
+ <div class="discussion">
1199
+
1200
+ <p>Returns the value of attribute san_names</p>
1201
+
1202
+
1203
+ </div>
1204
+ </div>
1205
+ <div class="tags">
1206
+
1207
+
1208
+ </div><table class="source_code">
1209
+ <tr>
1210
+ <td>
1211
+ <pre class="lines">
1212
+
1213
+
1214
+ 11
1215
+ 12
1216
+ 13</pre>
1217
+ </td>
1218
+ <td>
1219
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 11</span>
1220
+
1221
+ <span class='kw'>def</span> <span class='id identifier rubyid_san_names'>san_names</span>
1222
+ <span class='ivar'>@san_names</span>
1223
+ <span class='kw'>end</span></pre>
1224
+ </td>
1225
+ </tr>
1226
+ </table>
1227
+ </div>
1228
+
1229
+
1230
+ <span id=""></span>
1231
+ <span id="subject-instance_method"></span>
1232
+ <div class="method_details ">
1233
+ <h3 class="signature " id="subject-instance_method">
1234
+
1235
+ - (<tt>Object</tt>) <strong>subject</strong> <span class="extras">(readonly)</span>
1236
+
1237
+
1238
+
1239
+
1240
+
1241
+ </h3><div class="docstring">
1242
+ <div class="discussion">
1243
+
1244
+ <p>Returns the value of attribute subject</p>
1245
+
1246
+
1247
+ </div>
1248
+ </div>
1249
+ <div class="tags">
1250
+
1251
+
1252
+ </div><table class="source_code">
1253
+ <tr>
1254
+ <td>
1255
+ <pre class="lines">
1256
+
1257
+
1258
+ 11
1259
+ 12
1260
+ 13</pre>
1261
+ </td>
1262
+ <td>
1263
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 11</span>
1264
+
1265
+ <span class='kw'>def</span> <span class='id identifier rubyid_subject'>subject</span>
1266
+ <span class='ivar'>@subject</span>
1267
+ <span class='kw'>end</span></pre>
1268
+ </td>
1269
+ </tr>
1270
+ </table>
1271
+ </div>
1272
+
1273
+ </div>
1274
+
1275
+
1276
+ <div id="class_method_details" class="method_details_list">
1277
+ <h2>Class Method Details</h2>
1278
+
1279
+
1280
+ <div class="method_details first">
1281
+ <h3 class="signature first" id="load_from_file-class_method">
1282
+
1283
+ + (<tt><span class='object_link'><a href="" title="R509::Csr (class)">R509::Csr</a></span></tt>) <strong>load_from_file</strong>(filename)
1284
+
1285
+
1286
+
1287
+
1288
+
1289
+ </h3><div class="docstring">
1290
+ <div class="discussion">
1291
+
1292
+ <p>Helper method to quickly load a CSR from the filesystem</p>
1293
+
1294
+
1295
+ </div>
1296
+ </div>
1297
+ <div class="tags">
1298
+ <p class="tag_title">Parameters:</p>
1299
+ <ul class="param">
1300
+
1301
+ <li>
1302
+
1303
+ <span class='name'>filename</span>
1304
+
1305
+
1306
+ <span class='type'>(<tt>String</tt>)</span>
1307
+
1308
+
1309
+
1310
+ &mdash;
1311
+ <div class='inline'>
1312
+ <p>Path to file you want to load</p>
1313
+ </div>
1314
+
1315
+ </li>
1316
+
1317
+ </ul>
1318
+
1319
+ <p class="tag_title">Returns:</p>
1320
+ <ul class="return">
1321
+
1322
+ <li>
1323
+
1324
+
1325
+ <span class='type'>(<tt><span class='object_link'><a href="" title="R509::Csr (class)">R509::Csr</a></span></tt>)</span>
1326
+
1327
+
1328
+
1329
+ &mdash;
1330
+ <div class='inline'>
1331
+ <p>Csr object</p>
1332
+ </div>
1333
+
1334
+ </li>
1335
+
1336
+ </ul>
1337
+
1338
+ </div><table class="source_code">
1339
+ <tr>
1340
+ <td>
1341
+ <pre class="lines">
1342
+
1343
+
1344
+ 88
1345
+ 89
1346
+ 90</pre>
1347
+ </td>
1348
+ <td>
1349
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 88</span>
1350
+
1351
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_load_from_file'>load_from_file</span><span class='lparen'>(</span> <span class='id identifier rubyid_filename'>filename</span> <span class='rparen'>)</span>
1352
+ <span class='kw'>return</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>Csr</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:csr</span> <span class='op'>=&gt;</span> <span class='const'>IOHelpers</span><span class='period'>.</span><span class='id identifier rubyid_read_data'>read_data</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span> <span class='rparen'>)</span>
1353
+ <span class='kw'>end</span></pre>
1354
+ </td>
1355
+ </tr>
1356
+ </table>
1357
+ </div>
1358
+
1359
+ </div>
1360
+
1361
+ <div id="instance_method_details" class="method_details_list">
1362
+ <h2>Instance Method Details</h2>
1363
+
1364
+
1365
+ <div class="method_details first">
1366
+ <h3 class="signature first" id="bit_strength-instance_method">
1367
+
1368
+ - (<tt>Integer</tt>) <strong>bit_strength</strong>
1369
+
1370
+
1371
+
1372
+
1373
+
1374
+ </h3><div class="docstring">
1375
+ <div class="discussion">
1376
+
1377
+ <p>Returns the bit strength of the key used to create the CSR</p>
1378
+
1379
+
1380
+ </div>
1381
+ </div>
1382
+ <div class="tags">
1383
+
1384
+ <p class="tag_title">Returns:</p>
1385
+ <ul class="return">
1386
+
1387
+ <li>
1388
+
1389
+
1390
+ <span class='type'>(<tt>Integer</tt>)</span>
1391
+
1392
+
1393
+
1394
+ &mdash;
1395
+ <div class='inline'>
1396
+ <p>the integer bit strength.</p>
1397
+ </div>
1398
+
1399
+ </li>
1400
+
1401
+ </ul>
1402
+
1403
+ </div><table class="source_code">
1404
+ <tr>
1405
+ <td>
1406
+ <pre class="lines">
1407
+
1408
+
1409
+ 162
1410
+ 163
1411
+ 164
1412
+ 165
1413
+ 166
1414
+ 167
1415
+ 168</pre>
1416
+ </td>
1417
+ <td>
1418
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 162</span>
1419
+
1420
+ <span class='kw'>def</span> <span class='id identifier rubyid_bit_strength'>bit_strength</span>
1421
+ <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_rsa?'>rsa?</span>
1422
+ <span class='kw'>return</span> <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='period'>.</span><span class='id identifier rubyid_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_num_bits'>num_bits</span>
1423
+ <span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dsa?'>dsa?</span>
1424
+ <span class='kw'>return</span> <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='period'>.</span><span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_num_bits'>num_bits</span>
1425
+ <span class='kw'>end</span>
1426
+ <span class='kw'>end</span></pre>
1427
+ </td>
1428
+ </tr>
1429
+ </table>
1430
+ </div>
1431
+
1432
+ <div class="method_details ">
1433
+ <h3 class="signature " id="dsa?-instance_method">
1434
+
1435
+ - (<tt>Boolean</tt>) <strong>dsa?</strong>
1436
+
1437
+
1438
+
1439
+
1440
+
1441
+ </h3><div class="docstring">
1442
+ <div class="discussion">
1443
+
1444
+ <p>Returns whether the public key is DSA</p>
1445
+
1446
+
1447
+ </div>
1448
+ </div>
1449
+ <div class="tags">
1450
+
1451
+ <p class="tag_title">Returns:</p>
1452
+ <ul class="return">
1453
+
1454
+ <li>
1455
+
1456
+
1457
+ <span class='type'>(<tt>Boolean</tt>)</span>
1458
+
1459
+
1460
+
1461
+ &mdash;
1462
+ <div class='inline'>
1463
+ <p>true if the public key is DSA, false otherwise</p>
1464
+ </div>
1465
+
1466
+ </li>
1467
+
1468
+ </ul>
1469
+
1470
+ </div><table class="source_code">
1471
+ <tr>
1472
+ <td>
1473
+ <pre class="lines">
1474
+
1475
+
1476
+ 156
1477
+ 157
1478
+ 158</pre>
1479
+ </td>
1480
+ <td>
1481
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 156</span>
1482
+
1483
+ <span class='kw'>def</span> <span class='id identifier rubyid_dsa?'>dsa?</span>
1484
+ <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>PKey</span><span class='op'>::</span><span class='const'>DSA</span><span class='rparen'>)</span>
1485
+ <span class='kw'>end</span></pre>
1486
+ </td>
1487
+ </tr>
1488
+ </table>
1489
+ </div>
1490
+
1491
+ <div class="method_details ">
1492
+ <h3 class="signature " id="has_private_key?-instance_method">
1493
+
1494
+ - (<tt>Boolean</tt>) <strong>has_private_key?</strong>
1495
+
1496
+
1497
+
1498
+
1499
+
1500
+ </h3><div class="docstring">
1501
+ <div class="discussion">
1502
+
1503
+ <p>Boolean of whether the object contains a private key</p>
1504
+
1505
+
1506
+ </div>
1507
+ </div>
1508
+ <div class="tags">
1509
+
1510
+ <p class="tag_title">Returns:</p>
1511
+ <ul class="return">
1512
+
1513
+ <li>
1514
+
1515
+
1516
+ <span class='type'>(<tt>Boolean</tt>)</span>
1517
+
1518
+
1519
+
1520
+ &mdash;
1521
+ <div class='inline'>
1522
+ <p>Boolean of whether the object contains a private key</p>
1523
+ </div>
1524
+
1525
+ </li>
1526
+
1527
+ </ul>
1528
+
1529
+ </div><table class="source_code">
1530
+ <tr>
1531
+ <td>
1532
+ <pre class="lines">
1533
+
1534
+
1535
+ 106
1536
+ 107
1537
+ 108
1538
+ 109
1539
+ 110
1540
+ 111
1541
+ 112</pre>
1542
+ </td>
1543
+ <td>
1544
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 106</span>
1545
+
1546
+ <span class='kw'>def</span> <span class='id identifier rubyid_has_private_key?'>has_private_key?</span>
1547
+ <span class='kw'>if</span> <span class='kw'>not</span> <span class='ivar'>@key</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1548
+ <span class='kw'>true</span>
1549
+ <span class='kw'>else</span>
1550
+ <span class='kw'>false</span>
1551
+ <span class='kw'>end</span>
1552
+ <span class='kw'>end</span></pre>
1553
+ </td>
1554
+ </tr>
1555
+ </table>
1556
+ </div>
1557
+
1558
+ <div class="method_details ">
1559
+ <h3 class="signature " id="key_algorithm-instance_method">
1560
+
1561
+ - (<tt>String</tt>) <strong>key_algorithm</strong>
1562
+
1563
+
1564
+
1565
+
1566
+
1567
+ </h3><div class="docstring">
1568
+ <div class="discussion">
1569
+
1570
+ <p>Returns key algorithm (RSA/DSA)</p>
1571
+
1572
+
1573
+ </div>
1574
+ </div>
1575
+ <div class="tags">
1576
+
1577
+ <p class="tag_title">Returns:</p>
1578
+ <ul class="return">
1579
+
1580
+ <li>
1581
+
1582
+
1583
+ <span class='type'>(<tt>String</tt>)</span>
1584
+
1585
+
1586
+
1587
+ &mdash;
1588
+ <div class='inline'>
1589
+ <p>value of the key algorithm. RSA or DSA</p>
1590
+ </div>
1591
+
1592
+ </li>
1593
+
1594
+ </ul>
1595
+
1596
+ </div><table class="source_code">
1597
+ <tr>
1598
+ <td>
1599
+ <pre class="lines">
1600
+
1601
+
1602
+ 192
1603
+ 193
1604
+ 194
1605
+ 195
1606
+ 196
1607
+ 197
1608
+ 198</pre>
1609
+ </td>
1610
+ <td>
1611
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 192</span>
1612
+
1613
+ <span class='kw'>def</span> <span class='id identifier rubyid_key_algorithm'>key_algorithm</span>
1614
+ <span class='kw'>if</span> <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>PKey</span><span class='op'>::</span><span class='const'>RSA</span> <span class='kw'>then</span>
1615
+ <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>RSA</span><span class='tstring_end'>'</span></span>
1616
+ <span class='kw'>elsif</span> <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>PKey</span><span class='op'>::</span><span class='const'>DSA</span> <span class='kw'>then</span>
1617
+ <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>DSA</span><span class='tstring_end'>'</span></span>
1618
+ <span class='kw'>end</span>
1619
+ <span class='kw'>end</span></pre>
1620
+ </td>
1621
+ </tr>
1622
+ </table>
1623
+ </div>
1624
+
1625
+ <div class="method_details ">
1626
+ <h3 class="signature " id="public_key-instance_method">
1627
+
1628
+ - (<tt>OpenSSL::PKey::RSA</tt>) <strong>public_key</strong>
1629
+
1630
+
1631
+
1632
+
1633
+
1634
+ </h3><div class="docstring">
1635
+ <div class="discussion">
1636
+
1637
+ <p>Public key</p>
1638
+
1639
+
1640
+ </div>
1641
+ </div>
1642
+ <div class="tags">
1643
+
1644
+ <p class="tag_title">Returns:</p>
1645
+ <ul class="return">
1646
+
1647
+ <li>
1648
+
1649
+
1650
+ <span class='type'>(<tt>OpenSSL::PKey::RSA</tt>)</span>
1651
+
1652
+
1653
+
1654
+ &mdash;
1655
+ <div class='inline'>
1656
+ <p>public key</p>
1657
+ </div>
1658
+
1659
+ </li>
1660
+
1661
+ </ul>
1662
+
1663
+ </div><table class="source_code">
1664
+ <tr>
1665
+ <td>
1666
+ <pre class="lines">
1667
+
1668
+
1669
+ 93
1670
+ 94
1671
+ 95
1672
+ 96
1673
+ 97</pre>
1674
+ </td>
1675
+ <td>
1676
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 93</span>
1677
+
1678
+ <span class='kw'>def</span> <span class='id identifier rubyid_public_key'>public_key</span>
1679
+ <span class='kw'>if</span><span class='lparen'>(</span><span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>X509</span><span class='op'>::</span><span class='const'>Request</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>then</span>
1680
+ <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span>
1681
+ <span class='kw'>end</span>
1682
+ <span class='kw'>end</span></pre>
1683
+ </td>
1684
+ </tr>
1685
+ </table>
1686
+ </div>
1687
+
1688
+ <div class="method_details ">
1689
+ <h3 class="signature " id="rsa?-instance_method">
1690
+
1691
+ - (<tt>Boolean</tt>) <strong>rsa?</strong>
1692
+
1693
+
1694
+
1695
+
1696
+
1697
+ </h3><div class="docstring">
1698
+ <div class="discussion">
1699
+
1700
+ <p>Returns whether the public key is RSA</p>
1701
+
1702
+
1703
+ </div>
1704
+ </div>
1705
+ <div class="tags">
1706
+
1707
+ <p class="tag_title">Returns:</p>
1708
+ <ul class="return">
1709
+
1710
+ <li>
1711
+
1712
+
1713
+ <span class='type'>(<tt>Boolean</tt>)</span>
1714
+
1715
+
1716
+
1717
+ &mdash;
1718
+ <div class='inline'>
1719
+ <p>true if the public key is RSA, false otherwise</p>
1720
+ </div>
1721
+
1722
+ </li>
1723
+
1724
+ </ul>
1725
+
1726
+ </div><table class="source_code">
1727
+ <tr>
1728
+ <td>
1729
+ <pre class="lines">
1730
+
1731
+
1732
+ 149
1733
+ 150
1734
+ 151</pre>
1735
+ </td>
1736
+ <td>
1737
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 149</span>
1738
+
1739
+ <span class='kw'>def</span> <span class='id identifier rubyid_rsa?'>rsa?</span>
1740
+ <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>PKey</span><span class='op'>::</span><span class='const'>RSA</span><span class='rparen'>)</span>
1741
+ <span class='kw'>end</span></pre>
1742
+ </td>
1743
+ </tr>
1744
+ </table>
1745
+ </div>
1746
+
1747
+ <div class="method_details ">
1748
+ <h3 class="signature " id="signature_algorithm-instance_method">
1749
+
1750
+ - (<tt>String</tt>) <strong>signature_algorithm</strong>
1751
+
1752
+
1753
+
1754
+
1755
+
1756
+ </h3><div class="docstring">
1757
+ <div class="discussion">
1758
+
1759
+ <p>Returns signature algorithm</p>
1760
+
1761
+
1762
+ </div>
1763
+ </div>
1764
+ <div class="tags">
1765
+
1766
+ <p class="tag_title">Returns:</p>
1767
+ <ul class="return">
1768
+
1769
+ <li>
1770
+
1771
+
1772
+ <span class='type'>(<tt>String</tt>)</span>
1773
+
1774
+
1775
+
1776
+ &mdash;
1777
+ <div class='inline'>
1778
+ <p>value of the signature algorithm. E.g. sha1WithRSAEncryption,
1779
+ sha256WithRSAEncryption, md5WithRSAEncryption</p>
1780
+ </div>
1781
+
1782
+ </li>
1783
+
1784
+ </ul>
1785
+
1786
+ </div><table class="source_code">
1787
+ <tr>
1788
+ <td>
1789
+ <pre class="lines">
1790
+
1791
+
1792
+ 185
1793
+ 186
1794
+ 187</pre>
1795
+ </td>
1796
+ <td>
1797
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 185</span>
1798
+
1799
+ <span class='kw'>def</span> <span class='id identifier rubyid_signature_algorithm'>signature_algorithm</span>
1800
+ <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_signature_algorithm'>signature_algorithm</span>
1801
+ <span class='kw'>end</span></pre>
1802
+ </td>
1803
+ </tr>
1804
+ </table>
1805
+ </div>
1806
+
1807
+ <div class="method_details ">
1808
+ <h3 class="signature " id="subject_component-instance_method">
1809
+
1810
+ - (<tt>String</tt>) <strong>subject_component</strong>(short_name)
1811
+
1812
+
1813
+
1814
+
1815
+
1816
+ </h3><div class="docstring">
1817
+ <div class="discussion">
1818
+
1819
+ <p>Returns subject component</p>
1820
+
1821
+
1822
+ </div>
1823
+ </div>
1824
+ <div class="tags">
1825
+
1826
+ <p class="tag_title">Returns:</p>
1827
+ <ul class="return">
1828
+
1829
+ <li>
1830
+
1831
+
1832
+ <span class='type'>(<tt>String</tt>)</span>
1833
+
1834
+
1835
+
1836
+ &mdash;
1837
+ <div class='inline'>
1838
+ <p>value of the subject component requested</p>
1839
+ </div>
1840
+
1841
+ </li>
1842
+
1843
+ </ul>
1844
+
1845
+ </div><table class="source_code">
1846
+ <tr>
1847
+ <td>
1848
+ <pre class="lines">
1849
+
1850
+
1851
+ 173
1852
+ 174
1853
+ 175
1854
+ 176
1855
+ 177
1856
+ 178
1857
+ 179
1858
+ 180</pre>
1859
+ </td>
1860
+ <td>
1861
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 173</span>
1862
+
1863
+ <span class='kw'>def</span> <span class='id identifier rubyid_subject_component'>subject_component</span> <span class='id identifier rubyid_short_name'>short_name</span>
1864
+ <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_subject'>subject</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_element'>element</span><span class='op'>|</span>
1865
+ <span class='kw'>if</span> <span class='id identifier rubyid_element'>element</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='op'>==</span> <span class='id identifier rubyid_short_name'>short_name</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='kw'>then</span>
1866
+ <span class='kw'>return</span> <span class='id identifier rubyid_element'>element</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
1867
+ <span class='kw'>end</span>
1868
+ <span class='kw'>end</span>
1869
+ <span class='kw'>nil</span>
1870
+ <span class='kw'>end</span></pre>
1871
+ </td>
1872
+ </tr>
1873
+ </table>
1874
+ </div>
1875
+
1876
+ <div class="method_details ">
1877
+ <h3 class="signature " id="to_der-instance_method">
1878
+
1879
+ - (<tt>String</tt>) <strong>to_der</strong>
1880
+
1881
+
1882
+
1883
+
1884
+
1885
+ </h3><div class="docstring">
1886
+ <div class="discussion">
1887
+
1888
+ <p>Converts the CSR into the DER format</p>
1889
+
1890
+
1891
+ </div>
1892
+ </div>
1893
+ <div class="tags">
1894
+
1895
+ <p class="tag_title">Returns:</p>
1896
+ <ul class="return">
1897
+
1898
+ <li>
1899
+
1900
+
1901
+ <span class='type'>(<tt>String</tt>)</span>
1902
+
1903
+
1904
+
1905
+ &mdash;
1906
+ <div class='inline'>
1907
+ <p>the CSR converted into DER format.</p>
1908
+ </div>
1909
+
1910
+ </li>
1911
+
1912
+ </ul>
1913
+
1914
+ </div><table class="source_code">
1915
+ <tr>
1916
+ <td>
1917
+ <pre class="lines">
1918
+
1919
+
1920
+ 126
1921
+ 127
1922
+ 128</pre>
1923
+ </td>
1924
+ <td>
1925
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 126</span>
1926
+
1927
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_der'>to_der</span>
1928
+ <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_to_der'>to_der</span>
1929
+ <span class='kw'>end</span></pre>
1930
+ </td>
1931
+ </tr>
1932
+ </table>
1933
+ </div>
1934
+
1935
+ <div class="method_details ">
1936
+ <h3 class="signature " id="to_hash-instance_method">
1937
+
1938
+ - (<tt>Hash</tt>) <strong>to_hash</strong>
1939
+
1940
+
1941
+
1942
+
1943
+
1944
+ </h3><div class="docstring">
1945
+ <div class="discussion">
1946
+
1947
+ <p>Returns a hash structure you can pass to the Ca. You will want to call this
1948
+ method if you intend to alter the values and then pass them to the Ca
1949
+ class.</p>
1950
+
1951
+
1952
+ </div>
1953
+ </div>
1954
+ <div class="tags">
1955
+
1956
+ <p class="tag_title">Returns:</p>
1957
+ <ul class="return">
1958
+
1959
+ <li>
1960
+
1961
+
1962
+ <span class='type'>(<tt>Hash</tt>)</span>
1963
+
1964
+
1965
+
1966
+ &mdash;
1967
+ <div class='inline'>
1968
+ <p>:subject and :san_names you can pass to Ca</p>
1969
+ </div>
1970
+
1971
+ </li>
1972
+
1973
+ </ul>
1974
+
1975
+ </div><table class="source_code">
1976
+ <tr>
1977
+ <td>
1978
+ <pre class="lines">
1979
+
1980
+
1981
+ 205
1982
+ 206
1983
+ 207</pre>
1984
+ </td>
1985
+ <td>
1986
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 205</span>
1987
+
1988
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_hash'>to_hash</span>
1989
+ <span class='lbrace'>{</span> <span class='symbol'>:subject</span> <span class='op'>=&gt;</span> <span class='ivar'>@subject</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span> <span class='comma'>,</span> <span class='symbol'>:san_names</span> <span class='op'>=&gt;</span> <span class='ivar'>@san_names</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span> <span class='rbrace'>}</span>
1990
+ <span class='kw'>end</span></pre>
1991
+ </td>
1992
+ </tr>
1993
+ </table>
1994
+ </div>
1995
+
1996
+ <div class="method_details ">
1997
+ <h3 class="signature " id="to_pem-instance_method">
1998
+
1999
+ - (<tt>String</tt>) <strong>to_pem</strong>
2000
+
2001
+
2002
+
2003
+ <span class="aliases">Also known as:
2004
+ <span class="names"><span id='to_s-instance_method'>to_s</span></span>
2005
+ </span>
2006
+
2007
+
2008
+
2009
+ </h3><div class="docstring">
2010
+ <div class="discussion">
2011
+
2012
+ <p>Converts the CSR into the PEM format</p>
2013
+
2014
+
2015
+ </div>
2016
+ </div>
2017
+ <div class="tags">
2018
+
2019
+ <p class="tag_title">Returns:</p>
2020
+ <ul class="return">
2021
+
2022
+ <li>
2023
+
2024
+
2025
+ <span class='type'>(<tt>String</tt>)</span>
2026
+
2027
+
2028
+
2029
+ &mdash;
2030
+ <div class='inline'>
2031
+ <p>the CSR converted into PEM format.</p>
2032
+ </div>
2033
+
2034
+ </li>
2035
+
2036
+ </ul>
2037
+
2038
+ </div><table class="source_code">
2039
+ <tr>
2040
+ <td>
2041
+ <pre class="lines">
2042
+
2043
+
2044
+ 117
2045
+ 118
2046
+ 119</pre>
2047
+ </td>
2048
+ <td>
2049
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 117</span>
2050
+
2051
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_pem'>to_pem</span>
2052
+ <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_to_pem'>to_pem</span>
2053
+ <span class='kw'>end</span></pre>
2054
+ </td>
2055
+ </tr>
2056
+ </table>
2057
+ </div>
2058
+
2059
+ <div class="method_details ">
2060
+ <h3 class="signature " id="verify_signature-instance_method">
2061
+
2062
+ - (<tt>Boolean</tt>) <strong>verify_signature</strong>
2063
+
2064
+
2065
+
2066
+
2067
+
2068
+ </h3><div class="docstring">
2069
+ <div class="discussion">
2070
+
2071
+ <p>Verifies the integrity of the signature on the request</p>
2072
+
2073
+
2074
+ </div>
2075
+ </div>
2076
+ <div class="tags">
2077
+
2078
+ <p class="tag_title">Returns:</p>
2079
+ <ul class="return">
2080
+
2081
+ <li>
2082
+
2083
+
2084
+ <span class='type'>(<tt>Boolean</tt>)</span>
2085
+
2086
+
2087
+
2088
+ </li>
2089
+
2090
+ </ul>
2091
+
2092
+ </div><table class="source_code">
2093
+ <tr>
2094
+ <td>
2095
+ <pre class="lines">
2096
+
2097
+
2098
+ 101
2099
+ 102
2100
+ 103</pre>
2101
+ </td>
2102
+ <td>
2103
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 101</span>
2104
+
2105
+ <span class='kw'>def</span> <span class='id identifier rubyid_verify_signature'>verify_signature</span>
2106
+ <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_verify'>verify</span><span class='lparen'>(</span><span class='id identifier rubyid_public_key'>public_key</span><span class='rparen'>)</span>
2107
+ <span class='kw'>end</span></pre>
2108
+ </td>
2109
+ </tr>
2110
+ </table>
2111
+ </div>
2112
+
2113
+ <div class="method_details ">
2114
+ <h3 class="signature " id="write_der-instance_method">
2115
+
2116
+ - (<tt>Object</tt>) <strong>write_der</strong>(filename_or_io)
2117
+
2118
+
2119
+
2120
+
2121
+
2122
+ </h3><div class="docstring">
2123
+ <div class="discussion">
2124
+
2125
+ <p>Writes the CSR into the DER format</p>
2126
+
2127
+
2128
+ </div>
2129
+ </div>
2130
+ <div class="tags">
2131
+ <p class="tag_title">Parameters:</p>
2132
+ <ul class="param">
2133
+
2134
+ <li>
2135
+
2136
+ <span class='name'>filename_or_io</span>
2137
+
2138
+
2139
+ <span class='type'>(<tt>String</tt>, <tt>#write</tt>)</span>
2140
+
2141
+
2142
+
2143
+ &mdash;
2144
+ <div class='inline'>
2145
+ <p>Either a string of the path for the file that you'd like to write, or an
2146
+ IO-like object.</p>
2147
+ </div>
2148
+
2149
+ </li>
2150
+
2151
+ </ul>
2152
+
2153
+
2154
+ </div><table class="source_code">
2155
+ <tr>
2156
+ <td>
2157
+ <pre class="lines">
2158
+
2159
+
2160
+ 142
2161
+ 143
2162
+ 144</pre>
2163
+ </td>
2164
+ <td>
2165
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 142</span>
2166
+
2167
+ <span class='kw'>def</span> <span class='id identifier rubyid_write_der'>write_der</span><span class='lparen'>(</span><span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='rparen'>)</span>
2168
+ <span class='id identifier rubyid_write_data'>write_data</span><span class='lparen'>(</span><span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='comma'>,</span> <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_to_der'>to_der</span><span class='rparen'>)</span>
2169
+ <span class='kw'>end</span></pre>
2170
+ </td>
2171
+ </tr>
2172
+ </table>
2173
+ </div>
2174
+
2175
+ <div class="method_details ">
2176
+ <h3 class="signature " id="write_pem-instance_method">
2177
+
2178
+ - (<tt>Object</tt>) <strong>write_pem</strong>(filename_or_io)
2179
+
2180
+
2181
+
2182
+
2183
+
2184
+ </h3><div class="docstring">
2185
+ <div class="discussion">
2186
+
2187
+ <p>Writes the CSR into the PEM format</p>
2188
+
2189
+
2190
+ </div>
2191
+ </div>
2192
+ <div class="tags">
2193
+ <p class="tag_title">Parameters:</p>
2194
+ <ul class="param">
2195
+
2196
+ <li>
2197
+
2198
+ <span class='name'>filename_or_io</span>
2199
+
2200
+
2201
+ <span class='type'>(<tt>String</tt>, <tt>#write</tt>)</span>
2202
+
2203
+
2204
+
2205
+ &mdash;
2206
+ <div class='inline'>
2207
+ <p>Either a string of the path for the file that you'd like to write, or an
2208
+ IO-like object.</p>
2209
+ </div>
2210
+
2211
+ </li>
2212
+
2213
+ </ul>
2214
+
2215
+
2216
+ </div><table class="source_code">
2217
+ <tr>
2218
+ <td>
2219
+ <pre class="lines">
2220
+
2221
+
2222
+ 134
2223
+ 135
2224
+ 136</pre>
2225
+ </td>
2226
+ <td>
2227
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 134</span>
2228
+
2229
+ <span class='kw'>def</span> <span class='id identifier rubyid_write_pem'>write_pem</span><span class='lparen'>(</span><span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='rparen'>)</span>
2230
+ <span class='id identifier rubyid_write_data'>write_data</span><span class='lparen'>(</span><span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='comma'>,</span> <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_to_pem'>to_pem</span><span class='rparen'>)</span>
2231
+ <span class='kw'>end</span></pre>
2232
+ </td>
2233
+ </tr>
2234
+ </table>
2235
+ </div>
2236
+
2237
+ </div>
2238
+
2239
+ </div>
2240
+
2241
+ <div id="footer">
2242
+ Generated on Tue Oct 23 22:48:01 2012 by
2243
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2244
+ 0.8.0 (ruby-1.9.3).
2245
+ </div>
2246
+
2247
+ </body>
2248
+ </html>