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.
- data/README.md +343 -151
- data/Rakefile +26 -23
- data/bin/r509 +126 -112
- data/bin/r509-parse +24 -24
- data/doc/R509.html +169 -7
- data/doc/R509/ASN1.html +370 -0
- data/doc/R509/ASN1/GeneralName.html +1121 -0
- data/doc/R509/ASN1/GeneralNames.html +843 -0
- data/doc/R509/ASN1/NoticeReference.html +392 -0
- data/doc/R509/ASN1/PolicyInformation.html +387 -0
- data/doc/R509/ASN1/PolicyQualifiers.html +455 -0
- data/doc/R509/ASN1/UserNotice.html +386 -0
- data/doc/R509/{Crl.html → CRL.html} +7 -7
- data/doc/R509/CRL/Administrator.html +1559 -0
- data/doc/R509/{Crl/Parser.html → CRL/SignedList.html} +501 -210
- data/doc/R509/{Csr.html → CSR.html} +444 -314
- data/doc/R509/Cert.html +866 -617
- data/doc/R509/Cert/Extensions.html +52 -41
- data/doc/R509/Cert/Extensions/AuthorityInfoAccess.html +70 -35
- data/doc/R509/Cert/Extensions/AuthorityKeyIdentifier.html +387 -4
- data/doc/R509/Cert/Extensions/BasicConstraints.html +61 -25
- data/doc/R509/Cert/Extensions/CRLDistributionPoints.html +354 -0
- data/doc/R509/Cert/Extensions/CertificatePolicies.html +340 -0
- data/doc/R509/Cert/Extensions/ExtendedKeyUsage.html +440 -49
- data/doc/R509/Cert/Extensions/{CrlDistributionPoints.html → InhibitAnyPolicy.html} +52 -35
- data/doc/R509/Cert/Extensions/KeyUsage.html +247 -121
- data/doc/R509/Cert/Extensions/NameConstraints.html +445 -0
- data/doc/R509/Cert/Extensions/OCSPNoCheck.html +239 -0
- data/doc/R509/Cert/Extensions/PolicyConstraints.html +424 -0
- data/doc/R509/Cert/Extensions/SubjectAlternativeName.html +437 -62
- data/doc/R509/Cert/Extensions/SubjectKeyIdentifier.html +52 -10
- data/doc/R509/CertificateAuthority.html +4 -4
- data/doc/R509/CertificateAuthority/Signer.html +154 -187
- data/doc/R509/Config.html +6 -6
- data/doc/R509/Config/{CaConfig.html → CAConfig.html} +451 -348
- data/doc/R509/Config/{CaConfigPool.html → CAConfigPool.html} +47 -47
- data/doc/R509/Config/CAProfile.html +1015 -0
- data/doc/R509/Config/SubjectItemPolicy.html +86 -86
- data/doc/R509/IOHelpers.html +22 -22
- data/doc/R509/MessageDigest.html +14 -14
- data/doc/R509/NameSanitizer.html +53 -53
- data/doc/R509/{Ocsp.html → OCSP.html} +9 -9
- data/doc/R509/{Ocsp → OCSP}/Request.html +7 -7
- data/doc/R509/{Ocsp → OCSP}/Request/Nonce.html +56 -11
- data/doc/R509/{Ocsp → OCSP}/Response.html +44 -44
- data/doc/R509/{OidMapper.html → OIDMapper.html} +23 -39
- data/doc/R509/PrivateKey.html +415 -168
- data/doc/R509/R509Error.html +3 -3
- data/doc/R509/{Spki.html → SPKI.html} +354 -192
- data/doc/R509/Subject.html +224 -113
- data/doc/R509/Validity.html +27 -5
- data/doc/R509/Validity/Checker.html +13 -13
- data/doc/R509/Validity/DefaultChecker.html +13 -13
- data/doc/R509/Validity/DefaultWriter.html +14 -14
- data/doc/R509/Validity/Status.html +39 -39
- data/doc/R509/Validity/Writer.html +18 -18
- data/doc/_index.html +138 -35
- data/doc/class_list.html +1 -1
- data/doc/css/style.css +10 -0
- data/doc/file.README.html +368 -171
- data/doc/file.r509.html +92 -69
- data/doc/frames.html +1 -1
- data/doc/index.html +368 -171
- data/doc/method_list.html +910 -390
- data/doc/top-level-namespace.html +3 -3
- data/lib/r509.rb +32 -16
- data/lib/r509/asn1.rb +375 -0
- data/lib/r509/cert.rb +381 -364
- data/lib/r509/cert/extensions.rb +443 -76
- data/lib/r509/certificate_authority.rb +407 -0
- data/lib/r509/config.rb +547 -351
- data/lib/r509/crl.rb +336 -366
- data/lib/r509/csr.rb +278 -289
- data/lib/r509/ec-hack.rb +37 -0
- data/lib/r509/exceptions.rb +3 -3
- data/lib/r509/io_helpers.rb +44 -44
- data/lib/r509/message_digest.rb +53 -0
- data/lib/r509/ocsp.rb +80 -70
- data/lib/r509/oid_mapper.rb +32 -0
- data/lib/r509/private_key.rb +228 -0
- data/lib/r509/spki.rb +145 -93
- data/lib/r509/subject.rb +203 -110
- data/lib/r509/validity.rb +70 -68
- data/lib/r509/version.rb +2 -2
- data/r509.yaml +92 -69
- data/spec/asn1_spec.rb +402 -0
- data/spec/cert/extensions_spec.rb +957 -494
- data/spec/cert_spec.rb +382 -307
- data/spec/certificate_authority_spec.rb +668 -250
- data/spec/config_spec.rb +515 -302
- data/spec/crl_spec.rb +197 -198
- data/spec/csr_spec.rb +334 -289
- data/spec/fixtures.rb +247 -171
- data/spec/fixtures/cert1.der +0 -0
- data/spec/fixtures/cert1.pem +0 -0
- data/spec/fixtures/cert1_public_key_modulus.txt +0 -0
- data/spec/fixtures/cert3.p12 +0 -0
- data/spec/fixtures/cert3.pem +0 -0
- data/spec/fixtures/cert3_key.pem +0 -0
- data/spec/fixtures/cert3_key_des3.pem +0 -0
- data/spec/fixtures/cert4.pem +0 -0
- data/spec/fixtures/cert5.pem +0 -0
- data/spec/fixtures/cert6.pem +0 -0
- data/spec/fixtures/cert_expired.pem +0 -0
- data/spec/fixtures/cert_inhibit.pem +24 -0
- data/spec/fixtures/cert_name_constraints.pem +29 -0
- data/spec/fixtures/cert_not_yet_valid.pem +0 -0
- data/spec/fixtures/cert_ocsp_no_check.pem +18 -0
- data/spec/fixtures/cert_policy_constraints.pem +31 -0
- data/spec/fixtures/cert_san.pem +0 -0
- data/spec/fixtures/cert_san2.pem +0 -0
- data/spec/fixtures/cert_unknown_extension.pem +28 -0
- data/spec/fixtures/config_pool_test_minimal.yaml +11 -11
- data/spec/fixtures/config_test.yaml +54 -36
- data/spec/fixtures/config_test_dsa.yaml +35 -0
- data/spec/fixtures/config_test_ec.yaml +35 -0
- data/spec/fixtures/config_test_engine_key.yaml +5 -5
- data/spec/fixtures/config_test_engine_no_key_name.yaml +4 -4
- data/spec/fixtures/config_test_minimal.yaml +4 -4
- data/spec/fixtures/config_test_password.yaml +5 -5
- data/spec/fixtures/config_test_various.yaml +111 -74
- data/spec/fixtures/crl_list_file.txt +0 -0
- data/spec/fixtures/crl_with_reason.pem +0 -0
- data/spec/fixtures/csr1.der +0 -0
- data/spec/fixtures/csr1.pem +0 -0
- data/spec/fixtures/csr1_key.der +0 -0
- data/spec/fixtures/csr1_key.pem +0 -0
- data/spec/fixtures/csr1_key_encrypted_des3.pem +0 -0
- data/spec/fixtures/csr1_newlines.pem +0 -0
- data/spec/fixtures/csr1_no_begin_end.pem +0 -0
- data/spec/fixtures/csr1_public_key_modulus.txt +0 -0
- data/spec/fixtures/csr2.pem +0 -0
- data/spec/fixtures/csr2_key.pem +0 -0
- data/spec/fixtures/csr3.pem +0 -0
- data/spec/fixtures/csr4.pem +0 -0
- data/spec/fixtures/csr_dsa.pem +0 -0
- data/spec/fixtures/csr_invalid_signature.pem +0 -0
- data/spec/fixtures/dsa_key.pem +0 -0
- data/spec/fixtures/dsa_root.cer +28 -0
- data/spec/fixtures/dsa_root.key +20 -0
- data/spec/fixtures/ec_csr2.der +0 -0
- data/spec/fixtures/ec_csr2.pem +8 -0
- data/spec/fixtures/ec_key1.der +0 -0
- data/spec/fixtures/ec_key1.pem +6 -0
- data/spec/fixtures/ec_key1_encrypted.pem +9 -0
- data/spec/fixtures/ec_key2.pem +6 -0
- data/spec/fixtures/hmacsha1.sig +1 -0
- data/spec/fixtures/hmacsha512.sig +1 -0
- data/spec/fixtures/key4.pem +0 -0
- data/spec/fixtures/key4_encrypted_des3.pem +0 -0
- data/spec/fixtures/missing_key_identifier_ca.cer +0 -0
- data/spec/fixtures/missing_key_identifier_ca.key +0 -0
- data/spec/fixtures/ocsptest.r509.local.pem +0 -0
- data/spec/fixtures/ocsptest.r509.local_ocsp_request.der +0 -0
- data/spec/fixtures/ocsptest2.r509.local.pem +0 -0
- data/spec/fixtures/second_ca.cer +0 -0
- data/spec/fixtures/second_ca.key +0 -0
- data/spec/fixtures/spkac.der +0 -0
- data/spec/fixtures/spkac.txt +0 -0
- data/spec/fixtures/spkac_dsa.txt +1 -1
- data/spec/fixtures/spkac_dsa_no_verify.txt +1 -0
- data/spec/fixtures/spkac_ec.txt +1 -0
- data/spec/fixtures/spkac_rsa_newlines.txt +13 -0
- data/spec/fixtures/stca.pem +0 -0
- data/spec/fixtures/stca_ocsp_request.der +0 -0
- data/spec/fixtures/stca_ocsp_response.der +0 -0
- data/spec/fixtures/test1.csr +0 -0
- data/spec/fixtures/test_ca.cer +0 -0
- data/spec/fixtures/test_ca.key +0 -0
- data/spec/fixtures/test_ca.p12 +0 -0
- data/spec/fixtures/test_ca_des3.key +0 -0
- data/spec/fixtures/test_ca_ec.cer +14 -0
- data/spec/fixtures/test_ca_ec.key +6 -0
- data/spec/fixtures/test_ca_ec_ee.cer +22 -0
- data/spec/fixtures/test_ca_ec_ee.key +6 -0
- data/spec/fixtures/test_ca_ocsp.cer +0 -0
- data/spec/fixtures/test_ca_ocsp.key +0 -0
- data/spec/fixtures/test_ca_ocsp.p12 +0 -0
- data/spec/fixtures/test_ca_ocsp_chain.txt +0 -0
- data/spec/fixtures/test_ca_ocsp_response.der +0 -0
- data/spec/fixtures/test_ca_subroot.cer +0 -0
- data/spec/fixtures/test_ca_subroot.key +0 -0
- data/spec/fixtures/test_ca_subroot_ocsp.cer +0 -0
- data/spec/fixtures/test_ca_subroot_ocsp.key +0 -0
- data/spec/fixtures/test_ca_subroot_ocsp_response.der +0 -0
- data/spec/fixtures/unknown_oid.csr +0 -0
- data/spec/message_digest_spec.rb +104 -84
- data/spec/ocsp_spec.rb +105 -105
- data/spec/oid_mapper_spec.rb +21 -21
- data/spec/private_key_spec.rb +275 -0
- data/spec/r509_spec.rb +35 -0
- data/spec/spec_helper.rb +15 -6
- data/spec/spki_spec.rb +221 -142
- data/spec/subject_spec.rb +232 -164
- data/spec/validity_spec.rb +91 -91
- metadata +79 -25
- data/doc/R509/Config/CaProfile.html +0 -651
- data/doc/R509/Crl/Administrator.html +0 -2073
- data/lib/r509/certificateauthority.rb +0 -290
- data/lib/r509/messagedigest.rb +0 -49
- data/lib/r509/oidmapper.rb +0 -32
- data/lib/r509/privatekey.rb +0 -185
- data/spec/privatekey_spec.rb +0 -198
data/doc/R509/R509Error.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Exception: R509::R509Error
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -125,9 +125,9 @@
|
|
125
125
|
</div>
|
126
126
|
|
127
127
|
<div id="footer">
|
128
|
-
Generated on
|
128
|
+
Generated on Tue Apr 16 10:49:57 2013 by
|
129
129
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
130
|
-
0.8.
|
130
|
+
0.8.5 (ruby-1.9.3).
|
131
131
|
</div>
|
132
132
|
|
133
133
|
</body>
|
@@ -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::
|
7
|
+
Class: R509::SPKI
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -34,7 +34,7 @@
|
|
34
34
|
<a href="../_index.html">Index (S)</a> »
|
35
35
|
<span class='title'><span class='object_link'><a href="../R509.html" title="R509 (module)">R509</a></span></span>
|
36
36
|
»
|
37
|
-
<span class="title">
|
37
|
+
<span class="title">SPKI</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::
|
66
|
+
<div id="content"><h1>Class: R509::SPKI
|
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::
|
81
|
+
<li class="next">R509::SPKI</li>
|
82
82
|
|
83
83
|
</ul>
|
84
84
|
<a href="#" class="inheritanceTree">show all</a>
|
@@ -106,8 +106,8 @@
|
|
106
106
|
<h2>Overview</h2><div class="docstring">
|
107
107
|
<div class="discussion">
|
108
108
|
|
109
|
-
<p>class for
|
110
|
-
<keygen> tag</p>
|
109
|
+
<p>class for loading/generating SPKAC/SPKI requests (typically generated by
|
110
|
+
the <keygen> tag</p>
|
111
111
|
|
112
112
|
|
113
113
|
</div>
|
@@ -125,7 +125,7 @@
|
|
125
125
|
<li class="public ">
|
126
126
|
<span class="summary_signature">
|
127
127
|
|
128
|
-
<a href="#
|
128
|
+
<a href="#key-instance_method" title="#key (instance method)">- (Object) <strong>key</strong> </a>
|
129
129
|
|
130
130
|
|
131
131
|
|
@@ -145,7 +145,7 @@
|
|
145
145
|
|
146
146
|
|
147
147
|
<span class="summary_desc"><div class='inline'>
|
148
|
-
<p>Returns the value of attribute
|
148
|
+
<p>Returns the value of attribute key.</p>
|
149
149
|
</div></span>
|
150
150
|
|
151
151
|
</li>
|
@@ -180,10 +180,23 @@
|
|
180
180
|
</li>
|
181
181
|
|
182
182
|
|
183
|
-
|
183
|
+
</ul>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<h2>
|
190
|
+
Instance Method Summary
|
191
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
192
|
+
</h2>
|
193
|
+
|
194
|
+
<ul class="summary">
|
195
|
+
|
196
|
+
<li class="public ">
|
184
197
|
<span class="summary_signature">
|
185
198
|
|
186
|
-
<a href="#
|
199
|
+
<a href="#bit_strength-instance_method" title="#bit_strength (instance method)">- (Integer) <strong>bit_strength</strong> </a>
|
187
200
|
|
188
201
|
|
189
202
|
|
@@ -191,11 +204,6 @@
|
|
191
204
|
|
192
205
|
|
193
206
|
|
194
|
-
|
195
|
-
<span class="note title readonly">readonly</span>
|
196
|
-
|
197
|
-
|
198
|
-
|
199
207
|
|
200
208
|
|
201
209
|
|
@@ -203,29 +211,41 @@
|
|
203
211
|
|
204
212
|
|
205
213
|
<span class="summary_desc"><div class='inline'>
|
206
|
-
<p>Returns the
|
214
|
+
<p>Returns the bit strength of the key used to create the SPKI.</p>
|
207
215
|
</div></span>
|
208
216
|
|
209
217
|
</li>
|
210
218
|
|
219
|
+
|
220
|
+
<li class="public ">
|
221
|
+
<span class="summary_signature">
|
222
|
+
|
223
|
+
<a href="#curve_name-instance_method" title="#curve_name (instance method)">- (String) <strong>curve_name</strong> </a>
|
211
224
|
|
212
|
-
</ul>
|
213
|
-
|
214
|
-
|
215
225
|
|
226
|
+
|
227
|
+
</span>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
216
235
|
|
217
236
|
|
218
|
-
<
|
219
|
-
|
220
|
-
|
221
|
-
|
237
|
+
<span class="summary_desc"><div class='inline'>
|
238
|
+
<p>Returns the short name of the elliptic curve used to generate the public
|
239
|
+
key if the key is EC.</p>
|
240
|
+
</div></span>
|
241
|
+
|
242
|
+
</li>
|
222
243
|
|
223
|
-
<ul class="summary">
|
224
244
|
|
225
245
|
<li class="public ">
|
226
246
|
<span class="summary_signature">
|
227
247
|
|
228
|
-
<a href="#
|
248
|
+
<a href="#dsa%3F-instance_method" title="#dsa? (instance method)">- (Boolean) <strong>dsa?</strong> </a>
|
229
249
|
|
230
250
|
|
231
251
|
|
@@ -240,7 +260,7 @@
|
|
240
260
|
|
241
261
|
|
242
262
|
<span class="summary_desc"><div class='inline'>
|
243
|
-
<p>Returns the
|
263
|
+
<p>Returns whether the public key is DSA.</p>
|
244
264
|
</div></span>
|
245
265
|
|
246
266
|
</li>
|
@@ -249,7 +269,7 @@
|
|
249
269
|
<li class="public ">
|
250
270
|
<span class="summary_signature">
|
251
271
|
|
252
|
-
<a href="#
|
272
|
+
<a href="#ec%3F-instance_method" title="#ec? (instance method)">- (Boolean) <strong>ec?</strong> </a>
|
253
273
|
|
254
274
|
|
255
275
|
|
@@ -264,7 +284,7 @@
|
|
264
284
|
|
265
285
|
|
266
286
|
<span class="summary_desc"><div class='inline'>
|
267
|
-
<p>Returns whether the public key is
|
287
|
+
<p>Returns whether the public key is EC.</p>
|
268
288
|
</div></span>
|
269
289
|
|
270
290
|
</li>
|
@@ -273,7 +293,7 @@
|
|
273
293
|
<li class="public ">
|
274
294
|
<span class="summary_signature">
|
275
295
|
|
276
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (
|
296
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (SPKI) <strong>initialize</strong>(opts = {}) </a>
|
277
297
|
|
278
298
|
|
279
299
|
|
@@ -290,7 +310,7 @@
|
|
290
310
|
|
291
311
|
|
292
312
|
<span class="summary_desc"><div class='inline'>
|
293
|
-
<p>
|
313
|
+
<p>A new instance of SPKI.</p>
|
294
314
|
</div></span>
|
295
315
|
|
296
316
|
</li>
|
@@ -395,10 +415,12 @@
|
|
395
415
|
<li class="public ">
|
396
416
|
<span class="summary_signature">
|
397
417
|
|
398
|
-
<a href="#
|
418
|
+
<a href="#to_pem-instance_method" title="#to_pem (instance method)">- (String) <strong>to_pem</strong> </a>
|
399
419
|
|
400
420
|
|
401
421
|
|
422
|
+
(also: #to_s)
|
423
|
+
|
402
424
|
</span>
|
403
425
|
|
404
426
|
|
@@ -410,9 +432,7 @@
|
|
410
432
|
|
411
433
|
|
412
434
|
<span class="summary_desc"><div class='inline'>
|
413
|
-
<p>
|
414
|
-
method if you intend to alter the values and then pass them to the Ca
|
415
|
-
class.</p>
|
435
|
+
<p>Converts the SPKI into the PEM format.</p>
|
416
436
|
</div></span>
|
417
437
|
|
418
438
|
</li>
|
@@ -421,12 +441,10 @@ class.</p>
|
|
421
441
|
<li class="public ">
|
422
442
|
<span class="summary_signature">
|
423
443
|
|
424
|
-
<a href="#
|
444
|
+
<a href="#verify_signature-instance_method" title="#verify_signature (instance method)">- (Boolean) <strong>verify_signature</strong> </a>
|
425
445
|
|
426
446
|
|
427
447
|
|
428
|
-
(also: #to_s)
|
429
|
-
|
430
448
|
</span>
|
431
449
|
|
432
450
|
|
@@ -438,7 +456,7 @@ class.</p>
|
|
438
456
|
|
439
457
|
|
440
458
|
<span class="summary_desc"><div class='inline'>
|
441
|
-
<p>
|
459
|
+
<p>Verifies the integrity of the signature on the SPKI.</p>
|
442
460
|
</div></span>
|
443
461
|
|
444
462
|
</li>
|
@@ -512,7 +530,7 @@ class.</p>
|
|
512
530
|
<div class="method_details first">
|
513
531
|
<h3 class="signature first" id="initialize-instance_method">
|
514
532
|
|
515
|
-
- (<tt><span class='object_link'><a href="" title="R509::
|
533
|
+
- (<tt><span class='object_link'><a href="" title="R509::SPKI (class)">SPKI</a></span></tt>) <strong>initialize</strong>(opts = {})
|
516
534
|
|
517
535
|
|
518
536
|
|
@@ -521,25 +539,13 @@ class.</p>
|
|
521
539
|
</h3><div class="docstring">
|
522
540
|
<div class="discussion">
|
523
541
|
|
524
|
-
<p>
|
542
|
+
<p>A new instance of SPKI</p>
|
525
543
|
|
526
544
|
|
527
545
|
</div>
|
528
546
|
</div>
|
529
547
|
<div class="tags">
|
530
|
-
|
531
|
-
<div class="examples">
|
532
|
-
<p class="tag_title">Examples:</p>
|
533
|
-
|
534
|
-
|
535
|
-
<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>
|
536
|
-
<dd></dd></dl>
|
537
|
-
</div></p>
|
538
|
-
|
539
|
-
<pre class="example code"></pre>
|
540
|
-
|
541
|
-
</div>
|
542
|
-
<p class="tag_title">Parameters:</p>
|
548
|
+
<p class="tag_title">Parameters:</p>
|
543
549
|
<ul class="param">
|
544
550
|
|
545
551
|
<li>
|
@@ -582,27 +588,30 @@ class.</p>
|
|
582
588
|
</li>
|
583
589
|
|
584
590
|
<li>
|
585
|
-
<span class="name">:
|
586
|
-
<span class="type">(<tt><span class='object_link'><a href="
|
591
|
+
<span class="name">:key</span>
|
592
|
+
<span class="type">(<tt><span class='object_link'><a href="PrivateKey.html" title="R509::PrivateKey (class)">R509::PrivateKey</a></span></tt>, <tt>String</tt>)</span>
|
587
593
|
<span class="default">
|
588
594
|
|
589
595
|
</span>
|
590
596
|
|
591
597
|
— <div class='inline'>
|
592
|
-
<p>
|
598
|
+
<p>optional private key to supply. either an unencrypted PEM/DER string or an
|
599
|
+
R509::PrivateKey object (use the latter if you need password/hardware
|
600
|
+
support). if supplied you do not need to pass an spki.</p>
|
593
601
|
</div>
|
594
602
|
|
595
603
|
</li>
|
596
604
|
|
597
605
|
<li>
|
598
|
-
<span class="name">:
|
599
|
-
<span class="type">(<tt>
|
606
|
+
<span class="name">:message_digest</span>
|
607
|
+
<span class="type">(<tt>String</tt>)</span>
|
600
608
|
<span class="default">
|
601
609
|
|
602
610
|
</span>
|
603
611
|
|
604
612
|
— <div class='inline'>
|
605
|
-
<p>
|
613
|
+
<p>Optional digest. sha1, sha224, sha256, sha384, sha512, md5. Defaults to
|
614
|
+
sha1. Only used if you supply a :key and no :spki</p>
|
606
615
|
</div>
|
607
616
|
|
608
617
|
</li>
|
@@ -617,6 +626,8 @@ class.</p>
|
|
617
626
|
<pre class="lines">
|
618
627
|
|
619
628
|
|
629
|
+
14
|
630
|
+
15
|
620
631
|
16
|
621
632
|
17
|
622
633
|
18
|
@@ -630,24 +641,90 @@ class.</p>
|
|
630
641
|
26
|
631
642
|
27
|
632
643
|
28
|
633
|
-
29
|
644
|
+
29
|
645
|
+
30
|
646
|
+
31
|
647
|
+
32
|
648
|
+
33
|
649
|
+
34
|
650
|
+
35
|
651
|
+
36
|
652
|
+
37
|
653
|
+
38
|
654
|
+
39
|
655
|
+
40
|
656
|
+
41
|
657
|
+
42
|
658
|
+
43
|
659
|
+
44
|
660
|
+
45
|
661
|
+
46
|
662
|
+
47
|
663
|
+
48
|
664
|
+
49
|
665
|
+
50
|
666
|
+
51
|
667
|
+
52
|
668
|
+
53
|
669
|
+
54
|
670
|
+
55
|
671
|
+
56
|
672
|
+
57
|
673
|
+
58
|
674
|
+
59
|
675
|
+
60
|
676
|
+
61</pre>
|
634
677
|
</td>
|
635
678
|
<td>
|
636
|
-
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line
|
679
|
+
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 14</span>
|
637
680
|
|
638
681
|
<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>
|
639
|
-
|
640
|
-
|
682
|
+
<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>
|
683
|
+
<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>
|
684
|
+
<span class='kw'>elsif</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'>:spki</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</span><span class='rparen'>)</span>
|
685
|
+
<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 either :spki or :key</span><span class='tstring_end'>'</span></span>
|
686
|
+
<span class='kw'>end</span>
|
687
|
+
|
688
|
+
<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>
|
689
|
+
<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>
|
690
|
+
<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>
|
691
|
+
<span class='kw'>else</span>
|
692
|
+
<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'>=></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>
|
641
693
|
<span class='kw'>end</span>
|
642
|
-
|
643
|
-
|
694
|
+
<span class='kw'>end</span>
|
695
|
+
<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'>:spki</span><span class='rparen'>)</span>
|
696
|
+
<span class='id identifier rubyid_spki'>spki</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:spki</span><span class='rbracket'>]</span>
|
697
|
+
<span class='comment'># first let's try cleaning up the input a bit so OpenSSL is happy with it
|
698
|
+
</span> <span class='comment'># OpenSSL hates SPKAC=
|
699
|
+
</span> <span class='id identifier rubyid_spki'>spki</span><span class='period'>.</span><span class='id identifier rubyid_sub!'>sub!</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>SPKAC=</span><span class='tstring_end'>"</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
700
|
+
<span class='comment'># it really hates newlines (Firefox loves 'em)
|
701
|
+
</span> <span class='comment'># so let's normalize line endings
|
702
|
+
</span> <span class='id identifier rubyid_spki'>spki</span><span class='period'>.</span><span class='id identifier rubyid_gsub!'>gsub!</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\r\n?</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
703
|
+
<span class='comment'># and nuke 'em
|
704
|
+
</span> <span class='id identifier rubyid_spki'>spki</span><span class='period'>.</span><span class='id identifier rubyid_gsub!'>gsub!</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
705
|
+
<span class='comment'># ...and leading/trailing whitespace
|
706
|
+
</span> <span class='id identifier rubyid_spki'>spki</span><span class='period'>.</span><span class='id identifier rubyid_strip!'>strip!</span>
|
707
|
+
<span class='ivar'>@spki</span> <span class='op'>=</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>Netscape</span><span class='op'>::</span><span class='const'>SPKI</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_spki'>spki</span><span class='rparen'>)</span>
|
708
|
+
<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'>@spki</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>
|
709
|
+
<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 SPKI.</span><span class='tstring_end'>'</span></span>
|
644
710
|
<span class='kw'>end</span>
|
645
|
-
|
646
|
-
|
711
|
+
<span class='kw'>end</span>
|
712
|
+
<span class='comment'># create the SPKI from the private key if it wasn't passed in
|
713
|
+
</span> <span class='kw'>if</span> <span class='ivar'>@spki</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
714
|
+
<span class='ivar'>@spki</span> <span class='op'>=</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>Netscape</span><span class='op'>::</span><span class='const'>SPKI</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
715
|
+
<span class='ivar'>@spki</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span> <span class='op'>=</span> <span class='ivar'>@key</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span>
|
716
|
+
<span class='kw'>if</span> <span class='ivar'>@key</span><span class='period'>.</span><span class='id identifier rubyid_dsa?'>dsa?</span>
|
717
|
+
<span class='comment'>#only DSS1 is acceptable for DSA signing in OpenSSL < 1.0
|
718
|
+
</span> <span class='comment'>#post-1.0 you can sign with anything, but let's be conservative
|
719
|
+
</span> <span class='comment'>#see: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/PKey/DSA.html
|
720
|
+
</span> <span class='id identifier rubyid_message_digest'>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>
|
721
|
+
<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>
|
722
|
+
<span class='id identifier rubyid_message_digest'>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>
|
723
|
+
<span class='kw'>else</span>
|
724
|
+
<span class='id identifier rubyid_message_digest'>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>
|
647
725
|
<span class='kw'>end</span>
|
648
|
-
<span class='ivar'>@spki</span
|
649
|
-
|
650
|
-
<span class='ivar'>@san_names</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>
|
726
|
+
<span class='ivar'>@spki</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='id identifier rubyid_message_digest'>message_digest</span><span class='period'>.</span><span class='id identifier rubyid_digest'>digest</span><span class='rparen'>)</span>
|
727
|
+
<span class='kw'>end</span>
|
651
728
|
<span class='kw'>end</span></pre>
|
652
729
|
</td>
|
653
730
|
</tr>
|
@@ -662,9 +739,9 @@ class.</p>
|
|
662
739
|
|
663
740
|
<span id=""></span>
|
664
741
|
<div class="method_details first">
|
665
|
-
<h3 class="signature first" id="
|
742
|
+
<h3 class="signature first" id="key-instance_method">
|
666
743
|
|
667
|
-
- (<tt>Object</tt>) <strong>
|
744
|
+
- (<tt>Object</tt>) <strong>key</strong> <span class="extras">(readonly)</span>
|
668
745
|
|
669
746
|
|
670
747
|
|
@@ -673,7 +750,7 @@ class.</p>
|
|
673
750
|
</h3><div class="docstring">
|
674
751
|
<div class="discussion">
|
675
752
|
|
676
|
-
<p>Returns the value of attribute
|
753
|
+
<p>Returns the value of attribute key</p>
|
677
754
|
|
678
755
|
|
679
756
|
</div>
|
@@ -694,8 +771,8 @@ class.</p>
|
|
694
771
|
<td>
|
695
772
|
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 10</span>
|
696
773
|
|
697
|
-
<span class='kw'>def</span> <span class='id identifier
|
698
|
-
<span class='ivar'>@
|
774
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span>
|
775
|
+
<span class='ivar'>@key</span>
|
699
776
|
<span class='kw'>end</span></pre>
|
700
777
|
</td>
|
701
778
|
</tr>
|
@@ -745,12 +822,17 @@ class.</p>
|
|
745
822
|
</table>
|
746
823
|
</div>
|
747
824
|
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
<
|
825
|
+
</div>
|
826
|
+
|
827
|
+
|
828
|
+
<div id="instance_method_details" class="method_details_list">
|
829
|
+
<h2>Instance Method Details</h2>
|
830
|
+
|
831
|
+
|
832
|
+
<div class="method_details first">
|
833
|
+
<h3 class="signature first" id="bit_strength-instance_method">
|
752
834
|
|
753
|
-
- (<tt>
|
835
|
+
- (<tt>Integer</tt>) <strong>bit_strength</strong>
|
754
836
|
|
755
837
|
|
756
838
|
|
@@ -759,13 +841,31 @@ class.</p>
|
|
759
841
|
</h3><div class="docstring">
|
760
842
|
<div class="discussion">
|
761
843
|
|
762
|
-
<p>Returns the
|
844
|
+
<p>Returns the bit strength of the key used to create the SPKI</p>
|
763
845
|
|
764
846
|
|
765
847
|
</div>
|
766
848
|
</div>
|
767
849
|
<div class="tags">
|
768
850
|
|
851
|
+
<p class="tag_title">Returns:</p>
|
852
|
+
<ul class="return">
|
853
|
+
|
854
|
+
<li>
|
855
|
+
|
856
|
+
|
857
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
858
|
+
|
859
|
+
|
860
|
+
|
861
|
+
—
|
862
|
+
<div class='inline'>
|
863
|
+
<p>the integer bit strength.</p>
|
864
|
+
</div>
|
865
|
+
|
866
|
+
</li>
|
867
|
+
|
868
|
+
</ul>
|
769
869
|
|
770
870
|
</div><table class="source_code">
|
771
871
|
<tr>
|
@@ -773,32 +873,105 @@ class.</p>
|
|
773
873
|
<pre class="lines">
|
774
874
|
|
775
875
|
|
776
|
-
|
777
|
-
|
778
|
-
|
876
|
+
129
|
877
|
+
130
|
878
|
+
131
|
879
|
+
132
|
880
|
+
133
|
881
|
+
134
|
882
|
+
135
|
883
|
+
136
|
884
|
+
137</pre>
|
779
885
|
</td>
|
780
886
|
<td>
|
781
|
-
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line
|
887
|
+
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 129</span>
|
782
888
|
|
783
|
-
<span class='kw'>def</span> <span class='id identifier
|
784
|
-
<span class='
|
889
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_bit_strength'>bit_strength</span>
|
890
|
+
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_rsa?'>rsa?</span>
|
891
|
+
<span class='kw'>return</span> <span class='ivar'>@spki</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>
|
892
|
+
<span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dsa?'>dsa?</span>
|
893
|
+
<span class='kw'>return</span> <span class='ivar'>@spki</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>
|
894
|
+
<span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ec?'>ec?</span>
|
895
|
+
<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>
|
896
|
+
<span class='kw'>end</span>
|
785
897
|
<span class='kw'>end</span></pre>
|
786
898
|
</td>
|
787
899
|
</tr>
|
788
900
|
</table>
|
789
901
|
</div>
|
790
902
|
|
903
|
+
<div class="method_details ">
|
904
|
+
<h3 class="signature " id="curve_name-instance_method">
|
905
|
+
|
906
|
+
- (<tt>String</tt>) <strong>curve_name</strong>
|
907
|
+
|
908
|
+
|
909
|
+
|
910
|
+
|
911
|
+
|
912
|
+
</h3><div class="docstring">
|
913
|
+
<div class="discussion">
|
914
|
+
|
915
|
+
<p>Returns the short name of the elliptic curve used to generate the public
|
916
|
+
key if the key is EC. If not, raises an error.</p>
|
917
|
+
|
918
|
+
|
791
919
|
</div>
|
920
|
+
</div>
|
921
|
+
<div class="tags">
|
922
|
+
|
923
|
+
<p class="tag_title">Returns:</p>
|
924
|
+
<ul class="return">
|
925
|
+
|
926
|
+
<li>
|
927
|
+
|
928
|
+
|
929
|
+
<span class='type'>(<tt>String</tt>)</span>
|
930
|
+
|
931
|
+
|
932
|
+
|
933
|
+
—
|
934
|
+
<div class='inline'>
|
935
|
+
<p>elliptic curve name</p>
|
936
|
+
</div>
|
937
|
+
|
938
|
+
</li>
|
939
|
+
|
940
|
+
</ul>
|
792
941
|
|
942
|
+
</div><table class="source_code">
|
943
|
+
<tr>
|
944
|
+
<td>
|
945
|
+
<pre class="lines">
|
793
946
|
|
794
|
-
<div id="instance_method_details" class="method_details_list">
|
795
|
-
<h2>Instance Method Details</h2>
|
796
947
|
|
948
|
+
143
|
949
|
+
144
|
950
|
+
145
|
951
|
+
146
|
952
|
+
147
|
953
|
+
148
|
954
|
+
149</pre>
|
955
|
+
</td>
|
956
|
+
<td>
|
957
|
+
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 143</span>
|
958
|
+
|
959
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_curve_name'>curve_name</span>
|
960
|
+
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ec?'>ec?</span>
|
961
|
+
<span class='ivar'>@spki</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>
|
962
|
+
<span class='kw'>else</span>
|
963
|
+
<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 SPKIs</span><span class='tstring_end'>'</span></span>
|
964
|
+
<span class='kw'>end</span>
|
965
|
+
<span class='kw'>end</span></pre>
|
966
|
+
</td>
|
967
|
+
</tr>
|
968
|
+
</table>
|
969
|
+
</div>
|
797
970
|
|
798
|
-
<div class="method_details
|
799
|
-
<h3 class="signature
|
971
|
+
<div class="method_details ">
|
972
|
+
<h3 class="signature " id="dsa?-instance_method">
|
800
973
|
|
801
|
-
- (<tt>
|
974
|
+
- (<tt>Boolean</tt>) <strong>dsa?</strong>
|
802
975
|
|
803
976
|
|
804
977
|
|
@@ -807,7 +980,7 @@ class.</p>
|
|
807
980
|
</h3><div class="docstring">
|
808
981
|
<div class="discussion">
|
809
982
|
|
810
|
-
<p>Returns the
|
983
|
+
<p>Returns whether the public key is DSA</p>
|
811
984
|
|
812
985
|
|
813
986
|
</div>
|
@@ -820,13 +993,13 @@ class.</p>
|
|
820
993
|
<li>
|
821
994
|
|
822
995
|
|
823
|
-
<span class='type'>(<tt>
|
996
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
824
997
|
|
825
998
|
|
826
999
|
|
827
1000
|
—
|
828
1001
|
<div class='inline'>
|
829
|
-
<p>the
|
1002
|
+
<p>true if the public key is DSA, false otherwise</p>
|
830
1003
|
</div>
|
831
1004
|
|
832
1005
|
</li>
|
@@ -839,23 +1012,15 @@ class.</p>
|
|
839
1012
|
<pre class="lines">
|
840
1013
|
|
841
1014
|
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
87
|
846
|
-
88
|
847
|
-
89
|
848
|
-
90</pre>
|
1015
|
+
116
|
1016
|
+
117
|
1017
|
+
118</pre>
|
849
1018
|
</td>
|
850
1019
|
<td>
|
851
|
-
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line
|
1020
|
+
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 116</span>
|
852
1021
|
|
853
|
-
<span class='kw'>def</span> <span class='id identifier
|
854
|
-
|
855
|
-
<span class='kw'>return</span> <span class='ivar'>@spki</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>
|
856
|
-
<span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dsa?'>dsa?</span>
|
857
|
-
<span class='kw'>return</span> <span class='ivar'>@spki</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>
|
858
|
-
<span class='kw'>end</span>
|
1022
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_dsa?'>dsa?</span>
|
1023
|
+
<span class='ivar'>@spki</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>
|
859
1024
|
<span class='kw'>end</span></pre>
|
860
1025
|
</td>
|
861
1026
|
</tr>
|
@@ -863,9 +1028,9 @@ class.</p>
|
|
863
1028
|
</div>
|
864
1029
|
|
865
1030
|
<div class="method_details ">
|
866
|
-
<h3 class="signature " id="
|
1031
|
+
<h3 class="signature " id="ec?-instance_method">
|
867
1032
|
|
868
|
-
- (<tt>Boolean</tt>) <strong>
|
1033
|
+
- (<tt>Boolean</tt>) <strong>ec?</strong>
|
869
1034
|
|
870
1035
|
|
871
1036
|
|
@@ -874,7 +1039,7 @@ class.</p>
|
|
874
1039
|
</h3><div class="docstring">
|
875
1040
|
<div class="discussion">
|
876
1041
|
|
877
|
-
<p>Returns whether the public key is
|
1042
|
+
<p>Returns whether the public key is EC</p>
|
878
1043
|
|
879
1044
|
|
880
1045
|
</div>
|
@@ -893,7 +1058,7 @@ class.</p>
|
|
893
1058
|
|
894
1059
|
—
|
895
1060
|
<div class='inline'>
|
896
|
-
<p>true if the public key is
|
1061
|
+
<p>true if the public key is EC, false otherwise</p>
|
897
1062
|
</div>
|
898
1063
|
|
899
1064
|
</li>
|
@@ -906,15 +1071,15 @@ class.</p>
|
|
906
1071
|
<pre class="lines">
|
907
1072
|
|
908
1073
|
|
909
|
-
|
910
|
-
|
911
|
-
|
1074
|
+
123
|
1075
|
+
124
|
1076
|
+
125</pre>
|
912
1077
|
</td>
|
913
1078
|
<td>
|
914
|
-
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line
|
1079
|
+
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 123</span>
|
915
1080
|
|
916
|
-
<span class='kw'>def</span> <span class='id identifier
|
917
|
-
|
1081
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_ec?'>ec?</span>
|
1082
|
+
<span class='ivar'>@spki</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>
|
918
1083
|
<span class='kw'>end</span></pre>
|
919
1084
|
</td>
|
920
1085
|
</tr>
|
@@ -965,23 +1130,27 @@ class.</p>
|
|
965
1130
|
<pre class="lines">
|
966
1131
|
|
967
1132
|
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
1133
|
+
154
|
1134
|
+
155
|
1135
|
+
156
|
1136
|
+
157
|
1137
|
+
158
|
1138
|
+
159
|
1139
|
+
160
|
1140
|
+
161
|
1141
|
+
162</pre>
|
975
1142
|
</td>
|
976
1143
|
<td>
|
977
|
-
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line
|
1144
|
+
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 154</span>
|
978
1145
|
|
979
1146
|
<span class='kw'>def</span> <span class='id identifier rubyid_key_algorithm'>key_algorithm</span>
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
1147
|
+
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_rsa?'>rsa?</span>
|
1148
|
+
<span class='symbol'>:rsa</span>
|
1149
|
+
<span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dsa?'>dsa?</span>
|
1150
|
+
<span class='symbol'>:dsa</span>
|
1151
|
+
<span class='kw'>elsif</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_ec?'>ec?</span>
|
1152
|
+
<span class='symbol'>:ec</span>
|
1153
|
+
<span class='kw'>end</span>
|
985
1154
|
<span class='kw'>end</span></pre>
|
986
1155
|
</td>
|
987
1156
|
</tr>
|
@@ -1032,15 +1201,15 @@ class.</p>
|
|
1032
1201
|
<pre class="lines">
|
1033
1202
|
|
1034
1203
|
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1204
|
+
64
|
1205
|
+
65
|
1206
|
+
66</pre>
|
1038
1207
|
</td>
|
1039
1208
|
<td>
|
1040
|
-
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line
|
1209
|
+
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 64</span>
|
1041
1210
|
|
1042
1211
|
<span class='kw'>def</span> <span class='id identifier rubyid_public_key'>public_key</span>
|
1043
|
-
|
1212
|
+
<span class='ivar'>@spki</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span>
|
1044
1213
|
<span class='kw'>end</span></pre>
|
1045
1214
|
</td>
|
1046
1215
|
</tr>
|
@@ -1091,15 +1260,15 @@ class.</p>
|
|
1091
1260
|
<pre class="lines">
|
1092
1261
|
|
1093
1262
|
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1263
|
+
109
|
1264
|
+
110
|
1265
|
+
111</pre>
|
1097
1266
|
</td>
|
1098
1267
|
<td>
|
1099
|
-
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line
|
1268
|
+
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 109</span>
|
1100
1269
|
|
1101
1270
|
<span class='kw'>def</span> <span class='id identifier rubyid_rsa?'>rsa?</span>
|
1102
|
-
|
1271
|
+
<span class='ivar'>@spki</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>
|
1103
1272
|
<span class='kw'>end</span></pre>
|
1104
1273
|
</td>
|
1105
1274
|
</tr>
|
@@ -1150,15 +1319,15 @@ class.</p>
|
|
1150
1319
|
<pre class="lines">
|
1151
1320
|
|
1152
1321
|
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1322
|
+
86
|
1323
|
+
87
|
1324
|
+
88</pre>
|
1156
1325
|
</td>
|
1157
1326
|
<td>
|
1158
|
-
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line
|
1327
|
+
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 86</span>
|
1159
1328
|
|
1160
1329
|
<span class='kw'>def</span> <span class='id identifier rubyid_to_der'>to_der</span>
|
1161
|
-
|
1330
|
+
<span class='ivar'>@spki</span><span class='period'>.</span><span class='id identifier rubyid_to_der'>to_der</span>
|
1162
1331
|
<span class='kw'>end</span></pre>
|
1163
1332
|
</td>
|
1164
1333
|
</tr>
|
@@ -1166,20 +1335,22 @@ class.</p>
|
|
1166
1335
|
</div>
|
1167
1336
|
|
1168
1337
|
<div class="method_details ">
|
1169
|
-
<h3 class="signature " id="
|
1338
|
+
<h3 class="signature " id="to_pem-instance_method">
|
1170
1339
|
|
1171
|
-
- (<tt>
|
1340
|
+
- (<tt>String</tt>) <strong>to_pem</strong>
|
1172
1341
|
|
1173
1342
|
|
1174
1343
|
|
1344
|
+
<span class="aliases">Also known as:
|
1345
|
+
<span class="names"><span id='to_s-instance_method'>to_s</span></span>
|
1346
|
+
</span>
|
1347
|
+
|
1175
1348
|
|
1176
1349
|
|
1177
1350
|
</h3><div class="docstring">
|
1178
1351
|
<div class="discussion">
|
1179
1352
|
|
1180
|
-
<p>
|
1181
|
-
method if you intend to alter the values and then pass them to the Ca
|
1182
|
-
class.</p>
|
1353
|
+
<p>Converts the SPKI into the PEM format</p>
|
1183
1354
|
|
1184
1355
|
|
1185
1356
|
</div>
|
@@ -1192,13 +1363,13 @@ class.</p>
|
|
1192
1363
|
<li>
|
1193
1364
|
|
1194
1365
|
|
1195
|
-
<span class='type'>(<tt>
|
1366
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1196
1367
|
|
1197
1368
|
|
1198
1369
|
|
1199
1370
|
—
|
1200
1371
|
<div class='inline'>
|
1201
|
-
<p
|
1372
|
+
<p>the SPKI converted into PEM format.</p>
|
1202
1373
|
</div>
|
1203
1374
|
|
1204
1375
|
</li>
|
@@ -1211,15 +1382,15 @@ class.</p>
|
|
1211
1382
|
<pre class="lines">
|
1212
1383
|
|
1213
1384
|
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1385
|
+
77
|
1386
|
+
78
|
1387
|
+
79</pre>
|
1217
1388
|
</td>
|
1218
1389
|
<td>
|
1219
|
-
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line
|
1390
|
+
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 77</span>
|
1220
1391
|
|
1221
|
-
<span class='kw'>def</span> <span class='id identifier
|
1222
|
-
|
1392
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_pem'>to_pem</span>
|
1393
|
+
<span class='ivar'>@spki</span><span class='period'>.</span><span class='id identifier rubyid_to_pem'>to_pem</span>
|
1223
1394
|
<span class='kw'>end</span></pre>
|
1224
1395
|
</td>
|
1225
1396
|
</tr>
|
@@ -1227,22 +1398,18 @@ class.</p>
|
|
1227
1398
|
</div>
|
1228
1399
|
|
1229
1400
|
<div class="method_details ">
|
1230
|
-
<h3 class="signature " id="
|
1401
|
+
<h3 class="signature " id="verify_signature-instance_method">
|
1231
1402
|
|
1232
|
-
- (<tt>
|
1403
|
+
- (<tt>Boolean</tt>) <strong>verify_signature</strong>
|
1233
1404
|
|
1234
1405
|
|
1235
1406
|
|
1236
|
-
<span class="aliases">Also known as:
|
1237
|
-
<span class="names"><span id='to_s-instance_method'>to_s</span></span>
|
1238
|
-
</span>
|
1239
|
-
|
1240
1407
|
|
1241
1408
|
|
1242
1409
|
</h3><div class="docstring">
|
1243
1410
|
<div class="discussion">
|
1244
1411
|
|
1245
|
-
<p>
|
1412
|
+
<p>Verifies the integrity of the signature on the SPKI</p>
|
1246
1413
|
|
1247
1414
|
|
1248
1415
|
</div>
|
@@ -1255,15 +1422,10 @@ class.</p>
|
|
1255
1422
|
<li>
|
1256
1423
|
|
1257
1424
|
|
1258
|
-
<span class='type'>(<tt>
|
1425
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1259
1426
|
|
1260
1427
|
|
1261
1428
|
|
1262
|
-
—
|
1263
|
-
<div class='inline'>
|
1264
|
-
<p>the SPKI converted into PEM format.</p>
|
1265
|
-
</div>
|
1266
|
-
|
1267
1429
|
</li>
|
1268
1430
|
|
1269
1431
|
</ul>
|
@@ -1274,15 +1436,15 @@ class.</p>
|
|
1274
1436
|
<pre class="lines">
|
1275
1437
|
|
1276
1438
|
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1439
|
+
70
|
1440
|
+
71
|
1441
|
+
72</pre>
|
1280
1442
|
</td>
|
1281
1443
|
<td>
|
1282
|
-
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line
|
1444
|
+
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 70</span>
|
1283
1445
|
|
1284
|
-
<span class='kw'>def</span> <span class='id identifier
|
1285
|
-
|
1446
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_verify_signature'>verify_signature</span>
|
1447
|
+
<span class='ivar'>@spki</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>
|
1286
1448
|
<span class='kw'>end</span></pre>
|
1287
1449
|
</td>
|
1288
1450
|
</tr>
|
@@ -1336,15 +1498,15 @@ IO-like object.</p>
|
|
1336
1498
|
<pre class="lines">
|
1337
1499
|
|
1338
1500
|
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1501
|
+
102
|
1502
|
+
103
|
1503
|
+
104</pre>
|
1342
1504
|
</td>
|
1343
1505
|
<td>
|
1344
|
-
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line
|
1506
|
+
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 102</span>
|
1345
1507
|
|
1346
1508
|
<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>
|
1347
|
-
|
1509
|
+
<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'>@spki</span><span class='period'>.</span><span class='id identifier rubyid_to_der'>to_der</span><span class='rparen'>)</span>
|
1348
1510
|
<span class='kw'>end</span></pre>
|
1349
1511
|
</td>
|
1350
1512
|
</tr>
|
@@ -1398,15 +1560,15 @@ IO-like object.</p>
|
|
1398
1560
|
<pre class="lines">
|
1399
1561
|
|
1400
1562
|
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1563
|
+
94
|
1564
|
+
95
|
1565
|
+
96</pre>
|
1404
1566
|
</td>
|
1405
1567
|
<td>
|
1406
|
-
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line
|
1568
|
+
<pre class="code"><span class="info file"># File 'lib/r509/spki.rb', line 94</span>
|
1407
1569
|
|
1408
1570
|
<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>
|
1409
|
-
|
1571
|
+
<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'>@spki</span><span class='period'>.</span><span class='id identifier rubyid_to_pem'>to_pem</span><span class='rparen'>)</span>
|
1410
1572
|
<span class='kw'>end</span></pre>
|
1411
1573
|
</td>
|
1412
1574
|
</tr>
|
@@ -1418,9 +1580,9 @@ IO-like object.</p>
|
|
1418
1580
|
</div>
|
1419
1581
|
|
1420
1582
|
<div id="footer">
|
1421
|
-
Generated on
|
1583
|
+
Generated on Tue Apr 16 10:49:56 2013 by
|
1422
1584
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1423
|
-
0.8.
|
1585
|
+
0.8.5 (ruby-1.9.3).
|
1424
1586
|
</div>
|
1425
1587
|
|
1426
1588
|
</body>
|