r509 0.8.1 → 0.9

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 (203) hide show
  1. data/README.md +343 -151
  2. data/Rakefile +26 -23
  3. data/bin/r509 +126 -112
  4. data/bin/r509-parse +24 -24
  5. data/doc/R509.html +169 -7
  6. data/doc/R509/ASN1.html +370 -0
  7. data/doc/R509/ASN1/GeneralName.html +1121 -0
  8. data/doc/R509/ASN1/GeneralNames.html +843 -0
  9. data/doc/R509/ASN1/NoticeReference.html +392 -0
  10. data/doc/R509/ASN1/PolicyInformation.html +387 -0
  11. data/doc/R509/ASN1/PolicyQualifiers.html +455 -0
  12. data/doc/R509/ASN1/UserNotice.html +386 -0
  13. data/doc/R509/{Crl.html → CRL.html} +7 -7
  14. data/doc/R509/CRL/Administrator.html +1559 -0
  15. data/doc/R509/{Crl/Parser.html → CRL/SignedList.html} +501 -210
  16. data/doc/R509/{Csr.html → CSR.html} +444 -314
  17. data/doc/R509/Cert.html +866 -617
  18. data/doc/R509/Cert/Extensions.html +52 -41
  19. data/doc/R509/Cert/Extensions/AuthorityInfoAccess.html +70 -35
  20. data/doc/R509/Cert/Extensions/AuthorityKeyIdentifier.html +387 -4
  21. data/doc/R509/Cert/Extensions/BasicConstraints.html +61 -25
  22. data/doc/R509/Cert/Extensions/CRLDistributionPoints.html +354 -0
  23. data/doc/R509/Cert/Extensions/CertificatePolicies.html +340 -0
  24. data/doc/R509/Cert/Extensions/ExtendedKeyUsage.html +440 -49
  25. data/doc/R509/Cert/Extensions/{CrlDistributionPoints.html → InhibitAnyPolicy.html} +52 -35
  26. data/doc/R509/Cert/Extensions/KeyUsage.html +247 -121
  27. data/doc/R509/Cert/Extensions/NameConstraints.html +445 -0
  28. data/doc/R509/Cert/Extensions/OCSPNoCheck.html +239 -0
  29. data/doc/R509/Cert/Extensions/PolicyConstraints.html +424 -0
  30. data/doc/R509/Cert/Extensions/SubjectAlternativeName.html +437 -62
  31. data/doc/R509/Cert/Extensions/SubjectKeyIdentifier.html +52 -10
  32. data/doc/R509/CertificateAuthority.html +4 -4
  33. data/doc/R509/CertificateAuthority/Signer.html +154 -187
  34. data/doc/R509/Config.html +6 -6
  35. data/doc/R509/Config/{CaConfig.html → CAConfig.html} +451 -348
  36. data/doc/R509/Config/{CaConfigPool.html → CAConfigPool.html} +47 -47
  37. data/doc/R509/Config/CAProfile.html +1015 -0
  38. data/doc/R509/Config/SubjectItemPolicy.html +86 -86
  39. data/doc/R509/IOHelpers.html +22 -22
  40. data/doc/R509/MessageDigest.html +14 -14
  41. data/doc/R509/NameSanitizer.html +53 -53
  42. data/doc/R509/{Ocsp.html → OCSP.html} +9 -9
  43. data/doc/R509/{Ocsp → OCSP}/Request.html +7 -7
  44. data/doc/R509/{Ocsp → OCSP}/Request/Nonce.html +56 -11
  45. data/doc/R509/{Ocsp → OCSP}/Response.html +44 -44
  46. data/doc/R509/{OidMapper.html → OIDMapper.html} +23 -39
  47. data/doc/R509/PrivateKey.html +415 -168
  48. data/doc/R509/R509Error.html +3 -3
  49. data/doc/R509/{Spki.html → SPKI.html} +354 -192
  50. data/doc/R509/Subject.html +224 -113
  51. data/doc/R509/Validity.html +27 -5
  52. data/doc/R509/Validity/Checker.html +13 -13
  53. data/doc/R509/Validity/DefaultChecker.html +13 -13
  54. data/doc/R509/Validity/DefaultWriter.html +14 -14
  55. data/doc/R509/Validity/Status.html +39 -39
  56. data/doc/R509/Validity/Writer.html +18 -18
  57. data/doc/_index.html +138 -35
  58. data/doc/class_list.html +1 -1
  59. data/doc/css/style.css +10 -0
  60. data/doc/file.README.html +368 -171
  61. data/doc/file.r509.html +92 -69
  62. data/doc/frames.html +1 -1
  63. data/doc/index.html +368 -171
  64. data/doc/method_list.html +910 -390
  65. data/doc/top-level-namespace.html +3 -3
  66. data/lib/r509.rb +32 -16
  67. data/lib/r509/asn1.rb +375 -0
  68. data/lib/r509/cert.rb +381 -364
  69. data/lib/r509/cert/extensions.rb +443 -76
  70. data/lib/r509/certificate_authority.rb +407 -0
  71. data/lib/r509/config.rb +547 -351
  72. data/lib/r509/crl.rb +336 -366
  73. data/lib/r509/csr.rb +278 -289
  74. data/lib/r509/ec-hack.rb +37 -0
  75. data/lib/r509/exceptions.rb +3 -3
  76. data/lib/r509/io_helpers.rb +44 -44
  77. data/lib/r509/message_digest.rb +53 -0
  78. data/lib/r509/ocsp.rb +80 -70
  79. data/lib/r509/oid_mapper.rb +32 -0
  80. data/lib/r509/private_key.rb +228 -0
  81. data/lib/r509/spki.rb +145 -93
  82. data/lib/r509/subject.rb +203 -110
  83. data/lib/r509/validity.rb +70 -68
  84. data/lib/r509/version.rb +2 -2
  85. data/r509.yaml +92 -69
  86. data/spec/asn1_spec.rb +402 -0
  87. data/spec/cert/extensions_spec.rb +957 -494
  88. data/spec/cert_spec.rb +382 -307
  89. data/spec/certificate_authority_spec.rb +668 -250
  90. data/spec/config_spec.rb +515 -302
  91. data/spec/crl_spec.rb +197 -198
  92. data/spec/csr_spec.rb +334 -289
  93. data/spec/fixtures.rb +247 -171
  94. data/spec/fixtures/cert1.der +0 -0
  95. data/spec/fixtures/cert1.pem +0 -0
  96. data/spec/fixtures/cert1_public_key_modulus.txt +0 -0
  97. data/spec/fixtures/cert3.p12 +0 -0
  98. data/spec/fixtures/cert3.pem +0 -0
  99. data/spec/fixtures/cert3_key.pem +0 -0
  100. data/spec/fixtures/cert3_key_des3.pem +0 -0
  101. data/spec/fixtures/cert4.pem +0 -0
  102. data/spec/fixtures/cert5.pem +0 -0
  103. data/spec/fixtures/cert6.pem +0 -0
  104. data/spec/fixtures/cert_expired.pem +0 -0
  105. data/spec/fixtures/cert_inhibit.pem +24 -0
  106. data/spec/fixtures/cert_name_constraints.pem +29 -0
  107. data/spec/fixtures/cert_not_yet_valid.pem +0 -0
  108. data/spec/fixtures/cert_ocsp_no_check.pem +18 -0
  109. data/spec/fixtures/cert_policy_constraints.pem +31 -0
  110. data/spec/fixtures/cert_san.pem +0 -0
  111. data/spec/fixtures/cert_san2.pem +0 -0
  112. data/spec/fixtures/cert_unknown_extension.pem +28 -0
  113. data/spec/fixtures/config_pool_test_minimal.yaml +11 -11
  114. data/spec/fixtures/config_test.yaml +54 -36
  115. data/spec/fixtures/config_test_dsa.yaml +35 -0
  116. data/spec/fixtures/config_test_ec.yaml +35 -0
  117. data/spec/fixtures/config_test_engine_key.yaml +5 -5
  118. data/spec/fixtures/config_test_engine_no_key_name.yaml +4 -4
  119. data/spec/fixtures/config_test_minimal.yaml +4 -4
  120. data/spec/fixtures/config_test_password.yaml +5 -5
  121. data/spec/fixtures/config_test_various.yaml +111 -74
  122. data/spec/fixtures/crl_list_file.txt +0 -0
  123. data/spec/fixtures/crl_with_reason.pem +0 -0
  124. data/spec/fixtures/csr1.der +0 -0
  125. data/spec/fixtures/csr1.pem +0 -0
  126. data/spec/fixtures/csr1_key.der +0 -0
  127. data/spec/fixtures/csr1_key.pem +0 -0
  128. data/spec/fixtures/csr1_key_encrypted_des3.pem +0 -0
  129. data/spec/fixtures/csr1_newlines.pem +0 -0
  130. data/spec/fixtures/csr1_no_begin_end.pem +0 -0
  131. data/spec/fixtures/csr1_public_key_modulus.txt +0 -0
  132. data/spec/fixtures/csr2.pem +0 -0
  133. data/spec/fixtures/csr2_key.pem +0 -0
  134. data/spec/fixtures/csr3.pem +0 -0
  135. data/spec/fixtures/csr4.pem +0 -0
  136. data/spec/fixtures/csr_dsa.pem +0 -0
  137. data/spec/fixtures/csr_invalid_signature.pem +0 -0
  138. data/spec/fixtures/dsa_key.pem +0 -0
  139. data/spec/fixtures/dsa_root.cer +28 -0
  140. data/spec/fixtures/dsa_root.key +20 -0
  141. data/spec/fixtures/ec_csr2.der +0 -0
  142. data/spec/fixtures/ec_csr2.pem +8 -0
  143. data/spec/fixtures/ec_key1.der +0 -0
  144. data/spec/fixtures/ec_key1.pem +6 -0
  145. data/spec/fixtures/ec_key1_encrypted.pem +9 -0
  146. data/spec/fixtures/ec_key2.pem +6 -0
  147. data/spec/fixtures/hmacsha1.sig +1 -0
  148. data/spec/fixtures/hmacsha512.sig +1 -0
  149. data/spec/fixtures/key4.pem +0 -0
  150. data/spec/fixtures/key4_encrypted_des3.pem +0 -0
  151. data/spec/fixtures/missing_key_identifier_ca.cer +0 -0
  152. data/spec/fixtures/missing_key_identifier_ca.key +0 -0
  153. data/spec/fixtures/ocsptest.r509.local.pem +0 -0
  154. data/spec/fixtures/ocsptest.r509.local_ocsp_request.der +0 -0
  155. data/spec/fixtures/ocsptest2.r509.local.pem +0 -0
  156. data/spec/fixtures/second_ca.cer +0 -0
  157. data/spec/fixtures/second_ca.key +0 -0
  158. data/spec/fixtures/spkac.der +0 -0
  159. data/spec/fixtures/spkac.txt +0 -0
  160. data/spec/fixtures/spkac_dsa.txt +1 -1
  161. data/spec/fixtures/spkac_dsa_no_verify.txt +1 -0
  162. data/spec/fixtures/spkac_ec.txt +1 -0
  163. data/spec/fixtures/spkac_rsa_newlines.txt +13 -0
  164. data/spec/fixtures/stca.pem +0 -0
  165. data/spec/fixtures/stca_ocsp_request.der +0 -0
  166. data/spec/fixtures/stca_ocsp_response.der +0 -0
  167. data/spec/fixtures/test1.csr +0 -0
  168. data/spec/fixtures/test_ca.cer +0 -0
  169. data/spec/fixtures/test_ca.key +0 -0
  170. data/spec/fixtures/test_ca.p12 +0 -0
  171. data/spec/fixtures/test_ca_des3.key +0 -0
  172. data/spec/fixtures/test_ca_ec.cer +14 -0
  173. data/spec/fixtures/test_ca_ec.key +6 -0
  174. data/spec/fixtures/test_ca_ec_ee.cer +22 -0
  175. data/spec/fixtures/test_ca_ec_ee.key +6 -0
  176. data/spec/fixtures/test_ca_ocsp.cer +0 -0
  177. data/spec/fixtures/test_ca_ocsp.key +0 -0
  178. data/spec/fixtures/test_ca_ocsp.p12 +0 -0
  179. data/spec/fixtures/test_ca_ocsp_chain.txt +0 -0
  180. data/spec/fixtures/test_ca_ocsp_response.der +0 -0
  181. data/spec/fixtures/test_ca_subroot.cer +0 -0
  182. data/spec/fixtures/test_ca_subroot.key +0 -0
  183. data/spec/fixtures/test_ca_subroot_ocsp.cer +0 -0
  184. data/spec/fixtures/test_ca_subroot_ocsp.key +0 -0
  185. data/spec/fixtures/test_ca_subroot_ocsp_response.der +0 -0
  186. data/spec/fixtures/unknown_oid.csr +0 -0
  187. data/spec/message_digest_spec.rb +104 -84
  188. data/spec/ocsp_spec.rb +105 -105
  189. data/spec/oid_mapper_spec.rb +21 -21
  190. data/spec/private_key_spec.rb +275 -0
  191. data/spec/r509_spec.rb +35 -0
  192. data/spec/spec_helper.rb +15 -6
  193. data/spec/spki_spec.rb +221 -142
  194. data/spec/subject_spec.rb +232 -164
  195. data/spec/validity_spec.rb +91 -91
  196. metadata +79 -25
  197. data/doc/R509/Config/CaProfile.html +0 -651
  198. data/doc/R509/Crl/Administrator.html +0 -2073
  199. data/lib/r509/certificateauthority.rb +0 -290
  200. data/lib/r509/messagedigest.rb +0 -49
  201. data/lib/r509/oidmapper.rb +0 -32
  202. data/lib/r509/privatekey.rb +0 -185
  203. data/spec/privatekey_spec.rb +0 -198
