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
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: R509::Cert::Extensions::SubjectKeyIdentifier
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -119,7 +119,18 @@ provide access to the components and meaning of the extension's contents.</p>
|
|
119
119
|
<dl class="constants">
|
120
120
|
|
121
121
|
<dt id="OID-constant" class="">OID =
|
122
|
-
|
122
|
+
<div class="docstring">
|
123
|
+
<div class="discussion">
|
124
|
+
|
125
|
+
<p>friendly name for Subject Key Identifier OID</p>
|
126
|
+
|
127
|
+
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
<div class="tags">
|
131
|
+
|
132
|
+
|
133
|
+
</div>
|
123
134
|
</dt>
|
124
135
|
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>subjectKeyIdentifier</span><span class='tstring_end'>"</span></span></pre></dd>
|
125
136
|
|
@@ -157,7 +168,9 @@ provide access to the components and meaning of the extension's contents.</p>
|
|
157
168
|
|
158
169
|
|
159
170
|
|
160
|
-
<span class="summary_desc"><div class='inline'
|
171
|
+
<span class="summary_desc"><div class='inline'>
|
172
|
+
<p>Value of key.</p>
|
173
|
+
</div></span>
|
161
174
|
|
162
175
|
</li>
|
163
176
|
|
@@ -181,18 +194,47 @@ provide access to the components and meaning of the extension's contents.</p>
|
|
181
194
|
|
182
195
|
|
183
196
|
|
184
|
-
</h3><
|
197
|
+
</h3><div class="docstring">
|
198
|
+
<div class="discussion">
|
199
|
+
|
200
|
+
<p>Value of key</p>
|
201
|
+
|
202
|
+
|
203
|
+
</div>
|
204
|
+
</div>
|
205
|
+
<div class="tags">
|
206
|
+
|
207
|
+
<p class="tag_title">Returns:</p>
|
208
|
+
<ul class="return">
|
209
|
+
|
210
|
+
<li>
|
211
|
+
|
212
|
+
|
213
|
+
<span class='type'></span>
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
<div class='inline'>
|
219
|
+
<p>value of key</p>
|
220
|
+
</div>
|
221
|
+
|
222
|
+
</li>
|
223
|
+
|
224
|
+
</ul>
|
225
|
+
|
226
|
+
</div><table class="source_code">
|
185
227
|
<tr>
|
186
228
|
<td>
|
187
229
|
<pre class="lines">
|
188
230
|
|
189
231
|
|
190
|
-
|
191
|
-
|
192
|
-
|
232
|
+
333
|
233
|
+
334
|
234
|
+
335</pre>
|
193
235
|
</td>
|
194
236
|
<td>
|
195
|
-
<pre class="code"><span class="info file"># File 'lib/r509/cert/extensions.rb', line
|
237
|
+
<pre class="code"><span class="info file"># File 'lib/r509/cert/extensions.rb', line 333</span>
|
196
238
|
|
197
239
|
<span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
198
240
|
<span class='kw'>return</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span>
|
@@ -207,9 +249,9 @@ provide access to the components and meaning of the extension's contents.</p>
|
|
207
249
|
</div>
|
208
250
|
|
209
251
|
<div id="footer">
|
210
|
-
Generated on
|
252
|
+
Generated on Tue Apr 16 10:49:58 2013 by
|
211
253
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
212
|
-
0.8.
|
254
|
+
0.8.5 (ruby-1.9.3).
|
213
255
|
</div>
|
214
256
|
|
215
257
|
</body>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: R509::CertificateAuthority
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -79,7 +79,7 @@
|
|
79
79
|
|
80
80
|
|
81
81
|
<dt class="r1 last">Defined in:</dt>
|
82
|
-
<dd class="r1 last">lib/r509/
|
82
|
+
<dd class="r1 last">lib/r509/certificate_authority.rb</dd>
|
83
83
|
|
84
84
|
</dl>
|
85
85
|
<div class="clear"></div>
|
@@ -117,9 +117,9 @@
|
|
117
117
|
</div>
|
118
118
|
|
119
119
|
<div id="footer">
|
120
|
-
Generated on
|
120
|
+
Generated on Tue Apr 16 10:49:55 2013 by
|
121
121
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
122
|
-
0.8.
|
122
|
+
0.8.5 (ruby-1.9.3).
|
123
123
|
</div>
|
124
124
|
|
125
125
|
</body>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: R509::CertificateAuthority::Signer
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8.
|
9
|
+
— Documentation by YARD 0.8.5
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
|
96
96
|
<dt class="r2 last">Defined in:</dt>
|
97
|
-
<dd class="r2 last">lib/r509/
|
97
|
+
<dd class="r2 last">lib/r509/certificate_authority.rb</dd>
|
98
98
|
|
99
99
|
</dl>
|
100
100
|
<div class="clear"></div>
|
@@ -248,7 +248,6 @@
|
|
248
248
|
<pre class="lines">
|
249
249
|
|
250
250
|
|
251
|
-
11
|
252
251
|
12
|
253
252
|
13
|
254
253
|
14
|
@@ -257,20 +256,21 @@
|
|
257
256
|
17
|
258
257
|
18
|
259
258
|
19
|
260
|
-
20
|
259
|
+
20
|
260
|
+
21</pre>
|
261
261
|
</td>
|
262
262
|
<td>
|
263
|
-
<pre class="code"><span class="info file"># File 'lib/r509/
|
263
|
+
<pre class="code"><span class="info file"># File 'lib/r509/certificate_authority.rb', line 12</span>
|
264
264
|
|
265
265
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
266
|
+
<span class='ivar'>@config</span> <span class='op'>=</span> <span class='id identifier rubyid_config'>config</span>
|
267
|
+
|
268
|
+
<span class='kw'>if</span> <span class='kw'>not</span> <span class='ivar'>@config</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'>@config</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'>Config</span><span class='op'>::</span><span class='const'>CAConfig</span><span class='rparen'>)</span>
|
269
|
+
<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'>config must be a kind of R509::Config::CAConfig or nil (for self-sign only)</span><span class='tstring_end'>"</span></span>
|
270
|
+
<span class='kw'>end</span>
|
271
|
+
<span class='kw'>if</span> <span class='kw'>not</span> <span class='ivar'>@config</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'>@config</span><span class='period'>.</span><span class='id identifier rubyid_ca_cert'>ca_cert</span><span class='period'>.</span><span class='id identifier rubyid_has_private_key?'>has_private_key?</span>
|
272
|
+
<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'>You must have a private key associated with your CA certificate to issue</span><span class='tstring_end'>"</span></span>
|
273
|
+
<span class='kw'>end</span>
|
274
274
|
<span class='kw'>end</span></pre>
|
275
275
|
</td>
|
276
276
|
</tr>
|
@@ -331,7 +331,7 @@
|
|
331
331
|
|
332
332
|
<li>
|
333
333
|
<span class="name">:csr</span>
|
334
|
-
<span class="type">(<tt><span class='object_link'><a href="../
|
334
|
+
<span class="type">(<tt><span class='object_link'><a href="../CSR.html" title="R509::CSR (class)">R509::CSR</a></span></tt>)</span>
|
335
335
|
<span class="default">
|
336
336
|
|
337
337
|
</span>
|
@@ -393,13 +393,14 @@ random)</p>
|
|
393
393
|
|
394
394
|
<li>
|
395
395
|
<span class="name">:san_names</span>
|
396
|
-
<span class="type">(<tt>Array</tt>)</span>
|
396
|
+
<span class="type">(<tt>Array</tt>, <tt><span class='object_link'><a href="../ASN1/GeneralNames.html" title="R509::ASN1::GeneralNames (class)">R509::ASN1::GeneralNames</a></span></tt>)</span>
|
397
397
|
<span class="default">
|
398
398
|
|
399
399
|
</span>
|
400
400
|
|
401
401
|
— <div class='inline'>
|
402
|
-
<p>
|
402
|
+
<p>optional either an array of names that will be automatically parsed to
|
403
|
+
determine their type, or an explicit R509::ASN1::GeneralNames object</p>
|
403
404
|
</div>
|
404
405
|
|
405
406
|
</li>
|
@@ -432,6 +433,24 @@ random)</p>
|
|
432
433
|
<pre class="lines">
|
433
434
|
|
434
435
|
|
436
|
+
103
|
437
|
+
104
|
438
|
+
105
|
439
|
+
106
|
440
|
+
107
|
441
|
+
108
|
442
|
+
109
|
443
|
+
110
|
444
|
+
111
|
445
|
+
112
|
446
|
+
113
|
447
|
+
114
|
448
|
+
115
|
449
|
+
116
|
450
|
+
117
|
451
|
+
118
|
452
|
+
119
|
453
|
+
120
|
435
454
|
121
|
436
455
|
122
|
437
456
|
123
|
@@ -451,72 +470,48 @@ random)</p>
|
|
451
470
|
137
|
452
471
|
138
|
453
472
|
139
|
454
|
-
140
|
455
|
-
141
|
456
|
-
142
|
457
|
-
143
|
458
|
-
144
|
459
|
-
145
|
460
|
-
146
|
461
|
-
147
|
462
|
-
148
|
463
|
-
149
|
464
|
-
150
|
465
|
-
151
|
466
|
-
152
|
467
|
-
153
|
468
|
-
154
|
469
|
-
155
|
470
|
-
156
|
471
|
-
157
|
472
|
-
158
|
473
|
-
159
|
474
|
-
160
|
475
|
-
161</pre>
|
473
|
+
140</pre>
|
476
474
|
</td>
|
477
475
|
<td>
|
478
|
-
<pre class="code"><span class="info file"># File 'lib/r509/
|
476
|
+
<pre class="code"><span class="info file"># File 'lib/r509/certificate_authority.rb', line 103</span>
|
479
477
|
|
480
478
|
<span class='kw'>def</span> <span class='id identifier rubyid_selfsign'>selfsign</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
<span class='
|
502
|
-
|
503
|
-
<span class='
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
<span class='
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
<span class='comment'># Csr#key returns R509::PrivateKey and #key on that returns OpenSSL object we need
|
518
|
-
</span> <span class='id identifier rubyid_cert'>cert</span><span class='period'>.</span><span class='id identifier rubyid_sign'>sign</span><span class='lparen'>(</span> <span class='id identifier rubyid_csr'>csr</span><span class='period'>.</span><span class='id identifier rubyid_key'>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>
|
519
|
-
<span class='const'>R509</span><span class='op'>::</span><span class='const'>Cert</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:cert</span> <span class='op'>=></span> <span class='id identifier rubyid_cert'>cert</span><span class='rparen'>)</span>
|
479
|
+
<span class='kw'>if</span> <span class='kw'>not</span> <span class='id identifier rubyid_options'>options</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>
|
480
|
+
<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 must pass a hash of options consisting of at minimum :csr</span><span class='tstring_end'>"</span></span>
|
481
|
+
<span class='kw'>end</span>
|
482
|
+
<span class='id identifier rubyid_csr'>csr</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:csr</span><span class='rbracket'>]</span>
|
483
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_csr'>csr</span><span class='period'>.</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
484
|
+
<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'>CSR must also have a private key to self sign</span><span class='tstring_end'>'</span></span>
|
485
|
+
<span class='kw'>end</span>
|
486
|
+
<span class='id identifier rubyid_cert'>cert</span> <span class='op'>=</span> <span class='id identifier rubyid_build_cert'>build_cert</span><span class='lparen'>(</span>
|
487
|
+
<span class='symbol'>:subject</span> <span class='op'>=></span> <span class='id identifier rubyid_csr'>csr</span><span class='period'>.</span><span class='id identifier rubyid_subject'>subject</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
|
488
|
+
<span class='symbol'>:issuer</span> <span class='op'>=></span> <span class='id identifier rubyid_csr'>csr</span><span class='period'>.</span><span class='id identifier rubyid_subject'>subject</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
|
489
|
+
<span class='symbol'>:not_before</span> <span class='op'>=></span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:not_before</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
490
|
+
<span class='symbol'>:not_after</span> <span class='op'>=></span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:not_after</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
491
|
+
<span class='symbol'>:public_key</span> <span class='op'>=></span> <span class='id identifier rubyid_csr'>csr</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='comma'>,</span>
|
492
|
+
<span class='symbol'>:serial</span> <span class='op'>=></span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:serial</span><span class='rbracket'>]</span>
|
493
|
+
<span class='rparen'>)</span>
|
494
|
+
|
495
|
+
<span class='id identifier rubyid_sans'>sans</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:san_names</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='op'>?</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:san_names</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='id identifier rubyid_csr'>csr</span><span class='period'>.</span><span class='id identifier rubyid_san'>san</span>
|
496
|
+
<span class='id identifier rubyid_san_names'>san_names</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_san_names'>parse_san_names</span><span class='lparen'>(</span><span class='id identifier rubyid_sans'>sans</span><span class='rparen'>)</span>
|
497
|
+
|
498
|
+
<span class='id identifier rubyid_build_extensions'>build_extensions</span><span class='lparen'>(</span>
|
499
|
+
<span class='symbol'>:subject_certificate</span> <span class='op'>=></span> <span class='id identifier rubyid_cert'>cert</span><span class='comma'>,</span>
|
500
|
+
<span class='symbol'>:issuer_certificate</span> <span class='op'>=></span> <span class='id identifier rubyid_cert'>cert</span><span class='comma'>,</span>
|
501
|
+
<span class='symbol'>:basic_constraints</span> <span class='op'>=></span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ca</span><span class='tstring_end'>"</span></span> <span class='op'>=></span> <span class='kw'>true</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
502
|
+
<span class='symbol'>:san_names</span> <span class='op'>=></span> <span class='id identifier rubyid_san_names'>san_names</span>
|
503
|
+
<span class='rparen'>)</span>
|
504
|
+
|
505
|
+
|
506
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_options'>options</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>
|
507
|
+
<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_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:message_digest</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
508
|
+
<span class='kw'>else</span>
|
509
|
+
<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>
|
510
|
+
<span class='kw'>end</span>
|
511
|
+
|
512
|
+
<span class='comment'># CSR#key returns R509::PrivateKey and #key on that returns OpenSSL object we need
|
513
|
+
</span> <span class='id identifier rubyid_cert'>cert</span><span class='period'>.</span><span class='id identifier rubyid_sign'>sign</span><span class='lparen'>(</span> <span class='id identifier rubyid_csr'>csr</span><span class='period'>.</span><span class='id identifier rubyid_key'>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>
|
514
|
+
<span class='const'>R509</span><span class='op'>::</span><span class='const'>Cert</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:cert</span> <span class='op'>=></span> <span class='id identifier rubyid_cert'>cert</span><span class='rparen'>)</span>
|
520
515
|
<span class='kw'>end</span></pre>
|
521
516
|
</td>
|
522
517
|
</tr>
|
@@ -570,7 +565,7 @@ random)</p>
|
|
570
565
|
|
571
566
|
<li>
|
572
567
|
<span class="name">:csr</span>
|
573
|
-
<span class="type">(<tt><span class='object_link'><a href="../
|
568
|
+
<span class="type">(<tt><span class='object_link'><a href="../CSR.html" title="R509::CSR (class)">R509::CSR</a></span></tt>)</span>
|
574
569
|
<span class="default">
|
575
570
|
|
576
571
|
</span>
|
@@ -579,7 +574,7 @@ random)</p>
|
|
579
574
|
|
580
575
|
<li>
|
581
576
|
<span class="name">:spki</span>
|
582
|
-
<span class="type">(<tt><span class='object_link'><a href="../
|
577
|
+
<span class="type">(<tt><span class='object_link'><a href="../SPKI.html" title="R509::SPKI (class)">R509::SPKI</a></span></tt>)</span>
|
583
578
|
<span class="default">
|
584
579
|
|
585
580
|
</span>
|
@@ -594,21 +589,33 @@ random)</p>
|
|
594
589
|
</span>
|
595
590
|
|
596
591
|
— <div class='inline'>
|
597
|
-
<p>The CA profile you want to use (eg "server in your config)</p>
|
592
|
+
<p>The CA profile you want to use (eg "server" in your config)</p>
|
598
593
|
</div>
|
599
594
|
|
600
595
|
</li>
|
601
596
|
|
602
597
|
<li>
|
603
|
-
<span class="name">:
|
604
|
-
<span class="type">(<tt>
|
598
|
+
<span class="name">:subject</span>
|
599
|
+
<span class="type">(<tt><span class='object_link'><a href="../Subject.html" title="R509::Subject (class)">R509::Subject</a></span></tt>, <tt>OpenSSL::X509::Subject</tt>, <tt>Array</tt>)</span>
|
600
|
+
<span class="default">
|
601
|
+
|
602
|
+
— default:
|
603
|
+
<tt>optional for R509::CSR</tt>, <tt>required for R509::SPKI</tt>
|
604
|
+
|
605
|
+
</span>
|
606
|
+
|
607
|
+
</li>
|
608
|
+
|
609
|
+
<li>
|
610
|
+
<span class="name">:san_names</span>
|
611
|
+
<span class="type">(<tt>Array</tt>, <tt><span class='object_link'><a href="../ASN1/GeneralNames.html" title="R509::ASN1::GeneralNames (class)">R509::ASN1::GeneralNames</a></span></tt>)</span>
|
605
612
|
<span class="default">
|
606
613
|
|
607
614
|
</span>
|
608
615
|
|
609
616
|
— <div class='inline'>
|
610
|
-
<p>
|
611
|
-
|
617
|
+
<p>optional either an array of names that will be automatically parsed to
|
618
|
+
determine their type, or an explicit R509::ASN1::GeneralNames object</p>
|
612
619
|
</div>
|
613
620
|
|
614
621
|
</li>
|
@@ -694,8 +701,6 @@ default</p>
|
|
694
701
|
<pre class="lines">
|
695
702
|
|
696
703
|
|
697
|
-
32
|
698
|
-
33
|
699
704
|
34
|
700
705
|
35
|
701
706
|
36
|
@@ -755,108 +760,70 @@ default</p>
|
|
755
760
|
90
|
756
761
|
91
|
757
762
|
92
|
758
|
-
93
|
759
|
-
94
|
760
|
-
95
|
761
|
-
96
|
762
|
-
97
|
763
|
-
98
|
764
|
-
99
|
765
|
-
100
|
766
|
-
101
|
767
|
-
102
|
768
|
-
103
|
769
|
-
104
|
770
|
-
105
|
771
|
-
106
|
772
|
-
107
|
773
|
-
108
|
774
|
-
109
|
775
|
-
110
|
776
|
-
111</pre>
|
763
|
+
93</pre>
|
777
764
|
</td>
|
778
765
|
<td>
|
779
|
-
<pre class="code"><span class="info file"># File 'lib/r509/
|
766
|
+
<pre class="code"><span class="info file"># File 'lib/r509/certificate_authority.rb', line 34</span>
|
780
767
|
|
781
768
|
<span class='kw'>def</span> <span class='id identifier rubyid_sign'>sign</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
<span class='
|
810
|
-
|
811
|
-
|
812
|
-
<span class='
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
<span class='
|
824
|
-
|
825
|
-
<span class='
|
826
|
-
|
827
|
-
<span class='
|
828
|
-
|
829
|
-
<span class='
|
830
|
-
|
831
|
-
<span class='
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
<span class='id identifier rubyid_basic_constraints'>basic_constraints</span> <span class='op'>=</span> <span class='id identifier rubyid_profile'>profile</span><span class='period'>.</span><span class='id identifier rubyid_basic_constraints'>basic_constraints</span>
|
841
|
-
<span class='id identifier rubyid_key_usage'>key_usage</span> <span class='op'>=</span> <span class='id identifier rubyid_profile'>profile</span><span class='period'>.</span><span class='id identifier rubyid_key_usage'>key_usage</span>
|
842
|
-
<span class='id identifier rubyid_extended_key_usage'>extended_key_usage</span> <span class='op'>=</span> <span class='id identifier rubyid_profile'>profile</span><span class='period'>.</span><span class='id identifier rubyid_extended_key_usage'>extended_key_usage</span>
|
843
|
-
<span class='id identifier rubyid_certificate_policies'>certificate_policies</span> <span class='op'>=</span> <span class='id identifier rubyid_profile'>profile</span><span class='period'>.</span><span class='id identifier rubyid_certificate_policies'>certificate_policies</span>
|
844
|
-
|
845
|
-
<span class='id identifier rubyid_build_extensions'>build_extensions</span><span class='lparen'>(</span>
|
846
|
-
<span class='symbol'>:subject_certificate</span> <span class='op'>=></span> <span class='id identifier rubyid_cert'>cert</span><span class='comma'>,</span>
|
847
|
-
<span class='symbol'>:issuer_certificate</span> <span class='op'>=></span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_ca_cert'>ca_cert</span><span class='period'>.</span><span class='id identifier rubyid_cert'>cert</span><span class='comma'>,</span>
|
848
|
-
<span class='symbol'>:basic_constraints</span> <span class='op'>=></span> <span class='id identifier rubyid_basic_constraints'>basic_constraints</span><span class='comma'>,</span>
|
849
|
-
<span class='symbol'>:key_usage</span> <span class='op'>=></span> <span class='id identifier rubyid_key_usage'>key_usage</span><span class='comma'>,</span>
|
850
|
-
<span class='symbol'>:extended_key_usage</span> <span class='op'>=></span> <span class='id identifier rubyid_extended_key_usage'>extended_key_usage</span><span class='comma'>,</span>
|
851
|
-
<span class='symbol'>:certificate_policies</span> <span class='op'>=></span> <span class='id identifier rubyid_certificate_policies'>certificate_policies</span><span class='comma'>,</span>
|
852
|
-
<span class='symbol'>:san_names</span> <span class='op'>=></span> <span class='id identifier rubyid_san_names'>san_names</span>
|
853
|
-
<span class='rparen'>)</span>
|
854
|
-
|
855
|
-
|
856
|
-
<span class='comment'>#@config.ca_cert.key.key ... ugly. ca_cert returns R509::Cert
|
857
|
-
</span> <span class='comment'># #key returns R509::PrivateKey and #key on that returns OpenSSL object we need
|
858
|
-
</span> <span class='id identifier rubyid_cert'>cert</span><span class='period'>.</span><span class='id identifier rubyid_sign'>sign</span><span class='lparen'>(</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_ca_cert'>ca_cert</span><span class='period'>.</span><span class='id identifier rubyid_key'>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>
|
859
|
-
<span class='const'>R509</span><span class='op'>::</span><span class='const'>Cert</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:cert</span> <span class='op'>=></span> <span class='id identifier rubyid_cert'>cert</span><span class='rparen'>)</span>
|
769
|
+
<span class='kw'>if</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
770
|
+
<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'>When instantiating the signer without a config you can only call #selfsign</span><span class='tstring_end'>"</span></span>
|
771
|
+
<span class='kw'>elsif</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_num_profiles'>num_profiles</span> <span class='op'>==</span> <span class='int'>0</span>
|
772
|
+
<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'>You must have at least one CAProfile on your CAConfig to issue</span><span class='tstring_end'>"</span></span>
|
773
|
+
<span class='kw'>end</span>
|
774
|
+
|
775
|
+
<span class='id identifier rubyid_check_options'>check_options</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
776
|
+
|
777
|
+
<span class='id identifier rubyid_subject'>subject</span><span class='comma'>,</span> <span class='id identifier rubyid_san_names'>san_names</span><span class='comma'>,</span> <span class='id identifier rubyid_public_key'>public_key</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_public_key_subject_san'>extract_public_key_subject_san</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
778
|
+
|
779
|
+
|
780
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:csr</span><span class='rparen'>)</span> <span class='kw'>and</span> <span class='kw'>not</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:csr</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_verify_signature'>verify_signature</span>
|
781
|
+
<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'>Certificate request signature is invalid.</span><span class='tstring_end'>"</span></span>
|
782
|
+
<span class='kw'>end</span>
|
783
|
+
|
784
|
+
<span class='comment'># prior to OpenSSL 1.0 DSA could only use DSS1 (aka SHA1) signatures. post-1.0 anything
|
785
|
+
</span> <span class='comment'># goes but at the moment we don't enforce this restriction so an OpenSSL error could
|
786
|
+
</span> <span class='comment'># bubble up if they do it wrong.
|
787
|
+
</span> <span class='id identifier rubyid_message_digest'>message_digest</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_options'>options</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><span class='rparen'>)</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_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:message_digest</span><span class='rbracket'>]</span><span class='rparen'>)</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='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_message_digest'>message_digest</span><span class='rparen'>)</span>
|
788
|
+
|
789
|
+
<span class='id identifier rubyid_profile'>profile</span> <span class='op'>=</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_profile'>profile</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:profile_name</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
790
|
+
|
791
|
+
<span class='id identifier rubyid_validated_subject'>validated_subject</span> <span class='op'>=</span> <span class='id identifier rubyid_validate_subject'>validate_subject</span><span class='lparen'>(</span><span class='id identifier rubyid_subject'>subject</span><span class='comma'>,</span><span class='id identifier rubyid_profile'>profile</span><span class='rparen'>)</span>
|
792
|
+
|
793
|
+
<span class='id identifier rubyid_cert'>cert</span> <span class='op'>=</span> <span class='id identifier rubyid_build_cert'>build_cert</span><span class='lparen'>(</span>
|
794
|
+
<span class='symbol'>:subject</span> <span class='op'>=></span> <span class='id identifier rubyid_validated_subject'>validated_subject</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
|
795
|
+
<span class='symbol'>:issuer</span> <span class='op'>=></span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_ca_cert'>ca_cert</span><span class='period'>.</span><span class='id identifier rubyid_subject'>subject</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
|
796
|
+
<span class='symbol'>:not_before</span> <span class='op'>=></span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:not_before</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
797
|
+
<span class='symbol'>:not_after</span> <span class='op'>=></span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:not_after</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
798
|
+
<span class='symbol'>:public_key</span> <span class='op'>=></span> <span class='id identifier rubyid_public_key'>public_key</span><span class='comma'>,</span>
|
799
|
+
<span class='symbol'>:serial</span> <span class='op'>=></span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:serial</span><span class='rbracket'>]</span>
|
800
|
+
<span class='rparen'>)</span>
|
801
|
+
|
802
|
+
<span class='id identifier rubyid_basic_constraints'>basic_constraints</span> <span class='op'>=</span> <span class='id identifier rubyid_profile'>profile</span><span class='period'>.</span><span class='id identifier rubyid_basic_constraints'>basic_constraints</span>
|
803
|
+
<span class='id identifier rubyid_key_usage'>key_usage</span> <span class='op'>=</span> <span class='id identifier rubyid_profile'>profile</span><span class='period'>.</span><span class='id identifier rubyid_key_usage'>key_usage</span>
|
804
|
+
<span class='id identifier rubyid_extended_key_usage'>extended_key_usage</span> <span class='op'>=</span> <span class='id identifier rubyid_profile'>profile</span><span class='period'>.</span><span class='id identifier rubyid_extended_key_usage'>extended_key_usage</span>
|
805
|
+
<span class='id identifier rubyid_certificate_policies'>certificate_policies</span> <span class='op'>=</span> <span class='id identifier rubyid_profile'>profile</span><span class='period'>.</span><span class='id identifier rubyid_certificate_policies'>certificate_policies</span>
|
806
|
+
<span class='id identifier rubyid_ocsp_no_check'>ocsp_no_check</span> <span class='op'>=</span> <span class='id identifier rubyid_profile'>profile</span><span class='period'>.</span><span class='id identifier rubyid_ocsp_no_check'>ocsp_no_check</span>
|
807
|
+
|
808
|
+
<span class='id identifier rubyid_build_extensions'>build_extensions</span><span class='lparen'>(</span>
|
809
|
+
<span class='symbol'>:subject_certificate</span> <span class='op'>=></span> <span class='id identifier rubyid_cert'>cert</span><span class='comma'>,</span>
|
810
|
+
<span class='symbol'>:issuer_certificate</span> <span class='op'>=></span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_ca_cert'>ca_cert</span><span class='period'>.</span><span class='id identifier rubyid_cert'>cert</span><span class='comma'>,</span>
|
811
|
+
<span class='symbol'>:basic_constraints</span> <span class='op'>=></span> <span class='id identifier rubyid_basic_constraints'>basic_constraints</span><span class='comma'>,</span>
|
812
|
+
<span class='symbol'>:key_usage</span> <span class='op'>=></span> <span class='id identifier rubyid_key_usage'>key_usage</span><span class='comma'>,</span>
|
813
|
+
<span class='symbol'>:extended_key_usage</span> <span class='op'>=></span> <span class='id identifier rubyid_extended_key_usage'>extended_key_usage</span><span class='comma'>,</span>
|
814
|
+
<span class='symbol'>:ocsp_no_check</span> <span class='op'>=></span> <span class='id identifier rubyid_ocsp_no_check'>ocsp_no_check</span><span class='comma'>,</span>
|
815
|
+
<span class='symbol'>:certificate_policies</span> <span class='op'>=></span> <span class='id identifier rubyid_certificate_policies'>certificate_policies</span><span class='comma'>,</span>
|
816
|
+
<span class='symbol'>:san_names</span> <span class='op'>=></span> <span class='id identifier rubyid_san_names'>san_names</span><span class='comma'>,</span>
|
817
|
+
<span class='symbol'>:inhibit_any_policy</span> <span class='op'>=></span> <span class='id identifier rubyid_profile'>profile</span><span class='period'>.</span><span class='id identifier rubyid_inhibit_any_policy'>inhibit_any_policy</span><span class='comma'>,</span>
|
818
|
+
<span class='symbol'>:policy_constraints</span> <span class='op'>=></span> <span class='id identifier rubyid_profile'>profile</span><span class='period'>.</span><span class='id identifier rubyid_policy_constraints'>policy_constraints</span><span class='comma'>,</span>
|
819
|
+
<span class='symbol'>:name_constraints</span> <span class='op'>=></span> <span class='id identifier rubyid_profile'>profile</span><span class='period'>.</span><span class='id identifier rubyid_name_constraints'>name_constraints</span>
|
820
|
+
<span class='rparen'>)</span>
|
821
|
+
|
822
|
+
|
823
|
+
<span class='comment'>#@config.ca_cert.key.key ... ugly. ca_cert returns R509::Cert
|
824
|
+
</span> <span class='comment'># #key returns R509::PrivateKey and #key on that returns OpenSSL object we need
|
825
|
+
</span> <span class='id identifier rubyid_cert'>cert</span><span class='period'>.</span><span class='id identifier rubyid_sign'>sign</span><span class='lparen'>(</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_ca_cert'>ca_cert</span><span class='period'>.</span><span class='id identifier rubyid_key'>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>
|
826
|
+
<span class='const'>R509</span><span class='op'>::</span><span class='const'>Cert</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:cert</span> <span class='op'>=></span> <span class='id identifier rubyid_cert'>cert</span><span class='rparen'>)</span>
|
860
827
|
<span class='kw'>end</span></pre>
|
861
828
|
</td>
|
862
829
|
</tr>
|
@@ -868,9 +835,9 @@ default</p>
|
|
868
835
|
</div>
|
869
836
|
|
870
837
|
<div id="footer">
|
871
|
-
Generated on
|
838
|
+
Generated on Tue Apr 16 10:49:58 2013 by
|
872
839
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
873
|
-
0.8.
|
840
|
+
0.8.5 (ruby-1.9.3).
|
874
841
|
</div>
|
875
842
|
|
876
843
|
</body>
|