r509 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -0
- data/CONTRIBUTING.mdown +21 -0
- data/LICENSE +13 -0
- data/README.mdown +548 -0
- data/Rakefile +5 -0
- data/bin/r509 +16 -17
- data/doc/R509.html +42 -26
- data/doc/R509/ASN1.html +22 -16
- data/doc/R509/ASN1/GeneralName.html +180 -173
- data/doc/R509/ASN1/GeneralNames.html +390 -62
- data/doc/R509/CRL.html +9 -7
- data/doc/R509/CRL/Administrator.html +208 -623
- data/doc/R509/CRL/FileReaderWriter.html +856 -0
- data/doc/R509/CRL/ReaderWriter.html +524 -0
- data/doc/R509/CRL/SignedList.html +29 -42
- data/doc/R509/CSR.html +248 -333
- data/doc/R509/Cert.html +364 -491
- data/doc/R509/Cert/Extensions.html +134 -43
- data/doc/R509/Cert/Extensions/AuthorityInfoAccess.html +335 -65
- data/doc/R509/Cert/Extensions/AuthorityKeyIdentifier.html +201 -102
- data/doc/R509/Cert/Extensions/BasicConstraints.html +297 -68
- data/doc/R509/Cert/Extensions/CRLDistributionPoints.html +690 -77
- data/doc/R509/Cert/Extensions/CertificatePolicies.html +293 -43
- data/doc/R509/Cert/Extensions/ExtendedKeyUsage.html +321 -173
- data/doc/R509/Cert/Extensions/GeneralNamesMixin.html +656 -0
- data/doc/R509/Cert/Extensions/InhibitAnyPolicy.html +270 -42
- data/doc/R509/Cert/Extensions/KeyUsage.html +334 -184
- data/doc/R509/Cert/Extensions/NameConstraints.html +363 -93
- data/doc/R509/{ASN1 → Cert/Extensions}/NoticeReference.html +209 -48
- data/doc/R509/Cert/Extensions/OCSPNoCheck.html +244 -17
- data/doc/R509/Cert/Extensions/PolicyConstraints.html +322 -71
- data/doc/R509/{ASN1 → Cert/Extensions}/PolicyInformation.html +204 -43
- data/doc/R509/{ASN1 → Cert/Extensions}/PolicyQualifiers.html +205 -48
- data/doc/R509/Cert/Extensions/SubjectAlternativeName.html +348 -143
- data/doc/R509/Cert/Extensions/SubjectKeyIdentifier.html +165 -13
- data/doc/R509/{ASN1 → Cert/Extensions}/UserNotice.html +204 -43
- data/doc/R509/Cert/Extensions/ValidationMixin.html +120 -0
- data/doc/R509/CertificateAuthority.html +9 -7
- data/doc/R509/CertificateAuthority/OptionsBuilder.html +475 -0
- data/doc/R509/CertificateAuthority/Signer.html +149 -198
- data/doc/R509/Config.html +10 -8
- data/doc/R509/Config/CAConfig.html +708 -625
- data/doc/R509/Config/CAConfigPool.html +179 -31
- data/doc/R509/Config/CertProfile.html +1544 -0
- data/doc/R509/Config/SubjectItemPolicy.html +437 -99
- data/doc/R509/Engine.html +14 -28
- data/doc/R509/Helpers.html +1014 -0
- data/doc/R509/MessageDigest.html +73 -25
- data/doc/R509/NameSanitizer.html +39 -39
- data/doc/R509/OCSP.html +5 -5
- data/doc/R509/OCSP/Request.html +5 -5
- data/doc/R509/OCSP/Request/Nonce.html +5 -5
- data/doc/R509/OCSP/Response.html +7 -7
- data/doc/R509/OIDMapper.html +121 -6
- data/doc/R509/PrivateKey.html +226 -227
- data/doc/R509/R509Error.html +5 -5
- data/doc/R509/SPKI.html +244 -342
- data/doc/R509/Subject.html +241 -70
- data/doc/R509/Validity.html +5 -5
- data/doc/R509/Validity/Checker.html +5 -5
- data/doc/R509/Validity/DefaultChecker.html +5 -9
- data/doc/R509/Validity/DefaultWriter.html +5 -9
- data/doc/R509/Validity/Status.html +5 -5
- data/doc/R509/Validity/Writer.html +5 -5
- data/doc/_index.html +92 -30
- data/doc/class_list.html +2 -2
- data/doc/file.CONTRIBUTING.html +96 -0
- data/doc/file.LICENSE.html +87 -0
- data/doc/file.README.html +279 -389
- data/doc/file.YAML.html +243 -0
- data/doc/file.r509.html +298 -105
- data/doc/file_list.html +11 -2
- data/doc/frames.html +1 -1
- data/doc/index.html +279 -389
- data/doc/js/full_list.js +6 -1
- data/doc/method_list.html +869 -1139
- data/doc/top-level-namespace.html +103 -5
- data/lib/r509.rb +7 -2
- data/lib/r509/asn1.rb +97 -135
- data/lib/r509/cert.rb +17 -106
- data/lib/r509/cert/extensions.rb +13 -676
- data/lib/r509/cert/extensions/authority_info_access.rb +128 -0
- data/lib/r509/cert/extensions/authority_key_identifier.rb +100 -0
- data/lib/r509/cert/extensions/base.rb +142 -0
- data/lib/r509/cert/extensions/basic_constraints.rb +119 -0
- data/lib/r509/cert/extensions/certificate_policies.rb +262 -0
- data/lib/r509/cert/extensions/crl_distribution_points.rb +98 -0
- data/lib/r509/cert/extensions/extended_key_usage.rb +189 -0
- data/lib/r509/cert/extensions/inhibit_any_policy.rb +70 -0
- data/lib/r509/cert/extensions/key_usage.rb +209 -0
- data/lib/r509/cert/extensions/name_constraints.rb +179 -0
- data/lib/r509/cert/extensions/ocsp_no_check.rb +56 -0
- data/lib/r509/cert/extensions/policy_constraints.rb +122 -0
- data/lib/r509/cert/extensions/subject_alternative_name.rb +88 -0
- data/lib/r509/cert/extensions/subject_key_identifier.rb +56 -0
- data/lib/r509/cert/extensions/validation_mixin.rb +42 -0
- data/lib/r509/certificate_authority/options_builder.rb +142 -0
- data/lib/r509/certificate_authority/signer.rb +189 -0
- data/lib/r509/config.rb +3 -600
- data/lib/r509/config/ca_config.rb +414 -0
- data/lib/r509/config/cert_profile.rb +110 -0
- data/lib/r509/config/subject_item_policy.rb +118 -0
- data/lib/r509/crl/administrator.rb +169 -0
- data/lib/r509/crl/reader_writer.rb +109 -0
- data/lib/r509/crl/signed_list.rb +135 -0
- data/lib/r509/csr.rb +35 -116
- data/lib/r509/engine.rb +21 -11
- data/lib/r509/helpers.rb +110 -0
- data/lib/r509/io_helpers.rb +18 -13
- data/lib/r509/message_digest.rb +13 -3
- data/lib/r509/oid_mapper.rb +14 -0
- data/lib/r509/private_key.rb +74 -50
- data/lib/r509/spki.rb +50 -113
- data/lib/r509/subject.rb +24 -2
- data/lib/r509/trollop.rb +788 -0
- data/lib/r509/version.rb +1 -1
- data/r509.yaml +289 -96
- data/spec/asn1_spec.rb +171 -98
- data/spec/cert/extensions/authority_info_access_spec.rb +247 -0
- data/spec/cert/extensions/authority_key_identifier_spec.rb +85 -0
- data/spec/cert/extensions/base_spec.rb +172 -0
- data/spec/cert/extensions/basic_constraints_spec.rb +185 -0
- data/spec/cert/extensions/certificate_policies_spec.rb +288 -0
- data/spec/cert/extensions/crl_distribution_points_spec.rb +149 -0
- data/spec/cert/extensions/extended_key_usage_spec.rb +174 -0
- data/spec/cert/extensions/inhibit_any_policy_spec.rb +92 -0
- data/spec/cert/extensions/key_usage_spec.rb +172 -0
- data/spec/cert/extensions/name_constraints_spec.rb +335 -0
- data/spec/cert/extensions/ocsp_no_check_spec.rb +76 -0
- data/spec/cert/extensions/policy_constraints_spec.rb +155 -0
- data/spec/cert/extensions/subject_alternative_name_spec.rb +354 -0
- data/spec/cert/extensions/subject_key_identifier_spec.rb +64 -0
- data/spec/cert_spec.rb +11 -9
- data/spec/certificate_authority/options_builder_spec.rb +307 -0
- data/spec/certificate_authority/signer_spec.rb +278 -0
- data/spec/config/ca_config_spec.rb +405 -0
- data/spec/config/cert_profile_spec.rb +88 -0
- data/spec/config/subject_item_policy_spec.rb +81 -0
- data/spec/crl/administrator_spec.rb +199 -0
- data/spec/crl/reader_writer_spec.rb +97 -0
- data/spec/crl/signed_list_spec.rb +84 -0
- data/spec/csr_spec.rb +43 -36
- data/spec/engine_spec.rb +51 -0
- data/spec/fixtures.rb +40 -40
- data/spec/fixtures/cert1.pem +1 -1
- data/spec/fixtures/config_pool_test_minimal.yaml +11 -15
- data/spec/fixtures/config_test.yaml +96 -59
- data/spec/fixtures/config_test_dsa.yaml +29 -35
- data/spec/fixtures/config_test_ec.yaml +29 -35
- data/spec/fixtures/config_test_engine_key.yaml +7 -7
- data/spec/fixtures/config_test_engine_no_key_name.yaml +6 -6
- data/spec/fixtures/config_test_minimal.yaml +3 -5
- data/spec/fixtures/config_test_password.yaml +4 -6
- data/spec/fixtures/config_test_various.yaml +147 -137
- data/spec/fixtures/crl_list_file.txt +1 -1
- data/spec/fixtures/test_ca_crl.cer +20 -0
- data/spec/fixtures/test_ca_crl.key +28 -0
- data/spec/fixtures/test_ca_crl.p12 +0 -0
- data/spec/message_digest_spec.rb +6 -0
- data/spec/oid_mapper_spec.rb +11 -0
- data/spec/private_key_spec.rb +19 -18
- data/spec/spec_helper.rb +10 -6
- data/spec/spki_spec.rb +38 -19
- data/spec/subject_spec.rb +16 -0
- metadata +108 -59
- metadata.gz.sig +0 -0
- data/README.md +0 -638
- data/doc/R509/Config/CAProfile.html +0 -1015
- data/doc/R509/IOHelpers.html +0 -564
- data/lib/r509/certificate_authority.rb +0 -407
- data/lib/r509/crl.rb +0 -351
- data/spec/cert/extensions_spec.rb +0 -1095
- data/spec/certificate_authority_spec.rb +0 -681
- data/spec/config_spec.rb +0 -562
- data/spec/crl_spec.rb +0 -226
data/doc/R509/OIDMapper.html
CHANGED
@@ -6,13 +6,13 @@
|
|
6
6
|
<title>
|
7
7
|
Module: R509::OIDMapper
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.6.1
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css"
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
14
|
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css"
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
@@ -155,6 +155,30 @@
|
|
155
155
|
<p>Register an OID so we have a friendly short name.</p>
|
156
156
|
</div></span>
|
157
157
|
|
158
|
+
</li>
|
159
|
+
|
160
|
+
|
161
|
+
<li class="public ">
|
162
|
+
<span class="summary_signature">
|
163
|
+
|
164
|
+
<a href="#register_from_yaml-class_method" title="register_from_yaml (class method)">+ (Object) <strong>register_from_yaml</strong>(name, yaml_data) </a>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
</span>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<span class="summary_desc"><div class='inline'>
|
179
|
+
<p>Load YAML and register OIDs.</p>
|
180
|
+
</div></span>
|
181
|
+
|
158
182
|
</li>
|
159
183
|
|
160
184
|
|
@@ -276,7 +300,7 @@
|
|
276
300
|
|
277
301
|
—
|
278
302
|
<div class='inline'>
|
279
|
-
<p>A string representation of the OID you want to map (e.g.
|
303
|
+
<p>A string representation of the OID you want to map (e.g. “1.6.2.3.55”)</p>
|
280
304
|
</div>
|
281
305
|
|
282
306
|
</li>
|
@@ -361,6 +385,97 @@
|
|
361
385
|
</td>
|
362
386
|
</tr>
|
363
387
|
</table>
|
388
|
+
</div>
|
389
|
+
|
390
|
+
<div class="method_details ">
|
391
|
+
<h3 class="signature " id="register_from_yaml-class_method">
|
392
|
+
|
393
|
+
+ (<tt>Object</tt>) <strong>register_from_yaml</strong>(name, yaml_data)
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
</h3><div class="docstring">
|
400
|
+
<div class="discussion">
|
401
|
+
|
402
|
+
<p>Load YAML and register OIDs</p>
|
403
|
+
|
404
|
+
|
405
|
+
</div>
|
406
|
+
</div>
|
407
|
+
<div class="tags">
|
408
|
+
|
409
|
+
<div class="examples">
|
410
|
+
<p class="tag_title">Examples:</p>
|
411
|
+
|
412
|
+
|
413
|
+
<pre class="example code"><code>custom_oids:
|
414
|
+
- :oid: 1.4.3.2.1.2.3.4.4.4.5
|
415
|
+
:short_name: testOIDName
|
416
|
+
- :oid: 1.4.3.2.1.2.5.4.4.4.5
|
417
|
+
:short_name: anotherOIDName</code></pre>
|
418
|
+
|
419
|
+
</div>
|
420
|
+
<p class="tag_title">Parameters:</p>
|
421
|
+
<ul class="param">
|
422
|
+
|
423
|
+
<li>
|
424
|
+
|
425
|
+
<span class='name'>name</span>
|
426
|
+
|
427
|
+
|
428
|
+
<span class='type'>(<tt>String</tt>)</span>
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
—
|
433
|
+
<div class='inline'>
|
434
|
+
<p>Name of the config within the file</p>
|
435
|
+
</div>
|
436
|
+
|
437
|
+
</li>
|
438
|
+
|
439
|
+
<li>
|
440
|
+
|
441
|
+
<span class='name'>yaml_data</span>
|
442
|
+
|
443
|
+
|
444
|
+
<span class='type'>(<tt>String</tt>)</span>
|
445
|
+
|
446
|
+
|
447
|
+
|
448
|
+
—
|
449
|
+
<div class='inline'>
|
450
|
+
<p>YAML data to load</p>
|
451
|
+
</div>
|
452
|
+
|
453
|
+
</li>
|
454
|
+
|
455
|
+
</ul>
|
456
|
+
|
457
|
+
|
458
|
+
</div><table class="source_code">
|
459
|
+
<tr>
|
460
|
+
<td>
|
461
|
+
<pre class="lines">
|
462
|
+
|
463
|
+
|
464
|
+
41
|
465
|
+
42
|
466
|
+
43
|
467
|
+
44</pre>
|
468
|
+
</td>
|
469
|
+
<td>
|
470
|
+
<pre class="code"><span class="info file"># File 'lib/r509/oid_mapper.rb', line 41</span>
|
471
|
+
|
472
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_register_from_yaml'>register_from_yaml</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_yaml_data'>yaml_data</span><span class='rparen'>)</span>
|
473
|
+
<span class='id identifier rubyid_conf'>conf</span> <span class='op'>=</span> <span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_yaml_data'>yaml_data</span><span class='rparen'>)</span>
|
474
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_batch_register'>batch_register</span><span class='lparen'>(</span><span class='id identifier rubyid_conf'>conf</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
475
|
+
<span class='kw'>end</span></pre>
|
476
|
+
</td>
|
477
|
+
</tr>
|
478
|
+
</table>
|
364
479
|
</div>
|
365
480
|
|
366
481
|
</div>
|
@@ -368,9 +483,9 @@
|
|
368
483
|
</div>
|
369
484
|
|
370
485
|
<div id="footer">
|
371
|
-
Generated on
|
486
|
+
Generated on Sun Jan 26 13:37:25 2014 by
|
372
487
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
373
|
-
0.8.
|
488
|
+
0.8.6.1 (ruby-2.0.0).
|
374
489
|
</div>
|
375
490
|
|
376
491
|
</body>
|
data/doc/R509/PrivateKey.html
CHANGED
@@ -6,13 +6,13 @@
|
|
6
6
|
<title>
|
7
7
|
Class: R509::PrivateKey
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.6.1
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css"
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
14
|
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css"
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
18
|
hasFrames = window.top.frames.main ? true : false;
|
@@ -90,15 +90,11 @@
|
|
90
90
|
|
91
91
|
|
92
92
|
|
93
|
-
<dt class="r2">Includes:</dt>
|
94
|
-
<dd class="r2"><span class='object_link'><a href="IOHelpers.html" title="R509::IOHelpers (module)">IOHelpers</a></span></dd>
|
95
|
-
|
96
|
-
|
97
93
|
|
98
94
|
|
99
95
|
|
100
|
-
<dt class="
|
101
|
-
<dd class="
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/r509/private_key.rb</dd>
|
102
98
|
|
103
99
|
</dl>
|
104
100
|
<div class="clear"></div>
|
@@ -115,6 +111,77 @@
|
|
115
111
|
|
116
112
|
|
117
113
|
</div>
|
114
|
+
<h2>Constant Summary</h2>
|
115
|
+
|
116
|
+
<dl class="constants">
|
117
|
+
|
118
|
+
<dt id="KNOWN_TYPES-constant" class="">KNOWN_TYPES =
|
119
|
+
<div class="docstring">
|
120
|
+
<div class="discussion">
|
121
|
+
|
122
|
+
<p>a list of key types</p>
|
123
|
+
|
124
|
+
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
<div class="tags">
|
128
|
+
|
129
|
+
|
130
|
+
</div>
|
131
|
+
</dt>
|
132
|
+
<dd><pre class="code"><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>RSA</span><span class='tstring_end'>"</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>DSA</span><span class='tstring_end'>"</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>EC</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span></pre></dd>
|
133
|
+
|
134
|
+
<dt id="DEFAULT_TYPE-constant" class="">DEFAULT_TYPE =
|
135
|
+
<div class="docstring">
|
136
|
+
<div class="discussion">
|
137
|
+
|
138
|
+
<p>the default type</p>
|
139
|
+
|
140
|
+
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
<div class="tags">
|
144
|
+
|
145
|
+
|
146
|
+
</div>
|
147
|
+
</dt>
|
148
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>RSA</span><span class='tstring_end'>"</span></span></pre></dd>
|
149
|
+
|
150
|
+
<dt id="DEFAULT_STRENGTH-constant" class="">DEFAULT_STRENGTH =
|
151
|
+
<div class="docstring">
|
152
|
+
<div class="discussion">
|
153
|
+
|
154
|
+
<p>default bit length for DSA/RSA</p>
|
155
|
+
|
156
|
+
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
<div class="tags">
|
160
|
+
|
161
|
+
|
162
|
+
</div>
|
163
|
+
</dt>
|
164
|
+
<dd><pre class="code"><span class='int'>2048</span></pre></dd>
|
165
|
+
|
166
|
+
<dt id="DEFAULT_CURVE-constant" class="">DEFAULT_CURVE =
|
167
|
+
<div class="docstring">
|
168
|
+
<div class="discussion">
|
169
|
+
|
170
|
+
<p>default curve name for EC</p>
|
171
|
+
|
172
|
+
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
<div class="tags">
|
176
|
+
|
177
|
+
|
178
|
+
</div>
|
179
|
+
</dt>
|
180
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>secp384r1</span><span class='tstring_end'>"</span></span></pre></dd>
|
181
|
+
|
182
|
+
</dl>
|
183
|
+
|
184
|
+
|
118
185
|
|
119
186
|
|
120
187
|
|
@@ -165,10 +232,12 @@
|
|
165
232
|
<li class="public ">
|
166
233
|
<span class="summary_signature">
|
167
234
|
|
168
|
-
<a href="#
|
235
|
+
<a href="#bit_length-instance_method" title="#bit_length (instance method)">- (Integer) <strong>bit_length</strong> </a>
|
169
236
|
|
170
237
|
|
171
238
|
|
239
|
+
(also: #bit_strength)
|
240
|
+
|
172
241
|
</span>
|
173
242
|
|
174
243
|
|
@@ -180,7 +249,7 @@
|
|
180
249
|
|
181
250
|
|
182
251
|
<span class="summary_desc"><div class='inline'>
|
183
|
-
<p>Returns the bit
|
252
|
+
<p>Returns the bit length of the key.</p>
|
184
253
|
</div></span>
|
185
254
|
|
186
255
|
</li>
|
@@ -533,16 +602,7 @@ key in the HSM (which will not show the private key, just public).</p>
|
|
533
602
|
|
534
603
|
|
535
604
|
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="IOHelpers.html" title="R509::IOHelpers (module)">IOHelpers</a></span></h3>
|
544
|
-
<p class="inherited"><span class='object_link'><a href="IOHelpers.html#read_data-instance_method" title="R509::IOHelpers#read_data (method)">#read_data</a></span>, <span class='object_link'><a href="IOHelpers.html#read_data-class_method" title="R509::IOHelpers.read_data (method)">read_data</a></span>, <span class='object_link'><a href="IOHelpers.html#write_data-instance_method" title="R509::IOHelpers#write_data (method)">#write_data</a></span>, <span class='object_link'><a href="IOHelpers.html#write_data-class_method" title="R509::IOHelpers.write_data (method)">write_data</a></span></p>
|
545
|
-
<div id="constructor_details" class="method_details_list">
|
605
|
+
<div id="constructor_details" class="method_details_list">
|
546
606
|
<h2>Constructor Details</h2>
|
547
607
|
|
548
608
|
<div class="method_details first">
|
@@ -600,7 +660,8 @@ key in the HSM (which will not show the private key, just public).</p>
|
|
600
660
|
</span>
|
601
661
|
|
602
662
|
— <div class='inline'>
|
603
|
-
<p
|
663
|
+
<p>Defaults to R509::PrivateKey::DEFAULT_TYPE. Allows
|
664
|
+
R509::PrivateKey::KNOWN_TYPES.</p>
|
604
665
|
</div>
|
605
666
|
|
606
667
|
</li>
|
@@ -616,7 +677,23 @@ key in the HSM (which will not show the private key, just public).</p>
|
|
616
677
|
</span>
|
617
678
|
|
618
679
|
— <div class='inline'>
|
619
|
-
<p>Only used if :type is
|
680
|
+
<p>Only used if :type is EC</p>
|
681
|
+
</div>
|
682
|
+
|
683
|
+
</li>
|
684
|
+
|
685
|
+
<li>
|
686
|
+
<span class="name">:bit_length</span>
|
687
|
+
<span class="type">(<tt>Integer</tt>)</span>
|
688
|
+
<span class="default">
|
689
|
+
|
690
|
+
— default:
|
691
|
+
<tt>2048</tt>
|
692
|
+
|
693
|
+
</span>
|
694
|
+
|
695
|
+
— <div class='inline'>
|
696
|
+
<p>Only used if :type is RSA or DSA</p>
|
620
697
|
</div>
|
621
698
|
|
622
699
|
</li>
|
@@ -632,7 +709,7 @@ key in the HSM (which will not show the private key, just public).</p>
|
|
632
709
|
</span>
|
633
710
|
|
634
711
|
— <div class='inline'>
|
635
|
-
<p>
|
712
|
+
<p>Deprecated, identical to bit_length.</p>
|
636
713
|
</div>
|
637
714
|
|
638
715
|
</li>
|
@@ -686,16 +763,6 @@ key in the HSM (which will not show the private key, just public).</p>
|
|
686
763
|
<pre class="lines">
|
687
764
|
|
688
765
|
|
689
|
-
17
|
690
|
-
18
|
691
|
-
19
|
692
|
-
20
|
693
|
-
21
|
694
|
-
22
|
695
|
-
23
|
696
|
-
24
|
697
|
-
25
|
698
|
-
26
|
699
766
|
27
|
700
767
|
28
|
701
768
|
29
|
@@ -707,93 +774,21 @@ key in the HSM (which will not show the private key, just public).</p>
|
|
707
774
|
35
|
708
775
|
36
|
709
776
|
37
|
710
|
-
38
|
711
|
-
39
|
712
|
-
40
|
713
|
-
41
|
714
|
-
42
|
715
|
-
43
|
716
|
-
44
|
717
|
-
45
|
718
|
-
46
|
719
|
-
47
|
720
|
-
48
|
721
|
-
49
|
722
|
-
50
|
723
|
-
51
|
724
|
-
52
|
725
|
-
53
|
726
|
-
54
|
727
|
-
55
|
728
|
-
56
|
729
|
-
57
|
730
|
-
58
|
731
|
-
59
|
732
|
-
60
|
733
|
-
61
|
734
|
-
62
|
735
|
-
63
|
736
|
-
64
|
737
|
-
65
|
738
|
-
66
|
739
|
-
67
|
740
|
-
68
|
741
|
-
69</pre>
|
777
|
+
38</pre>
|
742
778
|
</td>
|
743
779
|
<td>
|
744
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
780
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 27</span>
|
745
781
|
|
746
782
|
<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>
|
747
783
|
<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>
|
748
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'
|
749
|
-
<span class='kw'>end</span>
|
750
|
-
|
751
|
-
<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'>:engine</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'>:key</span><span class='rparen'>)</span>
|
752
|
-
<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'>You can\'t pass both :key and :engine</span><span class='tstring_end'>'</span></span>
|
753
|
-
<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'>:key_name</span><span class='rparen'>)</span> <span class='kw'>and</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'>:engine</span><span class='rparen'>)</span>
|
754
|
-
<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'>When providing a :key_name you MUST provide an :engine</span><span class='tstring_end'>'</span></span>
|
755
|
-
<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'>:engine</span><span class='rparen'>)</span> <span class='kw'>and</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'>:key_name</span><span class='rparen'>)</span>
|
756
|
-
<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'>When providing an :engine you MUST provide a :key_name</span><span class='tstring_end'>'</span></span>
|
757
|
-
<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'>:engine</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'>:key_name</span><span class='rparen'>)</span>
|
758
|
-
<span class='kw'>if</span> <span class='kw'>not</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:engine</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'>OpenSSL</span><span class='op'>::</span><span class='const'>Engine</span><span class='rparen'>)</span>
|
759
|
-
<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'>When providing an engine, it must be of type OpenSSL::Engine</span><span class='tstring_end'>'</span></span>
|
760
|
-
<span class='kw'>end</span>
|
761
|
-
<span class='ivar'>@engine</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:engine</span><span class='rbracket'>]</span>
|
762
|
-
<span class='ivar'>@key_name</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:key_name</span><span class='rbracket'>]</span>
|
784
|
+
<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>
|
763
785
|
<span class='kw'>end</span>
|
786
|
+
<span class='id identifier rubyid_validate_engine'>validate_engine</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
764
787
|
|
765
788
|
<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>
|
766
|
-
<span class='id identifier
|
767
|
-
<span class='comment'>#OpenSSL::PKey.read solves this begin/rescue garbage but is only
|
768
|
-
</span> <span class='comment'>#available to Ruby 1.9.3+ and may not solve the EC portion
|
769
|
-
</span> <span class='kw'>begin</span>
|
770
|
-
<span class='ivar'>@key</span> <span class='op'>=</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='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'>:key</span><span class='rbracket'>]</span><span class='comma'>,</span><span class='id identifier rubyid_password'>password</span><span class='rparen'>)</span>
|
771
|
-
<span class='kw'>rescue</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>PKey</span><span class='op'>::</span><span class='const'>RSAError</span>
|
772
|
-
<span class='kw'>begin</span>
|
773
|
-
<span class='ivar'>@key</span> <span class='op'>=</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='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'>:key</span><span class='rbracket'>]</span><span class='comma'>,</span><span class='id identifier rubyid_password'>password</span><span class='rparen'>)</span>
|
774
|
-
<span class='kw'>rescue</span>
|
775
|
-
<span class='kw'>begin</span>
|
776
|
-
<span class='ivar'>@key</span> <span class='op'>=</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='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'>:key</span><span class='rbracket'>]</span><span class='comma'>,</span><span class='id identifier rubyid_password'>password</span><span class='rparen'>)</span>
|
777
|
-
<span class='kw'>rescue</span>
|
778
|
-
<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'>Failed to load private key. Invalid key or incorrect password.</span><span class='tstring_end'>"</span></span>
|
779
|
-
<span class='kw'>end</span>
|
780
|
-
<span class='kw'>end</span>
|
781
|
-
<span class='kw'>end</span>
|
789
|
+
<span class='id identifier rubyid_validate_key'>validate_key</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
782
790
|
<span class='kw'>else</span>
|
783
|
-
<span class='id identifier
|
784
|
-
<span class='id identifier rubyid_type'>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>
|
785
|
-
<span class='kw'>case</span> <span class='id identifier rubyid_type'>type</span>
|
786
|
-
<span class='kw'>when</span> <span class='symbol'>:rsa</span>
|
787
|
-
<span class='ivar'>@key</span> <span class='op'>=</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='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_bit_strength'>bit_strength</span><span class='rparen'>)</span>
|
788
|
-
<span class='kw'>when</span> <span class='symbol'>:dsa</span>
|
789
|
-
<span class='ivar'>@key</span> <span class='op'>=</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='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_bit_strength'>bit_strength</span><span class='rparen'>)</span>
|
790
|
-
<span class='kw'>when</span> <span class='symbol'>:ec</span>
|
791
|
-
<span class='id identifier rubyid_curve_name'>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'>"</span><span class='tstring_content'>secp384r1</span><span class='tstring_end'>"</span></span>
|
792
|
-
<span class='ivar'>@key</span> <span class='op'>=</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='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_curve_name'>curve_name</span><span class='rparen'>)</span>
|
793
|
-
<span class='ivar'>@key</span><span class='period'>.</span><span class='id identifier rubyid_generate_key'>generate_key</span>
|
794
|
-
<span class='kw'>else</span>
|
795
|
-
<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 or engine is nil</span><span class='tstring_end'>'</span></span>
|
796
|
-
<span class='kw'>end</span>
|
791
|
+
<span class='id identifier rubyid_generate_key'>generate_key</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
797
792
|
<span class='kw'>end</span>
|
798
793
|
<span class='kw'>end</span></pre>
|
799
794
|
</td>
|
@@ -872,12 +867,12 @@ key in the HSM (which will not show the private key, just public).</p>
|
|
872
867
|
<pre class="lines">
|
873
868
|
|
874
869
|
|
875
|
-
|
876
|
-
|
877
|
-
|
870
|
+
44
|
871
|
+
45
|
872
|
+
46</pre>
|
878
873
|
</td>
|
879
874
|
<td>
|
880
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
875
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 44</span>
|
881
876
|
|
882
877
|
<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='comma'>,</span> <span class='id identifier rubyid_password'>password</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='rparen'>)</span>
|
883
878
|
<span class='kw'>return</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'>=></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='comma'>,</span> <span class='symbol'>:password</span> <span class='op'>=></span> <span class='id identifier rubyid_password'>password</span> <span class='rparen'>)</span>
|
@@ -894,18 +889,22 @@ key in the HSM (which will not show the private key, just public).</p>
|
|
894
889
|
|
895
890
|
|
896
891
|
<div class="method_details first">
|
897
|
-
<h3 class="signature first" id="
|
892
|
+
<h3 class="signature first" id="bit_length-instance_method">
|
898
893
|
|
899
|
-
- (<tt>Integer</tt>) <strong>
|
894
|
+
- (<tt>Integer</tt>) <strong>bit_length</strong>
|
900
895
|
|
901
896
|
|
902
897
|
|
898
|
+
<span class="aliases">Also known as:
|
899
|
+
<span class="names"><span id='bit_strength-instance_method'>bit_strength</span></span>
|
900
|
+
</span>
|
901
|
+
|
903
902
|
|
904
903
|
|
905
904
|
</h3><div class="docstring">
|
906
905
|
<div class="discussion">
|
907
906
|
|
908
|
-
<p>Returns the bit
|
907
|
+
<p>Returns the bit length of the key</p>
|
909
908
|
|
910
909
|
|
911
910
|
</div>
|
@@ -932,26 +931,26 @@ key in the HSM (which will not show the private key, just public).</p>
|
|
932
931
|
<pre class="lines">
|
933
932
|
|
934
933
|
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
934
|
+
52
|
935
|
+
53
|
936
|
+
54
|
937
|
+
55
|
938
|
+
56
|
939
|
+
57
|
940
|
+
58
|
941
|
+
59
|
942
|
+
60</pre>
|
944
943
|
</td>
|
945
944
|
<td>
|
946
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
945
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 52</span>
|
947
946
|
|
948
|
-
<span class='kw'>def</span> <span class='id identifier
|
947
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_bit_length'>bit_length</span>
|
949
948
|
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_rsa?'>rsa?</span>
|
950
949
|
<span class='kw'>return</span> <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_n'>n</span><span class='period'>.</span><span class='id identifier rubyid_num_bits'>num_bits</span>
|
951
950
|
<span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dsa?'>dsa?</span>
|
952
951
|
<span class='kw'>return</span> <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_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_num_bits'>num_bits</span>
|
953
952
|
<span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ec?'>ec?</span>
|
954
|
-
<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'
|
953
|
+
<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 length is not available for EC at this time.</span><span class='tstring_end'>'</span></span>
|
955
954
|
<span class='kw'>end</span>
|
956
955
|
<span class='kw'>end</span></pre>
|
957
956
|
</td>
|
@@ -1004,22 +1003,22 @@ key if the key is EC. If not, raises an error.</p>
|
|
1004
1003
|
<pre class="lines">
|
1005
1004
|
|
1006
1005
|
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1006
|
+
67
|
1007
|
+
68
|
1008
|
+
69
|
1009
|
+
70
|
1010
|
+
71
|
1011
|
+
72
|
1012
|
+
73</pre>
|
1014
1013
|
</td>
|
1015
1014
|
<td>
|
1016
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
1015
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 67</span>
|
1017
1016
|
|
1018
1017
|
<span class='kw'>def</span> <span class='id identifier rubyid_curve_name'>curve_name</span>
|
1019
1018
|
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ec?'>ec?</span>
|
1020
1019
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_key'>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>
|
1021
1020
|
<span class='kw'>else</span>
|
1022
|
-
<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'
|
1021
|
+
<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 private keys</span><span class='tstring_end'>'</span></span>
|
1023
1022
|
<span class='kw'>end</span>
|
1024
1023
|
<span class='kw'>end</span></pre>
|
1025
1024
|
</td>
|
@@ -1071,12 +1070,12 @@ key if the key is EC. If not, raises an error.</p>
|
|
1071
1070
|
<pre class="lines">
|
1072
1071
|
|
1073
1072
|
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1073
|
+
187
|
1074
|
+
188
|
1075
|
+
189</pre>
|
1077
1076
|
</td>
|
1078
1077
|
<td>
|
1079
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
1078
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 187</span>
|
1080
1079
|
|
1081
1080
|
<span class='kw'>def</span> <span class='id identifier rubyid_dsa?'>dsa?</span>
|
1082
1081
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_key'>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>
|
@@ -1130,12 +1129,12 @@ key if the key is EC. If not, raises an error.</p>
|
|
1130
1129
|
<pre class="lines">
|
1131
1130
|
|
1132
1131
|
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1132
|
+
194
|
1133
|
+
195
|
1134
|
+
196</pre>
|
1136
1135
|
</td>
|
1137
1136
|
<td>
|
1138
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
1137
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 194</span>
|
1139
1138
|
|
1140
1139
|
<span class='kw'>def</span> <span class='id identifier rubyid_ec?'>ec?</span>
|
1141
1140
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_key'>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>
|
@@ -1189,16 +1188,16 @@ key if the key is EC. If not, raises an error.</p>
|
|
1189
1188
|
<pre class="lines">
|
1190
1189
|
|
1191
1190
|
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1191
|
+
85
|
1192
|
+
86
|
1193
|
+
87
|
1194
|
+
88
|
1195
|
+
89
|
1196
|
+
90
|
1197
|
+
91</pre>
|
1199
1198
|
</td>
|
1200
1199
|
<td>
|
1201
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
1200
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 85</span>
|
1202
1201
|
|
1203
1202
|
<span class='kw'>def</span> <span class='id identifier rubyid_in_hardware?'>in_hardware?</span>
|
1204
1203
|
<span class='kw'>if</span> <span class='kw'>not</span> <span class='ivar'>@engine</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
@@ -1258,16 +1257,16 @@ key in the HSM (which will not show the private key, just public)</p>
|
|
1258
1257
|
<pre class="lines">
|
1259
1258
|
|
1260
1259
|
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1260
|
+
76
|
1261
|
+
77
|
1262
|
+
78
|
1263
|
+
79
|
1264
|
+
80
|
1265
|
+
81
|
1266
|
+
82</pre>
|
1268
1267
|
</td>
|
1269
1268
|
<td>
|
1270
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
1269
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 76</span>
|
1271
1270
|
|
1272
1271
|
<span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span>
|
1273
1272
|
<span class='kw'>if</span> <span class='id identifier rubyid_in_hardware?'>in_hardware?</span>
|
@@ -1329,29 +1328,29 @@ key in the HSM (which will not show the private key, just public)</p>
|
|
1329
1328
|
<pre class="lines">
|
1330
1329
|
|
1331
1330
|
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1331
|
+
94
|
1332
|
+
95
|
1333
|
+
96
|
1334
|
+
97
|
1335
|
+
98
|
1336
|
+
99
|
1337
|
+
100
|
1338
|
+
101
|
1339
|
+
102
|
1340
|
+
103
|
1341
|
+
104
|
1342
|
+
105
|
1343
|
+
106
|
1344
|
+
107</pre>
|
1346
1345
|
</td>
|
1347
1346
|
<td>
|
1348
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
1347
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 94</span>
|
1349
1348
|
|
1350
1349
|
<span class='kw'>def</span> <span class='id identifier rubyid_public_key'>public_key</span>
|
1351
1350
|
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ec?'>ec?</span>
|
1352
|
-
<span class='comment'># OpenSSL::PKey::EC.public_key returns an OpenSSL::PKey::EC::Point, which isn
|
1351
|
+
<span class='comment'># OpenSSL::PKey::EC.public_key returns an OpenSSL::PKey::EC::Point, which isn't consistent
|
1353
1352
|
</span> <span class='comment'># with the way OpenSSL::PKey::RSA/DSA do it. We could return the original PKey::EC object
|
1354
|
-
</span> <span class='comment'># but if we do that then it has the private_key as well. Here
|
1353
|
+
</span> <span class='comment'># but if we do that then it has the private_key as well. Here's a ghetto workaround.
|
1355
1354
|
</span> <span class='comment'># We have to supply the curve name to the temporary key object or else #public_key= fails
|
1356
1355
|
</span> <span class='id identifier rubyid_curve_name'>curve_name</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_key'>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>
|
1357
1356
|
<span class='id identifier rubyid_temp_key'>temp_key</span> <span class='op'>=</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='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_curve_name'>curve_name</span><span class='rparen'>)</span>
|
@@ -1410,12 +1409,12 @@ key in the HSM (which will not show the private key, just public)</p>
|
|
1410
1409
|
<pre class="lines">
|
1411
1410
|
|
1412
1411
|
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1412
|
+
180
|
1413
|
+
181
|
1414
|
+
182</pre>
|
1416
1415
|
</td>
|
1417
1416
|
<td>
|
1418
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
1417
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 180</span>
|
1419
1418
|
|
1420
1419
|
<span class='kw'>def</span> <span class='id identifier rubyid_rsa?'>rsa?</span>
|
1421
1420
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_key'>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>
|
@@ -1469,15 +1468,15 @@ key in the HSM (which will not show the private key, just public)</p>
|
|
1469
1468
|
<pre class="lines">
|
1470
1469
|
|
1471
1470
|
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1471
|
+
140
|
1472
|
+
141
|
1473
|
+
142
|
1474
|
+
143
|
1475
|
+
144
|
1476
|
+
145</pre>
|
1478
1477
|
</td>
|
1479
1478
|
<td>
|
1480
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
1479
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 140</span>
|
1481
1480
|
|
1482
1481
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_der'>to_der</span>
|
1483
1482
|
<span class='kw'>if</span> <span class='id identifier rubyid_in_hardware?'>in_hardware?</span>
|
@@ -1573,16 +1572,16 @@ key in the HSM (which will not show the private key, just public)</p>
|
|
1573
1572
|
<pre class="lines">
|
1574
1573
|
|
1575
1574
|
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1575
|
+
128
|
1576
|
+
129
|
1577
|
+
130
|
1578
|
+
131
|
1579
|
+
132
|
1580
|
+
133
|
1581
|
+
134</pre>
|
1583
1582
|
</td>
|
1584
1583
|
<td>
|
1585
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
1584
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 128</span>
|
1586
1585
|
|
1587
1586
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_encrypted_pem'>to_encrypted_pem</span><span class='lparen'>(</span><span class='id identifier rubyid_cipher'>cipher</span><span class='comma'>,</span><span class='id identifier rubyid_password'>password</span><span class='rparen'>)</span>
|
1588
1587
|
<span class='kw'>if</span> <span class='id identifier rubyid_in_hardware?'>in_hardware?</span>
|
@@ -1640,15 +1639,15 @@ key in the HSM (which will not show the private key, just public)</p>
|
|
1640
1639
|
<pre class="lines">
|
1641
1640
|
|
1642
1641
|
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1642
|
+
114
|
1643
|
+
115
|
1644
|
+
116
|
1645
|
+
117
|
1646
|
+
118
|
1647
|
+
119</pre>
|
1649
1648
|
</td>
|
1650
1649
|
<td>
|
1651
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
1650
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 114</span>
|
1652
1651
|
|
1653
1652
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_pem'>to_pem</span>
|
1654
1653
|
<span class='kw'>if</span> <span class='id identifier rubyid_in_hardware?'>in_hardware?</span>
|
@@ -1693,8 +1692,8 @@ key in the HSM (which will not show the private key, just public)</p>
|
|
1693
1692
|
|
1694
1693
|
—
|
1695
1694
|
<div class='inline'>
|
1696
|
-
<p>Either a string of the path for the file that you
|
1697
|
-
IO-like object.</p>
|
1695
|
+
<p>Either a string of the path for the file that you'd like to write, or
|
1696
|
+
an IO-like object.</p>
|
1698
1697
|
</div>
|
1699
1698
|
|
1700
1699
|
</li>
|
@@ -1708,12 +1707,12 @@ IO-like object.</p>
|
|
1708
1707
|
<pre class="lines">
|
1709
1708
|
|
1710
1709
|
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1710
|
+
172
|
1711
|
+
173
|
1712
|
+
174</pre>
|
1714
1713
|
</td>
|
1715
1714
|
<td>
|
1716
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
1715
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 172</span>
|
1717
1716
|
|
1718
1717
|
<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>
|
1719
1718
|
<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='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_der'>to_der</span><span class='rparen'>)</span>
|
@@ -1758,8 +1757,8 @@ IO-like object.</p>
|
|
1758
1757
|
|
1759
1758
|
—
|
1760
1759
|
<div class='inline'>
|
1761
|
-
<p>Either a string of the path for the file that you
|
1762
|
-
IO-like object.</p>
|
1760
|
+
<p>Either a string of the path for the file that you'd like to write, or
|
1761
|
+
an IO-like object.</p>
|
1763
1762
|
</div>
|
1764
1763
|
|
1765
1764
|
</li>
|
@@ -1805,12 +1804,12 @@ IO-like object.</p>
|
|
1805
1804
|
<pre class="lines">
|
1806
1805
|
|
1807
1806
|
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1807
|
+
164
|
1808
|
+
165
|
1809
|
+
166</pre>
|
1811
1810
|
</td>
|
1812
1811
|
<td>
|
1813
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
1812
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 164</span>
|
1814
1813
|
|
1815
1814
|
<span class='kw'>def</span> <span class='id identifier rubyid_write_encrypted_pem'>write_encrypted_pem</span><span class='lparen'>(</span><span class='id identifier rubyid_filename_or_io'>filename_or_io</span><span class='comma'>,</span><span class='id identifier rubyid_cipher'>cipher</span><span class='comma'>,</span><span class='id identifier rubyid_password'>password</span><span class='rparen'>)</span>
|
1816
1815
|
<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='id identifier rubyid_to_encrypted_pem'>to_encrypted_pem</span><span class='lparen'>(</span><span class='id identifier rubyid_cipher'>cipher</span><span class='comma'>,</span><span class='id identifier rubyid_password'>password</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
@@ -1852,8 +1851,8 @@ IO-like object.</p>
|
|
1852
1851
|
|
1853
1852
|
—
|
1854
1853
|
<div class='inline'>
|
1855
|
-
<p>Either a string of the path for the file that you
|
1856
|
-
IO-like object.</p>
|
1854
|
+
<p>Either a string of the path for the file that you'd like to write, or
|
1855
|
+
an IO-like object.</p>
|
1857
1856
|
</div>
|
1858
1857
|
|
1859
1858
|
</li>
|
@@ -1867,12 +1866,12 @@ IO-like object.</p>
|
|
1867
1866
|
<pre class="lines">
|
1868
1867
|
|
1869
1868
|
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1869
|
+
151
|
1870
|
+
152
|
1871
|
+
153</pre>
|
1873
1872
|
</td>
|
1874
1873
|
<td>
|
1875
|
-
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line
|
1874
|
+
<pre class="code"><span class="info file"># File 'lib/r509/private_key.rb', line 151</span>
|
1876
1875
|
|
1877
1876
|
<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>
|
1878
1877
|
<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='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_pem'>to_pem</span><span class='rparen'>)</span>
|
@@ -1887,9 +1886,9 @@ IO-like object.</p>
|
|
1887
1886
|
</div>
|
1888
1887
|
|
1889
1888
|
<div id="footer">
|
1890
|
-
Generated on
|
1889
|
+
Generated on Sun Jan 26 13:37:27 2014 by
|
1891
1890
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1892
|
-
0.8.
|
1891
|
+
0.8.6.1 (ruby-2.0.0).
|
1893
1892
|
</div>
|
1894
1893
|
|
1895
1894
|
</body>
|