@@ -4,9 +4,9 @@
4
4
  <head>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
6
  <title>
7
- Class: R509::Csr
7
+ Class: R509::CSR
8
8
 
9
- &mdash; Documentation by YARD 0.8.2.1
9
+ &mdash; Documentation by YARD 0.8.5
10
10
 
11
11
  </title>
12
12
 
@@ -34,7 +34,7 @@
34
34
  <a href="../_index.html">Index (C)</a> &raquo;
35
35
  <span class='title'><span class='object_link'><a href="../R509.html" title="R509 (module)">R509</a></span></span>
36
36
  &raquo;
37
- <span class="title">Csr</span>
37
+ <span class="title">CSR</span>
38
38
 
39
39
 
40
40
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
@@ -63,7 +63,7 @@
63
63
 
64
64
  <iframe id="search_frame"></iframe>
65
65
 
66
- <div id="content"><h1>Class: R509::Csr
66
+ <div id="content"><h1>Class: R509::CSR
67
67
 
68
68
 
69
69
 
@@ -78,7 +78,7 @@
78
78
  <ul class="fullTree">
79
79
  <li>Object</li>
80
80
 
81
- <li class="next">R509::Csr</li>
81
+ <li class="next">R509::CSR</li>
82
82
 
83
83
  </ul>
84
84
  <a href="#" class="inheritanceTree">show all</a>
@@ -240,7 +240,7 @@
240
240
  <li class="public ">
241
241
  <span class="summary_signature">
242
242
 
243
- <a href="#san_names-instance_method" title="#san_names (instance method)">- (Object) <strong>san_names</strong> </a>
243
+ <a href="#san-instance_method" title="#san (instance method)">- (Object) <strong>san</strong> </a>
244
244
 
245
245
 
246
246
 
@@ -260,7 +260,7 @@
260
260
 
261
261
 
262
262
  <span class="summary_desc"><div class='inline'>
263
- <p>Returns the value of attribute san_names.</p>
263
+ <p>Returns the value of attribute san.</p>
264
264
  </div></span>
265
265
 
266
266
  </li>
@@ -311,7 +311,7 @@
311
311
  <li class="public ">
312
312
  <span class="summary_signature">
313
313
 
314
- <a href="#load_from_file-class_method" title="load_from_file (class method)">+ (R509::Csr) <strong>load_from_file</strong>(filename) </a>
314
+ <a href="#load_from_file-class_method" title="load_from_file (class method)">+ (R509::CSR) <strong>load_from_file</strong>(filename) </a>
315
315
 
316
316
 
317
317
 
@@ -362,6 +362,31 @@
362
362
  <p>Returns the bit strength of the key used to create the CSR.</p>
363
363
  </div></span>
364
364
 
365
+ </li>
366
+
367
+
368
+ <li class="public ">
369
+ <span class="summary_signature">
370
+
371
+ <a href="#curve_name-instance_method" title="#curve_name (instance method)">- (String) <strong>curve_name</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 the short name of the elliptic curve used to generate the public
387
+ key if the key is EC.</p>
388
+ </div></span>
389
+
365
390
  </li>
366
391
 
367
392
 
@@ -392,7 +417,7 @@
392
417
  <li class="public ">
393
418
  <span class="summary_signature">
394
419
 
395
- <a href="#has_private_key%3F-instance_method" title="#has_private_key? (instance method)">- (Boolean) <strong>has_private_key?</strong> </a>
420
+ <a href="#ec%3F-instance_method" title="#ec? (instance method)">- (Boolean) <strong>ec?</strong> </a>
396
421
 
397
422
 
398
423
 
@@ -407,7 +432,7 @@
407
432
 
408
433
 
409
434
  <span class="summary_desc"><div class='inline'>
410
- <p>Boolean of whether the object contains a private key.</p>
435
+ <p>Returns whether the public key is EC.</p>
411
436
  </div></span>
412
437
 
413
438
  </li>
@@ -416,15 +441,13 @@
416
441
  <li class="public ">
417
442
  <span class="summary_signature">
418
443
 
419
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (Csr) <strong>initialize</strong>(opts = {}) </a>
444
+ <a href="#has_private_key%3F-instance_method" title="#has_private_key? (instance method)">- (Boolean) <strong>has_private_key?</strong> </a>
420
445
 
421
446
 
422
447
 
423
448
  </span>
424
449
 
425
450
 
426
- <span class="note title constructor">constructor</span>
427
-
428
451
 
429
452
 
430
453
 
@@ -433,7 +456,7 @@
433
456
 
434
457
 
435
458
  <span class="summary_desc"><div class='inline'>
436
- <p>you can also pass OIDs (see tests).</p>
459
+ <p>Boolean of whether the object contains a private key.</p>
437
460
  </div></span>
438
461
 
439
462
  </li>
@@ -442,13 +465,15 @@
442
465
  <li class="public ">
443
466
  <span class="summary_signature">
444
467
 
445
- <a href="#key_algorithm-instance_method" title="#key_algorithm (instance method)">- (String) <strong>key_algorithm</strong> </a>
468
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (CSR) <strong>initialize</strong>(opts = {}) </a>
446
469
 
447
470
 
448
471
 
449
472
  </span>
450
473
 
451
474
 
475
+ <span class="note title constructor">constructor</span>
476
+
452
477
 
453
478
 
454
479
 
@@ -457,7 +482,7 @@
457
482
 
458
483
 
459
484
  <span class="summary_desc"><div class='inline'>
460
- <p>Returns key algorithm (RSA/DSA).</p>
485
+ <p>A new instance of CSR.</p>
461
486
  </div></span>
462
487
 
463
488
  </li>
@@ -466,7 +491,7 @@
466
491
  <li class="public ">
467
492
  <span class="summary_signature">
468
493
 
469
- <a href="#public_key-instance_method" title="#public_key (instance method)">- (OpenSSL::PKey::RSA) <strong>public_key</strong> </a>
494
+ <a href="#key_algorithm-instance_method" title="#key_algorithm (instance method)">- (Symbol) <strong>key_algorithm</strong> </a>
470
495
 
471
496
 
472
497
 
@@ -481,7 +506,7 @@
481
506
 
482
507
 
483
508
  <span class="summary_desc"><div class='inline'>
484
- <p>Public key.</p>
509
+ <p>Returns key algorithm (RSA/DSA/EC).</p>
485
510
  </div></span>
486
511
 
487
512
  </li>
@@ -490,7 +515,7 @@
490
515
  <li class="public ">
491
516
  <span class="summary_signature">
492
517
 
493
- <a href="#rsa%3F-instance_method" title="#rsa? (instance method)">- (Boolean) <strong>rsa?</strong> </a>
518
+ <a href="#public_key-instance_method" title="#public_key (instance method)">- (OpenSSL::PKey::RSA, ...) <strong>public_key</strong> </a>
494
519
 
495
520
 
496
521
 
@@ -505,7 +530,7 @@
505
530
 
506
531
 
507
532
  <span class="summary_desc"><div class='inline'>
508
- <p>Returns whether the public key is RSA.</p>
533
+ <p>Public key.</p>
509
534
  </div></span>
510
535
 
511
536
  </li>
@@ -514,7 +539,7 @@
514
539
  <li class="public ">
515
540
  <span class="summary_signature">
516
541
 
517
- <a href="#signature_algorithm-instance_method" title="#signature_algorithm (instance method)">- (String) <strong>signature_algorithm</strong> </a>
542
+ <a href="#rsa%3F-instance_method" title="#rsa? (instance method)">- (Boolean) <strong>rsa?</strong> </a>
518
543
 
519
544
 
520
545
 
@@ -529,7 +554,7 @@
529
554
 
530
555
 
531
556
  <span class="summary_desc"><div class='inline'>
532
- <p>Returns signature algorithm.</p>
557
+ <p>Returns whether the public key is RSA.</p>
533
558
  </div></span>
534
559
 
535
560
  </li>
@@ -538,7 +563,7 @@
538
563
  <li class="public ">
539
564
  <span class="summary_signature">
540
565
 
541
- <a href="#subject_component-instance_method" title="#subject_component (instance method)">- (String) <strong>subject_component</strong>(short_name) </a>
566
+ <a href="#signature_algorithm-instance_method" title="#signature_algorithm (instance method)">- (String) <strong>signature_algorithm</strong> </a>
542
567
 
543
568
 
544
569
 
@@ -553,7 +578,7 @@
553
578
 
554
579
 
555
580
  <span class="summary_desc"><div class='inline'>
556
- <p>Returns subject component.</p>
581
+ <p>Returns signature algorithm.</p>
557
582
  </div></span>
558
583
 
559
584
  </li>
@@ -562,7 +587,7 @@
562
587
  <li class="public ">
563
588
  <span class="summary_signature">
564
589
 
565
- <a href="#to_der-instance_method" title="#to_der (instance method)">- (String) <strong>to_der</strong> </a>
590
+ <a href="#subject_component-instance_method" title="#subject_component (instance method)">- (String) <strong>subject_component</strong>(short_name) </a>
566
591
 
567
592
 
568
593
 
@@ -577,7 +602,7 @@
577
602
 
578
603
 
579
604
  <span class="summary_desc"><div class='inline'>
580
- <p>Converts the CSR into the DER format.</p>
605
+ <p>Returns subject component.</p>
581
606
  </div></span>
582
607
 
583
608
  </li>
@@ -586,7 +611,7 @@
586
611
  <li class="public ">
587
612
  <span class="summary_signature">
588
613
 
589
- <a href="#to_hash-instance_method" title="#to_hash (instance method)">- (Hash) <strong>to_hash</strong> </a>
614
+ <a href="#to_der-instance_method" title="#to_der (instance method)">- (String) <strong>to_der</strong> </a>
590
615
 
591
616
 
592
617
 
@@ -601,7 +626,7 @@
601
626
 
602
627
 
603
628
  <span class="summary_desc"><div class='inline'>
604
- <p>Returns a hash structure you can pass to the Ca.</p>
629
+ <p>Converts the CSR into the DER format.</p>
605
630
  </div></span>
606
631
 
607
632
  </li>
@@ -725,7 +750,7 @@
725
750
  <div class="method_details first">
726
751
  <h3 class="signature first" id="initialize-instance_method">
727
752
 
728
- - (<tt><span class='object_link'><a href="" title="R509::Csr (class)">Csr</a></span></tt>) <strong>initialize</strong>(opts = {})
753
+ - (<tt><span class='object_link'><a href="" title="R509::CSR (class)">CSR</a></span></tt>) <strong>initialize</strong>(opts = {})
729
754
 
730
755
 
731
756
 
@@ -734,7 +759,7 @@
734
759
  </h3><div class="docstring">
735
760
  <div class="discussion">
736
761
 
737
- <p>you can also pass OIDs (see tests)</p>
762
+ <p>A new instance of CSR</p>
738
763
 
739
764
 
740
765
  </div>
@@ -745,11 +770,32 @@
745
770
  <p class="tag_title">Examples:</p>
746
771
 
747
772
 
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>
773
+ <p class="example_title"><div class='inline'>
774
+ <p>Generate a 4096-bit RSA key + CSR</p>
750
775
  </div></p>
751
776
 
752
- <pre class="example code"></pre>
777
+ <pre class="example code"><code>:type =&gt; :rsa,
778
+ :bit_strength =&gt; 4096,
779
+ :subject =&gt; [
780
+ ['CN','somedomain.com'],
781
+ ['O','My Org'],
782
+ ['L','City'],
783
+ ['ST','State'],
784
+ ['C','US']
785
+ ]</code></pre>
786
+
787
+
788
+ <p class="example_title"><div class='inline'>
789
+ <p>Generate an ECDSA key using the secp384r1 curve parameters + CSR and sign
790
+ with SHA512</p>
791
+ </div></p>
792
+
793
+ <pre class="example code"><code>:type =&gt; :ec,
794
+ :curve_name =&gt; 'secp384r1',
795
+ :message_digest =&gt; 'sha512',
796
+ :subject =&gt; [
797
+ ['CN','somedomain.com'],
798
+ ]</code></pre>
753
799
 
754
800
  </div>
755
801
  <p class="tag_title">Parameters:</p>
@@ -802,7 +848,23 @@
802
848
  </span>
803
849
 
804
850
  &mdash; <div class='inline'>
805
- <p>:rsa/:dsa</p>
851
+ <p>:rsa/:dsa/:ec required if not providing existing :csr. Defaults to :rsa</p>
852
+ </div>
853
+
854
+ </li>
855
+
856
+ <li>
857
+ <span class="name">:curve_name</span>
858
+ <span class="type">(<tt>String</tt>)</span>
859
+ <span class="default">
860
+
861
+ &mdash; default:
862
+ <tt>&quot;secp384r1&quot;</tt>
863
+
864
+ </span>
865
+
866
+ &mdash; <div class='inline'>
867
+ <p>Only used if :type is :ec</p>
806
868
  </div>
807
869
 
808
870
  </li>
@@ -812,45 +874,55 @@
812
874
  <span class="type">(<tt>Integer</tt>)</span>
813
875
  <span class="default">
814
876
 
877
+ &mdash; default:
878
+ <tt>2048</tt>
879
+
815
880
  </span>
816
881
 
882
+ &mdash; <div class='inline'>
883
+ <p>Only used if :type is :rsa or :dsa</p>
884
+ </div>
885
+
817
886
  </li>
818
887
 
819
888
  <li>
820
- <span class="name">:san_names</span>
821
- <span class="type">(<tt>Array</tt>)</span>
889
+ <span class="name">:message_digest</span>
890
+ <span class="type">(<tt>String</tt>)</span>
822
891
  <span class="default">
823
892
 
824
893
  </span>
825
894
 
826
895
  &mdash; <div class='inline'>
827
- <p>List of domains to encode as subjectAltNames</p>
896
+ <p>Optional digest. sha1, sha224, sha256, sha384, sha512, md5. Defaults to
897
+ sha1</p>
828
898
  </div>
829
899
 
830
900
  </li>
831
901
 
832
902
  <li>
833
- <span class="name">:subject</span>
834
- <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>
903
+ <span class="name">:san_names</span>
904
+ <span class="type">(<tt>Array</tt>)</span>
835
905
  <span class="default">
836
906
 
837
907
  </span>
838
908
 
839
909
  &mdash; <div class='inline'>
840
- <p>array of subject items</p>
910
+ <p>List of domains, IPs, email addresses, or URIs to encode as
911
+ subjectAltNames. The type is determined from the structure of the strings
912
+ via the R509::ASN1.general_name_parser method</p>
841
913
  </div>
842
914
 
843
915
  </li>
844
916
 
845
917
  <li>
846
- <span class="name">:cert</span>
847
- <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>
918
+ <span class="name">:subject</span>
919
+ <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>
848
920
  <span class="default">
849
921
 
850
922
  </span>
851
923
 
852
924
  &mdash; <div class='inline'>
853
- <p>takes a cert (used for generating a CSR with the certificate's values)</p>
925
+ <p>array of subject items</p>
854
926
  </div>
855
927
 
856
928
  </li>
@@ -880,24 +952,6 @@ support)</p>
880
952
  <pre class="lines">
881
953
 
882
954
 
883
- 21
884
- 22
885
- 23
886
- 24
887
- 25
888
- 26
889
- 27
890
- 28
891
- 29
892
- 30
893
- 31
894
- 32
895
- 33
896
- 34
897
- 35
898
- 36
899
- 37
900
- 38
901
955
  39
902
956
  40
903
957
  41
@@ -941,71 +995,73 @@ support)</p>
941
995
  79
942
996
  80
943
997
  81
944
- 82</pre>
998
+ 82
999
+ 83
1000
+ 84
1001
+ 85
1002
+ 86
1003
+ 87
1004
+ 88
1005
+ 89
1006
+ 90
1007
+ 91
1008
+ 92</pre>
945
1009
  </td>
946
1010
  <td>
947
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 21</span>
1011
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 39</span>
948
1012
 
949
1013
  <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>
950
- <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>
951
- <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>
952
- <span class='kw'>end</span>
953
- <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>
954
- <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>
955
- <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>
956
- <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>
957
- <span class='kw'>end</span>
958
- <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>
959
-
960
- <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>
961
- <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>
962
- <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>
963
- <span class='kw'>else</span>
964
- <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>
965
- <span class='kw'>end</span>
966
- <span class='kw'>end</span>
967
-
968
- <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>
969
- <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>
970
- <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>
971
- <span class='kw'>end</span>
972
-
973
- <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>
974
- <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>
975
- <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>
976
- <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>
977
- <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>
978
- <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
979
- </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>
980
- <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>
981
- <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>
982
- <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
983
- </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>
984
- <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>
985
- <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>
986
- <span class='kw'>end</span>
987
- <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>
988
- <span class='kw'>else</span>
989
- <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>
990
- <span class='kw'>end</span>
991
-
992
- <span class='kw'>if</span> <span class='id identifier rubyid_dsa?'>dsa?</span>
993
- <span class='comment'>#only DSS1 is acceptable for DSA signing in OpenSSL &lt; 1.0
994
- </span> <span class='comment'>#post-1.0 you can sign with anything, but let's be conservative
995
- </span> <span class='comment'>#see: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/PKey/DSA.html
996
- </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>
997
- <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>
998
- <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>
1014
+ <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>
1015
+ <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>
1016
+ <span class='kw'>end</span>
1017
+ <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'>: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>
1018
+ <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 must provide :subject or :csr, not both</span><span class='tstring_end'>&quot;</span></span>
1019
+ <span class='kw'>end</span>
1020
+ <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>
1021
+ <span class='ivar'>@curve_name</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:curve_name</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>secp384r1</span><span class='tstring_end'>&quot;</span></span>
1022
+
1023
+ <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>
1024
+ <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>
1025
+ <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>
999
1026
  <span class='kw'>else</span>
1000
- <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>
1001
- <span class='kw'>end</span>
1002
-
1003
- <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>
1004
- <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>
1027
+ <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>
1005
1028
  <span class='kw'>end</span>
1006
- <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>
1007
- <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>
1029
+ <span class='kw'>end</span>
1030
+
1031
+ <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>
1032
+ <span class='kw'>if</span> <span class='kw'>not</span> <span class='lbracket'>[</span><span class='symbol'>:rsa</span><span class='comma'>,</span><span class='symbol'>:dsa</span><span class='comma'>,</span><span class='symbol'>:ec</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='ivar'>@type</span><span class='rparen'>)</span> <span class='kw'>and</span> <span class='ivar'>@key</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1033
+ <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, :dsa, or :ec as type when key is nil</span><span class='tstring_end'>'</span></span>
1034
+ <span class='kw'>end</span>
1035
+
1036
+ <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'>:subject</span><span class='rparen'>)</span>
1037
+ <span class='id identifier rubyid_san_names'>san_names</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>ASN1</span><span class='period'>.</span><span class='id identifier rubyid_general_name_parser'>general_name_parser</span><span class='lparen'>(</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><span class='rparen'>)</span>
1038
+ <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_san_names'>san_names</span><span class='rparen'>)</span> <span class='comment'>#sets @req
1039
+ </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>
1040
+ <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>
1041
+ <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>
1008
1042
  <span class='kw'>end</span>
1043
+ <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>
1044
+ <span class='kw'>else</span>
1045
+ <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 must provide :subject or :csr</span><span class='tstring_end'>&quot;</span></span>
1046
+ <span class='kw'>end</span>
1047
+
1048
+ <span class='kw'>if</span> <span class='id identifier rubyid_dsa?'>dsa?</span>
1049
+ <span class='comment'>#only DSS1 is acceptable for DSA signing in OpenSSL &lt; 1.0
1050
+ </span> <span class='comment'>#post-1.0 you can sign with anything, but let's be conservative
1051
+ </span> <span class='comment'>#see: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/PKey/DSA.html
1052
+ </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>
1053
+ <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>
1054
+ <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>
1055
+ <span class='kw'>else</span>
1056
+ <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>
1057
+ <span class='kw'>end</span>
1058
+
1059
+ <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>
1060
+ <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>
1061
+ <span class='kw'>end</span>
1062
+ <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>
1063
+ <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>
1064
+ <span class='kw'>end</span>
1009
1065
 
1010
1066
  <span class='kw'>end</span></pre>
1011
1067
  </td>
@@ -1046,12 +1102,12 @@ support)</p>
1046
1102
  <pre class="lines">
1047
1103
 
1048
1104
 
1049
- 11
1050
- 12
1051
- 13</pre>
1105
+ 13
1106
+ 14
1107
+ 15</pre>
1052
1108
  </td>
1053
1109
  <td>
1054
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 11</span>
1110
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 13</span>
1055
1111
 
1056
1112
  <span class='kw'>def</span> <span class='id identifier rubyid_attributes'>attributes</span>
1057
1113
  <span class='ivar'>@attributes</span>
@@ -1089,12 +1145,12 @@ support)</p>
1089
1145
  <pre class="lines">
1090
1146
 
1091
1147
 
1092
- 11
1093
- 12
1094
- 13</pre>
1148
+ 13
1149
+ 14
1150
+ 15</pre>
1095
1151
  </td>
1096
1152
  <td>
1097
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 11</span>
1153
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 13</span>
1098
1154
 
1099
1155
  <span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span>
1100
1156
  <span class='ivar'>@key</span>
@@ -1132,12 +1188,12 @@ support)</p>
1132
1188
  <pre class="lines">
1133
1189
 
1134
1190
 
1135
- 11
1136
- 12
1137
- 13</pre>
1191
+ 13
1192
+ 14
1193
+ 15</pre>
1138
1194
  </td>
1139
1195
  <td>
1140
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 11</span>
1196
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 13</span>
1141
1197
 
1142
1198
  <span class='kw'>def</span> <span class='id identifier rubyid_message_digest'>message_digest</span>
1143
1199
  <span class='ivar'>@message_digest</span>
@@ -1175,12 +1231,12 @@ support)</p>
1175
1231
  <pre class="lines">
1176
1232
 
1177
1233
 
1178
- 11
1179
- 12
1180
- 13</pre>
1234
+ 13
1235
+ 14
1236
+ 15</pre>
1181
1237
  </td>
1182
1238
  <td>
1183
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 11</span>
1239
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 13</span>
1184
1240
 
1185
1241
  <span class='kw'>def</span> <span class='id identifier rubyid_req'>req</span>
1186
1242
  <span class='ivar'>@req</span>
@@ -1193,9 +1249,9 @@ support)</p>
1193
1249
 
1194
1250
  <span id=""></span>
1195
1251
  <div class="method_details ">
1196
- <h3 class="signature " id="san_names-instance_method">
1252
+ <h3 class="signature " id="san-instance_method">
1197
1253
 
1198
- - (<tt>Object</tt>) <strong>san_names</strong> <span class="extras">(readonly)</span>
1254
+ - (<tt>Object</tt>) <strong>san</strong> <span class="extras">(readonly)</span>
1199
1255
 
1200
1256
 
1201
1257
 
@@ -1204,7 +1260,7 @@ support)</p>
1204
1260
  </h3><div class="docstring">
1205
1261
  <div class="discussion">
1206
1262
 
1207
- <p>Returns the value of attribute san_names</p>
1263
+ <p>Returns the value of attribute san</p>
1208
1264
 
1209
1265
 
1210
1266
  </div>
@@ -1218,15 +1274,15 @@ support)</p>
1218
1274
  <pre class="lines">
1219
1275
 
1220
1276
 
1221
- 11
1222
- 12
1223
- 13</pre>
1277
+ 13
1278
+ 14
1279
+ 15</pre>
1224
1280
  </td>
1225
1281
  <td>
1226
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 11</span>
1282
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 13</span>
1227
1283
 
1228
- <span class='kw'>def</span> <span class='id identifier rubyid_san_names'>san_names</span>
1229
- <span class='ivar'>@san_names</span>
1284
+ <span class='kw'>def</span> <span class='id identifier rubyid_san'>san</span>
1285
+ <span class='ivar'>@san</span>
1230
1286
  <span class='kw'>end</span></pre>
1231
1287
  </td>
1232
1288
  </tr>
@@ -1261,12 +1317,12 @@ support)</p>
1261
1317
  <pre class="lines">
1262
1318
 
1263
1319
 
1264
- 11
1265
- 12
1266
- 13</pre>
1320
+ 13
1321
+ 14
1322
+ 15</pre>
1267
1323
  </td>
1268
1324
  <td>
1269
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 11</span>
1325
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 13</span>
1270
1326
 
1271
1327
  <span class='kw'>def</span> <span class='id identifier rubyid_subject'>subject</span>
1272
1328
  <span class='ivar'>@subject</span>
@@ -1286,7 +1342,7 @@ support)</p>
1286
1342
  <div class="method_details first">
1287
1343
  <h3 class="signature first" id="load_from_file-class_method">
1288
1344
 
1289
- + (<tt><span class='object_link'><a href="" title="R509::Csr (class)">R509::Csr</a></span></tt>) <strong>load_from_file</strong>(filename)
1345
+ + (<tt><span class='object_link'><a href="" title="R509::CSR (class)">R509::CSR</a></span></tt>) <strong>load_from_file</strong>(filename)
1290
1346
 
1291
1347
 
1292
1348
 
@@ -1328,13 +1384,13 @@ support)</p>
1328
1384
  <li>
1329
1385
 
1330
1386
 
1331
- <span class='type'>(<tt><span class='object_link'><a href="" title="R509::Csr (class)">R509::Csr</a></span></tt>)</span>
1387
+ <span class='type'>(<tt><span class='object_link'><a href="" title="R509::CSR (class)">R509::CSR</a></span></tt>)</span>
1332
1388
 
1333
1389
 
1334
1390
 
1335
1391
  &mdash;
1336
1392
  <div class='inline'>
1337
- <p>Csr object</p>
1393
+ <p>CSR object</p>
1338
1394
  </div>
1339
1395
 
1340
1396
  </li>
@@ -1347,15 +1403,15 @@ support)</p>
1347
1403
  <pre class="lines">
1348
1404
 
1349
1405
 
1350
- 88
1351
- 89
1352
- 90</pre>
1406
+ 98
1407
+ 99
1408
+ 100</pre>
1353
1409
  </td>
1354
1410
  <td>
1355
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 88</span>
1411
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 98</span>
1356
1412
 
1357
1413
  <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>
1358
- <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>
1414
+ <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>
1359
1415
  <span class='kw'>end</span></pre>
1360
1416
  </td>
1361
1417
  </tr>
@@ -1412,23 +1468,95 @@ support)</p>
1412
1468
  <pre class="lines">
1413
1469
 
1414
1470
 
1415
- 162
1416
- 163
1417
- 164
1418
- 165
1419
- 166
1420
- 167
1421
- 168</pre>
1471
+ 179
1472
+ 180
1473
+ 181
1474
+ 182
1475
+ 183
1476
+ 184
1477
+ 185
1478
+ 186
1479
+ 187</pre>
1422
1480
  </td>
1423
1481
  <td>
1424
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 162</span>
1482
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 179</span>
1425
1483
 
1426
1484
  <span class='kw'>def</span> <span class='id identifier rubyid_bit_strength'>bit_strength</span>
1427
- <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_rsa?'>rsa?</span>
1428
- <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>
1429
- <span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dsa?'>dsa?</span>
1430
- <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>
1431
- <span class='kw'>end</span>
1485
+ <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_rsa?'>rsa?</span>
1486
+ <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>
1487
+ <span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dsa?'>dsa?</span>
1488
+ <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>
1489
+ <span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ec?'>ec?</span>
1490
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>R509Error</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Bit strength is not available for EC at this time.</span><span class='tstring_end'>'</span></span>
1491
+ <span class='kw'>end</span>
1492
+ <span class='kw'>end</span></pre>
1493
+ </td>
1494
+ </tr>
1495
+ </table>
1496
+ </div>
1497
+
1498
+ <div class="method_details ">
1499
+ <h3 class="signature " id="curve_name-instance_method">
1500
+
1501
+ - (<tt>String</tt>) <strong>curve_name</strong>
1502
+
1503
+
1504
+
1505
+
1506
+
1507
+ </h3><div class="docstring">
1508
+ <div class="discussion">
1509
+
1510
+ <p>Returns the short name of the elliptic curve used to generate the public
1511
+ key if the key is EC. If not, raises an error.</p>
1512
+
1513
+
1514
+ </div>
1515
+ </div>
1516
+ <div class="tags">
1517
+
1518
+ <p class="tag_title">Returns:</p>
1519
+ <ul class="return">
1520
+
1521
+ <li>
1522
+
1523
+
1524
+ <span class='type'>(<tt>String</tt>)</span>
1525
+
1526
+
1527
+
1528
+ &mdash;
1529
+ <div class='inline'>
1530
+ <p>elliptic curve name</p>
1531
+ </div>
1532
+
1533
+ </li>
1534
+
1535
+ </ul>
1536
+
1537
+ </div><table class="source_code">
1538
+ <tr>
1539
+ <td>
1540
+ <pre class="lines">
1541
+
1542
+
1543
+ 193
1544
+ 194
1545
+ 195
1546
+ 196
1547
+ 197
1548
+ 198
1549
+ 199</pre>
1550
+ </td>
1551
+ <td>
1552
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 193</span>
1553
+
1554
+ <span class='kw'>def</span> <span class='id identifier rubyid_curve_name'>curve_name</span>
1555
+ <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ec?'>ec?</span>
1556
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='period'>.</span><span class='id identifier rubyid_group'>group</span><span class='period'>.</span><span class='id identifier rubyid_curve_name'>curve_name</span>
1557
+ <span class='kw'>else</span>
1558
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>R509Error</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Curve name is only available with EC CSRs</span><span class='tstring_end'>'</span></span>
1559
+ <span class='kw'>end</span>
1432
1560
  <span class='kw'>end</span></pre>
1433
1561
  </td>
1434
1562
  </tr>
@@ -1479,15 +1607,15 @@ support)</p>
1479
1607
  <pre class="lines">
1480
1608
 
1481
1609
 
1482
- 156
1483
- 157
1484
- 158</pre>
1610
+ 166
1611
+ 167
1612
+ 168</pre>
1485
1613
  </td>
1486
1614
  <td>
1487
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 156</span>
1615
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 166</span>
1488
1616
 
1489
1617
  <span class='kw'>def</span> <span class='id identifier rubyid_dsa?'>dsa?</span>
1490
- <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>
1618
+ <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>
1491
1619
  <span class='kw'>end</span></pre>
1492
1620
  </td>
1493
1621
  </tr>
@@ -1495,9 +1623,9 @@ support)</p>
1495
1623
  </div>
1496
1624
 
1497
1625
  <div class="method_details ">
1498
- <h3 class="signature " id="has_private_key?-instance_method">
1626
+ <h3 class="signature " id="ec?-instance_method">
1499
1627
 
1500
- - (<tt>Boolean</tt>) <strong>has_private_key?</strong>
1628
+ - (<tt>Boolean</tt>) <strong>ec?</strong>
1501
1629
 
1502
1630
 
1503
1631
 
@@ -1506,7 +1634,7 @@ support)</p>
1506
1634
  </h3><div class="docstring">
1507
1635
  <div class="discussion">
1508
1636
 
1509
- <p>Boolean of whether the object contains a private key</p>
1637
+ <p>Returns whether the public key is EC</p>
1510
1638
 
1511
1639
 
1512
1640
  </div>
@@ -1525,7 +1653,7 @@ support)</p>
1525
1653
 
1526
1654
  &mdash;
1527
1655
  <div class='inline'>
1528
- <p>Boolean of whether the object contains a private key</p>
1656
+ <p>true if the public key is EC, false otherwise</p>
1529
1657
  </div>
1530
1658
 
1531
1659
  </li>
@@ -1538,23 +1666,15 @@ support)</p>
1538
1666
  <pre class="lines">
1539
1667
 
1540
1668
 
1541
- 106
1542
- 107
1543
- 108
1544
- 109
1545
- 110
1546
- 111
1547
- 112</pre>
1669
+ 173
1670
+ 174
1671
+ 175</pre>
1548
1672
  </td>
1549
1673
  <td>
1550
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 106</span>
1674
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 173</span>
1551
1675
 
1552
- <span class='kw'>def</span> <span class='id identifier rubyid_has_private_key?'>has_private_key?</span>
1553
- <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>
1554
- <span class='kw'>true</span>
1555
- <span class='kw'>else</span>
1556
- <span class='kw'>false</span>
1557
- <span class='kw'>end</span>
1676
+ <span class='kw'>def</span> <span class='id identifier rubyid_ec?'>ec?</span>
1677
+ <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'>EC</span><span class='rparen'>)</span>
1558
1678
  <span class='kw'>end</span></pre>
1559
1679
  </td>
1560
1680
  </tr>
@@ -1562,9 +1682,9 @@ support)</p>
1562
1682
  </div>
1563
1683
 
1564
1684
  <div class="method_details ">
1565
- <h3 class="signature " id="key_algorithm-instance_method">
1685
+ <h3 class="signature " id="has_private_key?-instance_method">
1566
1686
 
1567
- - (<tt>String</tt>) <strong>key_algorithm</strong>
1687
+ - (<tt>Boolean</tt>) <strong>has_private_key?</strong>
1568
1688
 
1569
1689
 
1570
1690
 
@@ -1573,7 +1693,7 @@ support)</p>
1573
1693
  </h3><div class="docstring">
1574
1694
  <div class="discussion">
1575
1695
 
1576
- <p>Returns key algorithm (RSA/DSA)</p>
1696
+ <p>Boolean of whether the object contains a private key</p>
1577
1697
 
1578
1698
 
1579
1699
  </div>
@@ -1586,13 +1706,13 @@ support)</p>
1586
1706
  <li>
1587
1707
 
1588
1708
 
1589
- <span class='type'>(<tt>String</tt>)</span>
1709
+ <span class='type'>(<tt>Boolean</tt>)</span>
1590
1710
 
1591
1711
 
1592
1712
 
1593
1713
  &mdash;
1594
1714
  <div class='inline'>
1595
- <p>value of the key algorithm. RSA or DSA</p>
1715
+ <p>Boolean of whether the object contains a private key</p>
1596
1716
  </div>
1597
1717
 
1598
1718
  </li>
@@ -1605,23 +1725,23 @@ support)</p>
1605
1725
  <pre class="lines">
1606
1726
 
1607
1727
 
1608
- 192
1609
- 193
1610
- 194
1611
- 195
1612
- 196
1613
- 197
1614
- 198</pre>
1728
+ 116
1729
+ 117
1730
+ 118
1731
+ 119
1732
+ 120
1733
+ 121
1734
+ 122</pre>
1615
1735
  </td>
1616
1736
  <td>
1617
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 192</span>
1737
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 116</span>
1618
1738
 
1619
- <span class='kw'>def</span> <span class='id identifier rubyid_key_algorithm'>key_algorithm</span>
1620
- <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>
1621
- <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>RSA</span><span class='tstring_end'>'</span></span>
1622
- <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>
1623
- <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>DSA</span><span class='tstring_end'>'</span></span>
1624
- <span class='kw'>end</span>
1739
+ <span class='kw'>def</span> <span class='id identifier rubyid_has_private_key?'>has_private_key?</span>
1740
+ <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>
1741
+ <span class='kw'>true</span>
1742
+ <span class='kw'>else</span>
1743
+ <span class='kw'>false</span>
1744
+ <span class='kw'>end</span>
1625
1745
  <span class='kw'>end</span></pre>
1626
1746
  </td>
1627
1747
  </tr>
@@ -1629,9 +1749,9 @@ support)</p>
1629
1749
  </div>
1630
1750
 
1631
1751
  <div class="method_details ">
1632
- <h3 class="signature " id="public_key-instance_method">
1752
+ <h3 class="signature " id="key_algorithm-instance_method">
1633
1753
 
1634
- - (<tt>OpenSSL::PKey::RSA</tt>) <strong>public_key</strong>
1754
+ - (<tt>Symbol</tt>) <strong>key_algorithm</strong>
1635
1755
 
1636
1756
 
1637
1757
 
@@ -1640,7 +1760,7 @@ support)</p>
1640
1760
  </h3><div class="docstring">
1641
1761
  <div class="discussion">
1642
1762
 
1643
- <p>Public key</p>
1763
+ <p>Returns key algorithm (RSA/DSA/EC)</p>
1644
1764
 
1645
1765
 
1646
1766
  </div>
@@ -1653,13 +1773,13 @@ support)</p>
1653
1773
  <li>
1654
1774
 
1655
1775
 
1656
- <span class='type'>(<tt>OpenSSL::PKey::RSA</tt>)</span>
1776
+ <span class='type'>(<tt>Symbol</tt>)</span>
1657
1777
 
1658
1778
 
1659
1779
 
1660
1780
  &mdash;
1661
1781
  <div class='inline'>
1662
- <p>public key</p>
1782
+ <p>value of the key algorithm. :rsa, :dsa, :ec</p>
1663
1783
  </div>
1664
1784
 
1665
1785
  </li>
@@ -1672,19 +1792,27 @@ support)</p>
1672
1792
  <pre class="lines">
1673
1793
 
1674
1794
 
1675
- 93
1676
- 94
1677
- 95
1678
- 96
1679
- 97</pre>
1795
+ 223
1796
+ 224
1797
+ 225
1798
+ 226
1799
+ 227
1800
+ 228
1801
+ 229
1802
+ 230
1803
+ 231</pre>
1680
1804
  </td>
1681
1805
  <td>
1682
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 93</span>
1806
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 223</span>
1683
1807
 
1684
- <span class='kw'>def</span> <span class='id identifier rubyid_public_key'>public_key</span>
1685
- <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>
1686
- <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span>
1687
- <span class='kw'>end</span>
1808
+ <span class='kw'>def</span> <span class='id identifier rubyid_key_algorithm'>key_algorithm</span>
1809
+ <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>
1810
+ <span class='symbol'>:rsa</span>
1811
+ <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>
1812
+ <span class='symbol'>:dsa</span>
1813
+ <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'>EC</span> <span class='kw'>then</span>
1814
+ <span class='symbol'>:ec</span>
1815
+ <span class='kw'>end</span>
1688
1816
  <span class='kw'>end</span></pre>
1689
1817
  </td>
1690
1818
  </tr>
@@ -1692,9 +1820,9 @@ support)</p>
1692
1820
  </div>
1693
1821
 
1694
1822
  <div class="method_details ">
1695
- <h3 class="signature " id="rsa?-instance_method">
1823
+ <h3 class="signature " id="public_key-instance_method">
1696
1824
 
1697
- - (<tt>Boolean</tt>) <strong>rsa?</strong>
1825
+ - (<tt>OpenSSL::PKey::RSA</tt>, ...) <strong>public_key</strong>
1698
1826
 
1699
1827
 
1700
1828
 
@@ -1703,7 +1831,7 @@ support)</p>
1703
1831
  </h3><div class="docstring">
1704
1832
  <div class="discussion">
1705
1833
 
1706
- <p>Returns whether the public key is RSA</p>
1834
+ <p>Public key</p>
1707
1835
 
1708
1836
 
1709
1837
  </div>
@@ -1716,13 +1844,13 @@ support)</p>
1716
1844
  <li>
1717
1845
 
1718
1846
 
1719
- <span class='type'>(<tt>Boolean</tt>)</span>
1847
+ <span class='type'>(<tt>OpenSSL::PKey::RSA</tt>, <tt>OpenSSL::PKey::DSA</tt>, <tt><span class='object_link'>OpenSSL::PKey::EC</span></tt>)</span>
1720
1848
 
1721
1849
 
1722
1850
 
1723
1851
  &mdash;
1724
1852
  <div class='inline'>
1725
- <p>true if the public key is RSA, false otherwise</p>
1853
+ <p>public key</p>
1726
1854
  </div>
1727
1855
 
1728
1856
  </li>
@@ -1735,15 +1863,19 @@ support)</p>
1735
1863
  <pre class="lines">
1736
1864
 
1737
1865
 
1738
- 149
1739
- 150
1740
- 151</pre>
1866
+ 103
1867
+ 104
1868
+ 105
1869
+ 106
1870
+ 107</pre>
1741
1871
  </td>
1742
1872
  <td>
1743
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 149</span>
1873
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 103</span>
1744
1874
 
1745
- <span class='kw'>def</span> <span class='id identifier rubyid_rsa?'>rsa?</span>
1746
- <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>
1875
+ <span class='kw'>def</span> <span class='id identifier rubyid_public_key'>public_key</span>
1876
+ <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>
1877
+ <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span>
1878
+ <span class='kw'>end</span>
1747
1879
  <span class='kw'>end</span></pre>
1748
1880
  </td>
1749
1881
  </tr>
@@ -1751,9 +1883,9 @@ support)</p>
1751
1883
  </div>
1752
1884
 
1753
1885
  <div class="method_details ">
1754
- <h3 class="signature " id="signature_algorithm-instance_method">
1886
+ <h3 class="signature " id="rsa?-instance_method">
1755
1887
 
1756
- - (<tt>String</tt>) <strong>signature_algorithm</strong>
1888
+ - (<tt>Boolean</tt>) <strong>rsa?</strong>
1757
1889
 
1758
1890
 
1759
1891
 
@@ -1762,7 +1894,7 @@ support)</p>
1762
1894
  </h3><div class="docstring">
1763
1895
  <div class="discussion">
1764
1896
 
1765
- <p>Returns signature algorithm</p>
1897
+ <p>Returns whether the public key is RSA</p>
1766
1898
 
1767
1899
 
1768
1900
  </div>
@@ -1775,14 +1907,13 @@ support)</p>
1775
1907
  <li>
1776
1908
 
1777
1909
 
1778
- <span class='type'>(<tt>String</tt>)</span>
1910
+ <span class='type'>(<tt>Boolean</tt>)</span>
1779
1911
 
1780
1912
 
1781
1913
 
1782
1914
  &mdash;
1783
1915
  <div class='inline'>
1784
- <p>value of the signature algorithm. E.g. sha1WithRSAEncryption,
1785
- sha256WithRSAEncryption, md5WithRSAEncryption</p>
1916
+ <p>true if the public key is RSA, false otherwise</p>
1786
1917
  </div>
1787
1918
 
1788
1919
  </li>
@@ -1795,15 +1926,15 @@ sha256WithRSAEncryption, md5WithRSAEncryption</p>
1795
1926
  <pre class="lines">
1796
1927
 
1797
1928
 
1798
- 185
1799
- 186
1800
- 187</pre>
1929
+ 159
1930
+ 160
1931
+ 161</pre>
1801
1932
  </td>
1802
1933
  <td>
1803
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 185</span>
1934
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 159</span>
1804
1935
 
1805
- <span class='kw'>def</span> <span class='id identifier rubyid_signature_algorithm'>signature_algorithm</span>
1806
- <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_signature_algorithm'>signature_algorithm</span>
1936
+ <span class='kw'>def</span> <span class='id identifier rubyid_rsa?'>rsa?</span>
1937
+ <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>
1807
1938
  <span class='kw'>end</span></pre>
1808
1939
  </td>
1809
1940
  </tr>
@@ -1811,9 +1942,9 @@ sha256WithRSAEncryption, md5WithRSAEncryption</p>
1811
1942
  </div>
1812
1943
 
1813
1944
  <div class="method_details ">
1814
- <h3 class="signature " id="subject_component-instance_method">
1945
+ <h3 class="signature " id="signature_algorithm-instance_method">
1815
1946
 
1816
- - (<tt>String</tt>) <strong>subject_component</strong>(short_name)
1947
+ - (<tt>String</tt>) <strong>signature_algorithm</strong>
1817
1948
 
1818
1949
 
1819
1950
 
@@ -1822,7 +1953,7 @@ sha256WithRSAEncryption, md5WithRSAEncryption</p>
1822
1953
  </h3><div class="docstring">
1823
1954
  <div class="discussion">
1824
1955
 
1825
- <p>Returns subject component</p>
1956
+ <p>Returns signature algorithm</p>
1826
1957
 
1827
1958
 
1828
1959
  </div>
@@ -1841,7 +1972,8 @@ sha256WithRSAEncryption, md5WithRSAEncryption</p>
1841
1972
 
1842
1973
  &mdash;
1843
1974
  <div class='inline'>
1844
- <p>value of the subject component requested</p>
1975
+ <p>value of the signature algorithm. E.g. sha1WithRSAEncryption,
1976
+ sha256WithRSAEncryption, md5WithRSAEncryption</p>
1845
1977
  </div>
1846
1978
 
1847
1979
  </li>
@@ -1854,25 +1986,15 @@ sha256WithRSAEncryption, md5WithRSAEncryption</p>
1854
1986
  <pre class="lines">
1855
1987
 
1856
1988
 
1857
- 173
1858
- 174
1859
- 175
1860
- 176
1861
- 177
1862
- 178
1863
- 179
1864
- 180</pre>
1989
+ 216
1990
+ 217
1991
+ 218</pre>
1865
1992
  </td>
1866
1993
  <td>
1867
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 173</span>
1994
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 216</span>
1868
1995
 
1869
- <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>
1870
- <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>
1871
- <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>
1872
- <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>
1873
- <span class='kw'>end</span>
1874
- <span class='kw'>end</span>
1875
- <span class='kw'>nil</span>
1996
+ <span class='kw'>def</span> <span class='id identifier rubyid_signature_algorithm'>signature_algorithm</span>
1997
+ <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_signature_algorithm'>signature_algorithm</span>
1876
1998
  <span class='kw'>end</span></pre>
1877
1999
  </td>
1878
2000
  </tr>
@@ -1880,9 +2002,9 @@ sha256WithRSAEncryption, md5WithRSAEncryption</p>
1880
2002
  </div>
1881
2003
 
1882
2004
  <div class="method_details ">
1883
- <h3 class="signature " id="to_der-instance_method">
2005
+ <h3 class="signature " id="subject_component-instance_method">
1884
2006
 
1885
- - (<tt>String</tt>) <strong>to_der</strong>
2007
+ - (<tt>String</tt>) <strong>subject_component</strong>(short_name)
1886
2008
 
1887
2009
 
1888
2010
 
@@ -1891,7 +2013,7 @@ sha256WithRSAEncryption, md5WithRSAEncryption</p>
1891
2013
  </h3><div class="docstring">
1892
2014
  <div class="discussion">
1893
2015
 
1894
- <p>Converts the CSR into the DER format</p>
2016
+ <p>Returns subject component</p>
1895
2017
 
1896
2018
 
1897
2019
  </div>
@@ -1910,7 +2032,7 @@ sha256WithRSAEncryption, md5WithRSAEncryption</p>
1910
2032
 
1911
2033
  &mdash;
1912
2034
  <div class='inline'>
1913
- <p>the CSR converted into DER format.</p>
2035
+ <p>value of the subject component requested</p>
1914
2036
  </div>
1915
2037
 
1916
2038
  </li>
@@ -1923,15 +2045,25 @@ sha256WithRSAEncryption, md5WithRSAEncryption</p>
1923
2045
  <pre class="lines">
1924
2046
 
1925
2047
 
1926
- 126
1927
- 127
1928
- 128</pre>
2048
+ 204
2049
+ 205
2050
+ 206
2051
+ 207
2052
+ 208
2053
+ 209
2054
+ 210
2055
+ 211</pre>
1929
2056
  </td>
1930
2057
  <td>
1931
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 126</span>
2058
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 204</span>
1932
2059
 
1933
- <span class='kw'>def</span> <span class='id identifier rubyid_to_der'>to_der</span>
1934
- <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_to_der'>to_der</span>
2060
+ <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>
2061
+ <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>
2062
+ <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>
2063
+ <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>
2064
+ <span class='kw'>end</span>
2065
+ <span class='kw'>end</span>
2066
+ <span class='kw'>nil</span>
1935
2067
  <span class='kw'>end</span></pre>
1936
2068
  </td>
1937
2069
  </tr>
@@ -1939,9 +2071,9 @@ sha256WithRSAEncryption, md5WithRSAEncryption</p>
1939
2071
  </div>
1940
2072
 
1941
2073
  <div class="method_details ">
1942
- <h3 class="signature " id="to_hash-instance_method">
2074
+ <h3 class="signature " id="to_der-instance_method">
1943
2075
 
1944
- - (<tt>Hash</tt>) <strong>to_hash</strong>
2076
+ - (<tt>String</tt>) <strong>to_der</strong>
1945
2077
 
1946
2078
 
1947
2079
 
@@ -1950,9 +2082,7 @@ sha256WithRSAEncryption, md5WithRSAEncryption</p>
1950
2082
  </h3><div class="docstring">
1951
2083
  <div class="discussion">
1952
2084
 
1953
- <p>Returns a hash structure you can pass to the Ca. You will want to call this
1954
- method if you intend to alter the values and then pass them to the Ca
1955
- class.</p>
2085
+ <p>Converts the CSR into the DER format</p>
1956
2086
 
1957
2087
 
1958
2088
  </div>
@@ -1965,13 +2095,13 @@ class.</p>
1965
2095
  <li>
1966
2096
 
1967
2097
 
1968
- <span class='type'>(<tt>Hash</tt>)</span>
2098
+ <span class='type'>(<tt>String</tt>)</span>
1969
2099
 
1970
2100
 
1971
2101
 
1972
2102
  &mdash;
1973
2103
  <div class='inline'>
1974
- <p>:subject and :san_names you can pass to Ca</p>
2104
+ <p>the CSR converted into DER format.</p>
1975
2105
  </div>
1976
2106
 
1977
2107
  </li>
@@ -1984,15 +2114,15 @@ class.</p>
1984
2114
  <pre class="lines">
1985
2115
 
1986
2116
 
1987
- 205
1988
- 206
1989
- 207</pre>
2117
+ 136
2118
+ 137
2119
+ 138</pre>
1990
2120
  </td>
1991
2121
  <td>
1992
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 205</span>
2122
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 136</span>
1993
2123
 
1994
- <span class='kw'>def</span> <span class='id identifier rubyid_to_hash'>to_hash</span>
1995
- <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>
2124
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_der'>to_der</span>
2125
+ <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_to_der'>to_der</span>
1996
2126
  <span class='kw'>end</span></pre>
1997
2127
  </td>
1998
2128
  </tr>
@@ -2047,15 +2177,15 @@ class.</p>
2047
2177
  <pre class="lines">
2048
2178
 
2049
2179
 
2050
- 117
2051
- 118
2052
- 119</pre>
2180
+ 127
2181
+ 128
2182
+ 129</pre>
2053
2183
  </td>
2054
2184
  <td>
2055
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 117</span>
2185
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 127</span>
2056
2186
 
2057
2187
  <span class='kw'>def</span> <span class='id identifier rubyid_to_pem'>to_pem</span>
2058
- <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_to_pem'>to_pem</span>
2188
+ <span class='ivar'>@req</span><span class='period'>.</span><span class='id identifier rubyid_to_pem'>to_pem</span>
2059
2189
  <span class='kw'>end</span></pre>
2060
2190
  </td>
2061
2191
  </tr>
@@ -2101,15 +2231,15 @@ class.</p>
2101
2231
  <pre class="lines">
2102
2232
 
2103
2233
 
2104
- 101
2105
- 102
2106
- 103</pre>
2234
+ 111
2235
+ 112
2236
+ 113</pre>
2107
2237
  </td>
2108
2238
  <td>
2109
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 101</span>
2239
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 111</span>
2110
2240
 
2111
2241
  <span class='kw'>def</span> <span class='id identifier rubyid_verify_signature'>verify_signature</span>
2112
- <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>
2242
+ <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>
2113
2243
  <span class='kw'>end</span></pre>
2114
2244
  </td>
2115
2245
  </tr>
@@ -2163,15 +2293,15 @@ IO-like object.</p>
2163
2293
  <pre class="lines">
2164
2294
 
2165
2295
 
2166
- 142
2167
- 143
2168
- 144</pre>
2296
+ 152
2297
+ 153
2298
+ 154</pre>
2169
2299
  </td>
2170
2300
  <td>
2171
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 142</span>
2301
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 152</span>
2172
2302
 
2173
2303
  <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>
2174
- <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>
2304
+ <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>
2175
2305
  <span class='kw'>end</span></pre>
2176
2306
  </td>
2177
2307
  </tr>
@@ -2225,15 +2355,15 @@ IO-like object.</p>
2225
2355
  <pre class="lines">
2226
2356
 
2227
2357
 
2228
- 134
2229
- 135
2230
- 136</pre>
2358
+ 144
2359
+ 145
2360
+ 146</pre>
2231
2361
  </td>
2232
2362
  <td>
2233
- <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 134</span>
2363
+ <pre class="code"><span class="info file"># File 'lib/r509/csr.rb', line 144</span>
2234
2364
 
2235
2365
  <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>
2236
- <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>
2366
+ <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>
2237
2367
  <span class='kw'>end</span></pre>
2238
2368
  </td>
2239
2369
  </tr>
@@ -2245,9 +2375,9 @@ IO-like object.</p>
2245
2375
  </div>
2246
2376
 
2247
2377
  <div id="footer">
2248
- Generated on Thu Nov 8 14:19:25 2012 by
2378
+ Generated on Tue Apr 16 10:49:55 2013 by
2249
2379
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2250
- 0.8.2.1 (ruby-1.9.3).
2380
+ 0.8.5 (ruby-1.9.3).
2251
2381
  </div>
2252
2382
 
2253
2383
  </body>