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/ASN1.html
ADDED
@@ -0,0 +1,370 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: R509::ASN1
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.5
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (A)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../R509.html" title="R509 (module)">R509</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">ASN1</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: R509::ASN1
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/r509/asn1.rb</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
<h2>Overview</h2><div class="docstring">
|
88
|
+
<div class="discussion">
|
89
|
+
|
90
|
+
<p>Module for holding various classes related to parsed ASN.1 objects</p>
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
<div class="tags">
|
96
|
+
|
97
|
+
|
98
|
+
</div><h2>Defined Under Namespace</h2>
|
99
|
+
<p class="children">
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="ASN1/GeneralName.html" title="R509::ASN1::GeneralName (class)">GeneralName</a></span>, <span class='object_link'><a href="ASN1/GeneralNames.html" title="R509::ASN1::GeneralNames (class)">GeneralNames</a></span>, <span class='object_link'><a href="ASN1/NoticeReference.html" title="R509::ASN1::NoticeReference (class)">NoticeReference</a></span>, <span class='object_link'><a href="ASN1/PolicyInformation.html" title="R509::ASN1::PolicyInformation (class)">PolicyInformation</a></span>, <span class='object_link'><a href="ASN1/PolicyQualifiers.html" title="R509::ASN1::PolicyQualifiers (class)">PolicyQualifiers</a></span>, <span class='object_link'><a href="ASN1/UserNotice.html" title="R509::ASN1::UserNotice (class)">UserNotice</a></span>
|
105
|
+
|
106
|
+
|
107
|
+
</p>
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
<h2>
|
117
|
+
Class Method Summary
|
118
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
119
|
+
</h2>
|
120
|
+
|
121
|
+
<ul class="summary">
|
122
|
+
|
123
|
+
<li class="public ">
|
124
|
+
<span class="summary_signature">
|
125
|
+
|
126
|
+
<a href="#general_name_parser-class_method" title="general_name_parser (class method)">+ (R509::ASN1::GeneralNames) <strong>general_name_parser</strong>(names) </a>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
</span>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
141
|
+
|
142
|
+
</li>
|
143
|
+
|
144
|
+
|
145
|
+
<li class="public ">
|
146
|
+
<span class="summary_signature">
|
147
|
+
|
148
|
+
<a href="#get_extension_payload-class_method" title="get_extension_payload (class method)">+ (Object) <strong>get_extension_payload</strong>(ext) </a>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
</span>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
<span class="summary_desc"><div class='inline'>
|
163
|
+
<p>parses the ASN.1 payload and gets the extension data out for further
|
164
|
+
processing by the subclasses.</p>
|
165
|
+
</div></span>
|
166
|
+
|
167
|
+
</li>
|
168
|
+
|
169
|
+
|
170
|
+
</ul>
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
<div id="class_method_details" class="method_details_list">
|
176
|
+
<h2>Class Method Details</h2>
|
177
|
+
|
178
|
+
|
179
|
+
<div class="method_details first">
|
180
|
+
<h3 class="signature first" id="general_name_parser-class_method">
|
181
|
+
|
182
|
+
+ (<tt><span class='object_link'><a href="ASN1/GeneralNames.html" title="R509::ASN1::GeneralNames (class)">R509::ASN1::GeneralNames</a></span></tt>) <strong>general_name_parser</strong>(names)
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
</h3><div class="docstring">
|
189
|
+
<div class="discussion">
|
190
|
+
|
191
|
+
|
192
|
+
</div>
|
193
|
+
</div>
|
194
|
+
<div class="tags">
|
195
|
+
<p class="tag_title">Parameters:</p>
|
196
|
+
<ul class="param">
|
197
|
+
|
198
|
+
<li>
|
199
|
+
|
200
|
+
<span class='name'>names</span>
|
201
|
+
|
202
|
+
|
203
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
—
|
208
|
+
<div class='inline'>
|
209
|
+
<p>An array of strings. Can be dNSName, iPAddress, URI, or rfc822Name. You can
|
210
|
+
also supply a directoryName, but this must be an R509::Subject or array of
|
211
|
+
arrays</p>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
</li>
|
215
|
+
|
216
|
+
</ul>
|
217
|
+
|
218
|
+
<p class="tag_title">Returns:</p>
|
219
|
+
<ul class="return">
|
220
|
+
|
221
|
+
<li>
|
222
|
+
|
223
|
+
|
224
|
+
<span class='type'>(<tt><span class='object_link'><a href="ASN1/GeneralNames.html" title="R509::ASN1::GeneralNames (class)">R509::ASN1::GeneralNames</a></span></tt>)</span>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
</li>
|
229
|
+
|
230
|
+
</ul>
|
231
|
+
|
232
|
+
</div><table class="source_code">
|
233
|
+
<tr>
|
234
|
+
<td>
|
235
|
+
<pre class="lines">
|
236
|
+
|
237
|
+
|
238
|
+
25
|
239
|
+
26
|
240
|
+
27
|
241
|
+
28
|
242
|
+
29
|
243
|
+
30
|
244
|
+
31
|
245
|
+
32
|
246
|
+
33
|
247
|
+
34
|
248
|
+
35
|
249
|
+
36
|
250
|
+
37
|
251
|
+
38
|
252
|
+
39
|
253
|
+
40
|
254
|
+
41
|
255
|
+
42
|
256
|
+
43
|
257
|
+
44
|
258
|
+
45
|
259
|
+
46
|
260
|
+
47
|
261
|
+
48
|
262
|
+
49</pre>
|
263
|
+
</td>
|
264
|
+
<td>
|
265
|
+
<pre class="code"><span class="info file"># File 'lib/r509/asn1.rb', line 25</span>
|
266
|
+
|
267
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_general_name_parser'>general_name_parser</span><span class='lparen'>(</span><span class='id identifier rubyid_names'>names</span><span class='rparen'>)</span>
|
268
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_names'>names</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
269
|
+
<span class='kw'>return</span> <span class='kw'>nil</span>
|
270
|
+
<span class='kw'>end</span>
|
271
|
+
<span class='id identifier rubyid_general_names'>general_names</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>ASN1</span><span class='op'>::</span><span class='const'>GeneralNames</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
272
|
+
<span class='id identifier rubyid_names'>names</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_domain'>domain</span><span class='op'>|</span>
|
273
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='lparen'>(</span><span class='const'>IPAddr</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_domain'>domain</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='rparen'>)</span> <span class='kw'>rescue</span> <span class='kw'>nil</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
274
|
+
<span class='id identifier rubyid_ip'>ip</span> <span class='op'>=</span> <span class='const'>IPAddr</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_domain'>domain</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='rparen'>)</span>
|
275
|
+
<span class='id identifier rubyid_general_names'>general_names</span><span class='period'>.</span><span class='id identifier rubyid_create_item'>create_item</span><span class='lparen'>(</span><span class='symbol'>:tag</span> <span class='op'>=></span> <span class='int'>7</span><span class='comma'>,</span> <span class='symbol'>:value</span> <span class='op'>=></span> <span class='id identifier rubyid_ip'>ip</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
|
276
|
+
<span class='kw'>else</span>
|
277
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_domain'>domain</span>
|
278
|
+
<span class='kw'>when</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>Subject</span><span class='comma'>,</span> <span class='const'>Array</span>
|
279
|
+
<span class='id identifier rubyid_subject'>subject</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>Subject</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_domain'>domain</span><span class='rparen'>)</span>
|
280
|
+
<span class='id identifier rubyid_general_names'>general_names</span><span class='period'>.</span><span class='id identifier rubyid_create_item'>create_item</span><span class='lparen'>(</span><span class='symbol'>:tag</span> <span class='op'>=></span> <span class='int'>4</span><span class='comma'>,</span> <span class='symbol'>:value</span> <span class='op'>=></span> <span class='id identifier rubyid_subject'>subject</span><span class='rparen'>)</span>
|
281
|
+
<span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>:\/\/</span><span class='regexp_end'>/</span></span> <span class='comment'>#URI
|
282
|
+
</span> <span class='id identifier rubyid_general_names'>general_names</span><span class='period'>.</span><span class='id identifier rubyid_create_item'>create_item</span><span class='lparen'>(</span><span class='symbol'>:tag</span> <span class='op'>=></span> <span class='int'>6</span><span class='comma'>,</span> <span class='symbol'>:value</span> <span class='op'>=></span> <span class='id identifier rubyid_domain'>domain</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='rparen'>)</span>
|
283
|
+
<span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>@</span><span class='regexp_end'>/</span></span> <span class='comment'>#rfc822Name
|
284
|
+
</span> <span class='id identifier rubyid_general_names'>general_names</span><span class='period'>.</span><span class='id identifier rubyid_create_item'>create_item</span><span class='lparen'>(</span><span class='symbol'>:tag</span> <span class='op'>=></span> <span class='int'>1</span><span class='comma'>,</span> <span class='symbol'>:value</span> <span class='op'>=></span> <span class='id identifier rubyid_domain'>domain</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='rparen'>)</span>
|
285
|
+
<span class='kw'>else</span> <span class='comment'>#dNSName
|
286
|
+
</span> <span class='id identifier rubyid_general_names'>general_names</span><span class='period'>.</span><span class='id identifier rubyid_create_item'>create_item</span><span class='lparen'>(</span><span class='symbol'>:tag</span> <span class='op'>=></span> <span class='int'>2</span><span class='comma'>,</span> <span class='symbol'>:value</span> <span class='op'>=></span> <span class='id identifier rubyid_domain'>domain</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='rparen'>)</span>
|
287
|
+
<span class='kw'>end</span>
|
288
|
+
<span class='kw'>end</span>
|
289
|
+
<span class='kw'>end</span>
|
290
|
+
<span class='id identifier rubyid_general_names'>general_names</span>
|
291
|
+
<span class='kw'>end</span></pre>
|
292
|
+
</td>
|
293
|
+
</tr>
|
294
|
+
</table>
|
295
|
+
</div>
|
296
|
+
|
297
|
+
<div class="method_details ">
|
298
|
+
<h3 class="signature " id="get_extension_payload-class_method">
|
299
|
+
|
300
|
+
+ (<tt>Object</tt>) <strong>get_extension_payload</strong>(ext)
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
</h3><div class="docstring">
|
307
|
+
<div class="discussion">
|
308
|
+
|
309
|
+
<p>parses the ASN.1 payload and gets the extension data out for further
|
310
|
+
processing by the subclasses</p>
|
311
|
+
|
312
|
+
|
313
|
+
</div>
|
314
|
+
</div>
|
315
|
+
<div class="tags">
|
316
|
+
|
317
|
+
|
318
|
+
</div><table class="source_code">
|
319
|
+
<tr>
|
320
|
+
<td>
|
321
|
+
<pre class="lines">
|
322
|
+
|
323
|
+
|
324
|
+
8
|
325
|
+
9
|
326
|
+
10
|
327
|
+
11
|
328
|
+
12
|
329
|
+
13
|
330
|
+
14
|
331
|
+
15
|
332
|
+
16
|
333
|
+
17
|
334
|
+
18
|
335
|
+
19
|
336
|
+
20</pre>
|
337
|
+
</td>
|
338
|
+
<td>
|
339
|
+
<pre class="code"><span class="info file"># File 'lib/r509/asn1.rb', line 8</span>
|
340
|
+
|
341
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_extension_payload'>get_extension_payload</span><span class='lparen'>(</span><span class='id identifier rubyid_ext'>ext</span><span class='rparen'>)</span>
|
342
|
+
<span class='id identifier rubyid_asn'>asn</span> <span class='op'>=</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>ASN1</span><span class='period'>.</span><span class='id identifier rubyid_decode'>decode</span> <span class='id identifier rubyid_ext'>ext</span>
|
343
|
+
<span class='comment'># Our extension object. Here's the structure:
|
344
|
+
</span> <span class='comment'># Extension ::= SEQUENCE {
|
345
|
+
</span> <span class='comment'># extnID OBJECT IDENTIFIER,
|
346
|
+
</span> <span class='comment'># critical BOOLEAN DEFAULT FALSE,
|
347
|
+
</span> <span class='comment'># extnValue OCTET STRING
|
348
|
+
</span> <span class='comment'># -- contains the DER encoding of an ASN.1 value
|
349
|
+
</span> <span class='comment'># -- corresponding to the extension type identified
|
350
|
+
</span> <span class='comment'># -- by extnID
|
351
|
+
</span> <span class='comment'># }
|
352
|
+
</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>ASN1</span><span class='period'>.</span><span class='id identifier rubyid_decode'>decode</span><span class='lparen'>(</span><span class='id identifier rubyid_asn'>asn</span><span class='period'>.</span><span class='id identifier rubyid_entries'>entries</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span>
|
353
|
+
<span class='kw'>end</span></pre>
|
354
|
+
</td>
|
355
|
+
</tr>
|
356
|
+
</table>
|
357
|
+
</div>
|
358
|
+
|
359
|
+
</div>
|
360
|
+
|
361
|
+
</div>
|
362
|
+
|
363
|
+
<div id="footer">
|
364
|
+
Generated on Tue Apr 16 10:49:55 2013 by
|
365
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
366
|
+
0.8.5 (ruby-1.9.3).
|
367
|
+
</div>
|
368
|
+
|
369
|
+
</body>
|
370
|
+
</html>
|
@@ -0,0 +1,1121 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: R509::ASN1::GeneralName
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.5
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (G)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../R509.html" title="R509 (module)">R509</a></span></span> » <span class='title'><span class='object_link'><a href="../ASN1.html" title="R509::ASN1 (module)">ASN1</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">GeneralName</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: R509::ASN1::GeneralName
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">R509::ASN1::GeneralName</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/r509/asn1.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>This class parses ASN.1 GeneralName objects. At the moment it supports
|
106
|
+
rfc822Name, dNSName, directoryName, uniformResourceIdentifier, and
|
107
|
+
iPAddress</p>
|
108
|
+
|
109
|
+
<pre class="code ruby"><code class="ruby">GeneralName ::= CHOICE {
|
110
|
+
otherName [0] OtherName,
|
111
|
+
rfc822Name [1] IA5String,
|
112
|
+
dNSName [2] IA5String,
|
113
|
+
x400Address [3] ORAddress,
|
114
|
+
directoryName [4] Name,
|
115
|
+
ediPartyName [5] EDIPartyName,
|
116
|
+
uniformResourceIdentifier [6] IA5String,
|
117
|
+
iPAddress [7] OCTET STRING,
|
118
|
+
registeredID [8] OBJECT IDENTIFIER }</code></pre>
|
119
|
+
|
120
|
+
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
<div class="tags">
|
124
|
+
|
125
|
+
|
126
|
+
</div>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
131
|
+
<ul class="summary">
|
132
|
+
|
133
|
+
<li class="public ">
|
134
|
+
<span class="summary_signature">
|
135
|
+
|
136
|
+
<a href="#serial_prefix-instance_method" title="#serial_prefix (instance method)">- (Object) <strong>serial_prefix</strong> </a>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
</span>
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<span class="note title readonly">readonly</span>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<span class="summary_desc"><div class='inline'>
|
156
|
+
<p>The prefix OpenSSL needs for this type when encoding it into an extension.</p>
|
157
|
+
</div></span>
|
158
|
+
|
159
|
+
</li>
|
160
|
+
|
161
|
+
|
162
|
+
<li class="public ">
|
163
|
+
<span class="summary_signature">
|
164
|
+
|
165
|
+
<a href="#tag-instance_method" title="#tag (instance method)">- (Object) <strong>tag</strong> </a>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
</span>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
<span class="note title readonly">readonly</span>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<span class="summary_desc"><div class='inline'>
|
185
|
+
<p>Integer tag type.</p>
|
186
|
+
</div></span>
|
187
|
+
|
188
|
+
</li>
|
189
|
+
|
190
|
+
|
191
|
+
<li class="public ">
|
192
|
+
<span class="summary_signature">
|
193
|
+
|
194
|
+
<a href="#type-instance_method" title="#type (instance method)">- (Object) <strong>type</strong> </a>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
</span>
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
<span class="note title readonly">readonly</span>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
<span class="summary_desc"><div class='inline'>
|
214
|
+
<p>The type, represented as a symbolized version of the GeneralName (e.g.
|
215
|
+
:dNSName).</p>
|
216
|
+
</div></span>
|
217
|
+
|
218
|
+
</li>
|
219
|
+
|
220
|
+
|
221
|
+
<li class="public ">
|
222
|
+
<span class="summary_signature">
|
223
|
+
|
224
|
+
<a href="#value-instance_method" title="#value (instance method)">- (Object) <strong>value</strong> </a>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
</span>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
<span class="note title readonly">readonly</span>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
<span class="summary_desc"><div class='inline'>
|
244
|
+
<p>Value of the GeneralName.</p>
|
245
|
+
</div></span>
|
246
|
+
|
247
|
+
</li>
|
248
|
+
|
249
|
+
|
250
|
+
</ul>
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
<h2>
|
257
|
+
Class Method Summary
|
258
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
259
|
+
</h2>
|
260
|
+
|
261
|
+
<ul class="summary">
|
262
|
+
|
263
|
+
<li class="public ">
|
264
|
+
<span class="summary_signature">
|
265
|
+
|
266
|
+
<a href="#map_tag_to_serial_prefix-class_method" title="map_tag_to_serial_prefix (class method)">+ (String) <strong>map_tag_to_serial_prefix</strong>(tag) </a>
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
</span>
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
<span class="summary_desc"><div class='inline'>
|
281
|
+
<p>Serial prefix.</p>
|
282
|
+
</div></span>
|
283
|
+
|
284
|
+
</li>
|
285
|
+
|
286
|
+
|
287
|
+
<li class="public ">
|
288
|
+
<span class="summary_signature">
|
289
|
+
|
290
|
+
<a href="#map_tag_to_type-class_method" title="map_tag_to_type (class method)">+ (Symbol) <strong>map_tag_to_type</strong>(tag) </a>
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
</span>
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
<span class="summary_desc"><div class='inline'>
|
305
|
+
<p>Symbol type.</p>
|
306
|
+
</div></span>
|
307
|
+
|
308
|
+
</li>
|
309
|
+
|
310
|
+
|
311
|
+
<li class="public ">
|
312
|
+
<span class="summary_signature">
|
313
|
+
|
314
|
+
<a href="#map_type_to_tag-class_method" title="map_type_to_tag (class method)">+ (Integer) <strong>map_type_to_tag</strong>(type) </a>
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
</span>
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
<span class="summary_desc"><div class='inline'>
|
329
|
+
<p>Maps a GeneralName type to the integer tag representation.</p>
|
330
|
+
</div></span>
|
331
|
+
|
332
|
+
</li>
|
333
|
+
|
334
|
+
|
335
|
+
</ul>
|
336
|
+
|
337
|
+
<h2>
|
338
|
+
Instance Method Summary
|
339
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
340
|
+
</h2>
|
341
|
+
|
342
|
+
<ul class="summary">
|
343
|
+
|
344
|
+
<li class="public ">
|
345
|
+
<span class="summary_signature">
|
346
|
+
|
347
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (GeneralName) <strong>initialize</strong>(asn) </a>
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
</span>
|
352
|
+
|
353
|
+
|
354
|
+
<span class="note title constructor">constructor</span>
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
<span class="summary_desc"><div class='inline'>
|
364
|
+
<p>A new instance of GeneralName.</p>
|
365
|
+
</div></span>
|
366
|
+
|
367
|
+
</li>
|
368
|
+
|
369
|
+
|
370
|
+
<li class="public ">
|
371
|
+
<span class="summary_signature">
|
372
|
+
|
373
|
+
<a href="#serialize_name-instance_method" title="#serialize_name (instance method)">- (Hash) <strong>serialize_name</strong> </a>
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
</span>
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
<span class="summary_desc"><div class='inline'>
|
388
|
+
<p>Used to serialize GeneralName objects when issuing new certificates inside
|
389
|
+
R509::CertificateAuthority::Signer.</p>
|
390
|
+
</div></span>
|
391
|
+
|
392
|
+
</li>
|
393
|
+
|
394
|
+
|
395
|
+
</ul>
|
396
|
+
|
397
|
+
|
398
|
+
<div id="constructor_details" class="method_details_list">
|
399
|
+
<h2>Constructor Details</h2>
|
400
|
+
|
401
|
+
<div class="method_details first">
|
402
|
+
<h3 class="signature first" id="initialize-instance_method">
|
403
|
+
|
404
|
+
- (<tt><span class='object_link'><a href="" title="R509::ASN1::GeneralName (class)">GeneralName</a></span></tt>) <strong>initialize</strong>(asn)
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
</h3><div class="docstring">
|
411
|
+
<div class="discussion">
|
412
|
+
|
413
|
+
<p>A new instance of GeneralName</p>
|
414
|
+
|
415
|
+
|
416
|
+
</div>
|
417
|
+
</div>
|
418
|
+
<div class="tags">
|
419
|
+
<p class="tag_title">Parameters:</p>
|
420
|
+
<ul class="param">
|
421
|
+
|
422
|
+
<li>
|
423
|
+
|
424
|
+
<span class='name'>asn</span>
|
425
|
+
|
426
|
+
|
427
|
+
<span class='type'>(<tt>OpenSSL::ASN1::ASN1Data</tt>, <tt>Hash</tt>)</span>
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
—
|
432
|
+
<div class='inline'>
|
433
|
+
<p>ASN.1 input data. Can also pass a hash with :tag and :value keys</p>
|
434
|
+
</div>
|
435
|
+
|
436
|
+
</li>
|
437
|
+
|
438
|
+
</ul>
|
439
|
+
|
440
|
+
|
441
|
+
</div><table class="source_code">
|
442
|
+
<tr>
|
443
|
+
<td>
|
444
|
+
<pre class="lines">
|
445
|
+
|
446
|
+
|
447
|
+
74
|
448
|
+
75
|
449
|
+
76
|
450
|
+
77
|
451
|
+
78
|
452
|
+
79
|
453
|
+
80
|
454
|
+
81
|
455
|
+
82
|
456
|
+
83
|
457
|
+
84
|
458
|
+
85
|
459
|
+
86
|
460
|
+
87
|
461
|
+
88
|
462
|
+
89
|
463
|
+
90
|
464
|
+
91
|
465
|
+
92
|
466
|
+
93
|
467
|
+
94
|
468
|
+
95
|
469
|
+
96
|
470
|
+
97
|
471
|
+
98
|
472
|
+
99
|
473
|
+
100
|
474
|
+
101
|
475
|
+
102
|
476
|
+
103
|
477
|
+
104
|
478
|
+
105
|
479
|
+
106</pre>
|
480
|
+
</td>
|
481
|
+
<td>
|
482
|
+
<pre class="code"><span class="info file"># File 'lib/r509/asn1.rb', line 74</span>
|
483
|
+
|
484
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_asn'>asn</span><span class='rparen'>)</span>
|
485
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_asn'>asn</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> <span class='kw'>and</span> <span class='id identifier rubyid_asn'>asn</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:tag</span><span class='rparen'>)</span> <span class='kw'>and</span> <span class='id identifier rubyid_asn'>asn</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='symbol'>:value</span><span class='rparen'>)</span>
|
486
|
+
<span class='comment'># this is added via create_item
|
487
|
+
</span> <span class='ivar'>@tag</span> <span class='op'>=</span> <span class='id identifier rubyid_asn'>asn</span><span class='lbracket'>[</span><span class='symbol'>:tag</span><span class='rbracket'>]</span>
|
488
|
+
<span class='ivar'>@type</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>ASN1</span><span class='op'>::</span><span class='const'>GeneralName</span><span class='period'>.</span><span class='id identifier rubyid_map_tag_to_type'>map_tag_to_type</span><span class='lparen'>(</span><span class='ivar'>@tag</span><span class='rparen'>)</span>
|
489
|
+
<span class='ivar'>@serial_prefix</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>ASN1</span><span class='op'>::</span><span class='const'>GeneralName</span><span class='period'>.</span><span class='id identifier rubyid_map_tag_to_serial_prefix'>map_tag_to_serial_prefix</span><span class='lparen'>(</span><span class='ivar'>@tag</span><span class='rparen'>)</span>
|
490
|
+
<span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_asn'>asn</span><span class='lbracket'>[</span><span class='symbol'>:value</span><span class='rbracket'>]</span>
|
491
|
+
<span class='kw'>else</span>
|
492
|
+
<span class='ivar'>@tag</span> <span class='op'>=</span> <span class='id identifier rubyid_asn'>asn</span><span class='period'>.</span><span class='id identifier rubyid_tag'>tag</span>
|
493
|
+
<span class='ivar'>@type</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>ASN1</span><span class='op'>::</span><span class='const'>GeneralName</span><span class='period'>.</span><span class='id identifier rubyid_map_tag_to_type'>map_tag_to_type</span><span class='lparen'>(</span><span class='ivar'>@tag</span><span class='rparen'>)</span>
|
494
|
+
<span class='ivar'>@serial_prefix</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>ASN1</span><span class='op'>::</span><span class='const'>GeneralName</span><span class='period'>.</span><span class='id identifier rubyid_map_tag_to_serial_prefix'>map_tag_to_serial_prefix</span><span class='lparen'>(</span><span class='ivar'>@tag</span><span class='rparen'>)</span>
|
495
|
+
<span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_asn'>asn</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span>
|
496
|
+
<span class='kw'>case</span> <span class='ivar'>@tag</span>
|
497
|
+
<span class='kw'>when</span> <span class='int'>1</span> <span class='kw'>then</span> <span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
498
|
+
<span class='kw'>when</span> <span class='int'>2</span> <span class='kw'>then</span> <span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
499
|
+
<span class='kw'>when</span> <span class='int'>4</span> <span class='kw'>then</span> <span class='ivar'>@value</span> <span class='op'>=</span> <span class='const'>R509</span><span class='op'>::</span><span class='const'>Subject</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_to_der'>to_der</span><span class='rparen'>)</span>
|
500
|
+
<span class='kw'>when</span> <span class='int'>6</span> <span class='kw'>then</span> <span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
501
|
+
<span class='kw'>when</span> <span class='int'>7</span>
|
502
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>4</span> <span class='kw'>or</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>16</span>
|
503
|
+
<span class='id identifier rubyid_ip'>ip</span> <span class='op'>=</span> <span class='const'>IPAddr</span><span class='period'>.</span><span class='id identifier rubyid_new_ntoh'>new_ntoh</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
504
|
+
<span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_ip'>ip</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
505
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>8</span> <span class='comment'>#IPv4 with netmask
|
506
|
+
</span> <span class='id identifier rubyid_ip'>ip</span> <span class='op'>=</span> <span class='const'>IPAddr</span><span class='period'>.</span><span class='id identifier rubyid_new_ntoh'>new_ntoh</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span><span class='int'>4</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
507
|
+
<span class='id identifier rubyid_netmask'>netmask</span> <span class='op'>=</span> <span class='const'>IPAddr</span><span class='period'>.</span><span class='id identifier rubyid_new_ntoh'>new_ntoh</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='lbracket'>[</span><span class='int'>4</span><span class='comma'>,</span><span class='int'>4</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
508
|
+
<span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_ip'>ip</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/</span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='id identifier rubyid_netmask'>netmask</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
509
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>==</span> <span class='int'>32</span> <span class='comment'>#IPv6 with netmask
|
510
|
+
</span> <span class='id identifier rubyid_ip'>ip</span> <span class='op'>=</span> <span class='const'>IPAddr</span><span class='period'>.</span><span class='id identifier rubyid_new_ntoh'>new_ntoh</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span><span class='int'>16</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
511
|
+
<span class='id identifier rubyid_netmask'>netmask</span> <span class='op'>=</span> <span class='const'>IPAddr</span><span class='period'>.</span><span class='id identifier rubyid_new_ntoh'>new_ntoh</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='lbracket'>[</span><span class='int'>16</span><span class='comma'>,</span><span class='int'>16</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
512
|
+
<span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_ip'>ip</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/</span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='id identifier rubyid_netmask'>netmask</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
513
|
+
<span class='kw'>end</span>
|
514
|
+
<span class='kw'>end</span>
|
515
|
+
<span class='kw'>end</span>
|
516
|
+
<span class='kw'>end</span></pre>
|
517
|
+
</td>
|
518
|
+
</tr>
|
519
|
+
</table>
|
520
|
+
</div>
|
521
|
+
|
522
|
+
</div>
|
523
|
+
|
524
|
+
<div id="instance_attr_details" class="attr_details">
|
525
|
+
<h2>Instance Attribute Details</h2>
|
526
|
+
|
527
|
+
|
528
|
+
<span id=""></span>
|
529
|
+
<div class="method_details first">
|
530
|
+
<h3 class="signature first" id="serial_prefix-instance_method">
|
531
|
+
|
532
|
+
- (<tt>Object</tt>) <strong>serial_prefix</strong> <span class="extras">(readonly)</span>
|
533
|
+
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
</h3><div class="docstring">
|
539
|
+
<div class="discussion">
|
540
|
+
|
541
|
+
<p>The prefix OpenSSL needs for this type when encoding it into an extension.</p>
|
542
|
+
|
543
|
+
|
544
|
+
</div>
|
545
|
+
</div>
|
546
|
+
<div class="tags">
|
547
|
+
|
548
|
+
|
549
|
+
</div><table class="source_code">
|
550
|
+
<tr>
|
551
|
+
<td>
|
552
|
+
<pre class="lines">
|
553
|
+
|
554
|
+
|
555
|
+
67
|
556
|
+
68
|
557
|
+
69</pre>
|
558
|
+
</td>
|
559
|
+
<td>
|
560
|
+
<pre class="code"><span class="info file"># File 'lib/r509/asn1.rb', line 67</span>
|
561
|
+
|
562
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_serial_prefix'>serial_prefix</span>
|
563
|
+
<span class='ivar'>@serial_prefix</span>
|
564
|
+
<span class='kw'>end</span></pre>
|
565
|
+
</td>
|
566
|
+
</tr>
|
567
|
+
</table>
|
568
|
+
</div>
|
569
|
+
|
570
|
+
|
571
|
+
<span id=""></span>
|
572
|
+
<div class="method_details ">
|
573
|
+
<h3 class="signature " id="tag-instance_method">
|
574
|
+
|
575
|
+
- (<tt>Object</tt>) <strong>tag</strong> <span class="extras">(readonly)</span>
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
</h3><div class="docstring">
|
582
|
+
<div class="discussion">
|
583
|
+
|
584
|
+
<p>Integer tag type. See GeneralName description at the top of this class</p>
|
585
|
+
|
586
|
+
|
587
|
+
</div>
|
588
|
+
</div>
|
589
|
+
<div class="tags">
|
590
|
+
|
591
|
+
|
592
|
+
</div><table class="source_code">
|
593
|
+
<tr>
|
594
|
+
<td>
|
595
|
+
<pre class="lines">
|
596
|
+
|
597
|
+
|
598
|
+
71
|
599
|
+
72
|
600
|
+
73</pre>
|
601
|
+
</td>
|
602
|
+
<td>
|
603
|
+
<pre class="code"><span class="info file"># File 'lib/r509/asn1.rb', line 71</span>
|
604
|
+
|
605
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_tag'>tag</span>
|
606
|
+
<span class='ivar'>@tag</span>
|
607
|
+
<span class='kw'>end</span></pre>
|
608
|
+
</td>
|
609
|
+
</tr>
|
610
|
+
</table>
|
611
|
+
</div>
|
612
|
+
|
613
|
+
|
614
|
+
<span id=""></span>
|
615
|
+
<div class="method_details ">
|
616
|
+
<h3 class="signature " id="type-instance_method">
|
617
|
+
|
618
|
+
- (<tt>Object</tt>) <strong>type</strong> <span class="extras">(readonly)</span>
|
619
|
+
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
|
624
|
+
</h3><div class="docstring">
|
625
|
+
<div class="discussion">
|
626
|
+
|
627
|
+
<p>The type, represented as a symbolized version of the GeneralName (e.g.
|
628
|
+
:dNSName)</p>
|
629
|
+
|
630
|
+
|
631
|
+
</div>
|
632
|
+
</div>
|
633
|
+
<div class="tags">
|
634
|
+
|
635
|
+
|
636
|
+
</div><table class="source_code">
|
637
|
+
<tr>
|
638
|
+
<td>
|
639
|
+
<pre class="lines">
|
640
|
+
|
641
|
+
|
642
|
+
65
|
643
|
+
66
|
644
|
+
67</pre>
|
645
|
+
</td>
|
646
|
+
<td>
|
647
|
+
<pre class="code"><span class="info file"># File 'lib/r509/asn1.rb', line 65</span>
|
648
|
+
|
649
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
|
650
|
+
<span class='ivar'>@type</span>
|
651
|
+
<span class='kw'>end</span></pre>
|
652
|
+
</td>
|
653
|
+
</tr>
|
654
|
+
</table>
|
655
|
+
</div>
|
656
|
+
|
657
|
+
|
658
|
+
<span id=""></span>
|
659
|
+
<div class="method_details ">
|
660
|
+
<h3 class="signature " id="value-instance_method">
|
661
|
+
|
662
|
+
- (<tt>Object</tt>) <strong>value</strong> <span class="extras">(readonly)</span>
|
663
|
+
|
664
|
+
|
665
|
+
|
666
|
+
|
667
|
+
|
668
|
+
</h3><div class="docstring">
|
669
|
+
<div class="discussion">
|
670
|
+
|
671
|
+
<p>Value of the GeneralName</p>
|
672
|
+
|
673
|
+
|
674
|
+
</div>
|
675
|
+
</div>
|
676
|
+
<div class="tags">
|
677
|
+
|
678
|
+
|
679
|
+
</div><table class="source_code">
|
680
|
+
<tr>
|
681
|
+
<td>
|
682
|
+
<pre class="lines">
|
683
|
+
|
684
|
+
|
685
|
+
69
|
686
|
+
70
|
687
|
+
71</pre>
|
688
|
+
</td>
|
689
|
+
<td>
|
690
|
+
<pre class="code"><span class="info file"># File 'lib/r509/asn1.rb', line 69</span>
|
691
|
+
|
692
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_value'>value</span>
|
693
|
+
<span class='ivar'>@value</span>
|
694
|
+
<span class='kw'>end</span></pre>
|
695
|
+
</td>
|
696
|
+
</tr>
|
697
|
+
</table>
|
698
|
+
</div>
|
699
|
+
|
700
|
+
</div>
|
701
|
+
|
702
|
+
|
703
|
+
<div id="class_method_details" class="method_details_list">
|
704
|
+
<h2>Class Method Details</h2>
|
705
|
+
|
706
|
+
|
707
|
+
<div class="method_details first">
|
708
|
+
<h3 class="signature first" id="map_tag_to_serial_prefix-class_method">
|
709
|
+
|
710
|
+
+ (<tt>String</tt>) <strong>map_tag_to_serial_prefix</strong>(tag)
|
711
|
+
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
</h3><div class="docstring">
|
717
|
+
<div class="discussion">
|
718
|
+
|
719
|
+
<p>Serial prefix</p>
|
720
|
+
|
721
|
+
|
722
|
+
</div>
|
723
|
+
</div>
|
724
|
+
<div class="tags">
|
725
|
+
<p class="tag_title">Parameters:</p>
|
726
|
+
<ul class="param">
|
727
|
+
|
728
|
+
<li>
|
729
|
+
|
730
|
+
<span class='name'>tag</span>
|
731
|
+
|
732
|
+
|
733
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
734
|
+
|
735
|
+
|
736
|
+
|
737
|
+
</li>
|
738
|
+
|
739
|
+
</ul>
|
740
|
+
|
741
|
+
<p class="tag_title">Returns:</p>
|
742
|
+
<ul class="return">
|
743
|
+
|
744
|
+
<li>
|
745
|
+
|
746
|
+
|
747
|
+
<span class='type'>(<tt>String</tt>)</span>
|
748
|
+
|
749
|
+
|
750
|
+
|
751
|
+
—
|
752
|
+
<div class='inline'>
|
753
|
+
<p>serial prefix</p>
|
754
|
+
</div>
|
755
|
+
|
756
|
+
</li>
|
757
|
+
|
758
|
+
</ul>
|
759
|
+
|
760
|
+
</div><table class="source_code">
|
761
|
+
<tr>
|
762
|
+
<td>
|
763
|
+
<pre class="lines">
|
764
|
+
|
765
|
+
|
766
|
+
136
|
767
|
+
137
|
768
|
+
138
|
769
|
+
139
|
770
|
+
140
|
771
|
+
141
|
772
|
+
142
|
773
|
+
143
|
774
|
+
144
|
775
|
+
145
|
776
|
+
146</pre>
|
777
|
+
</td>
|
778
|
+
<td>
|
779
|
+
<pre class="code"><span class="info file"># File 'lib/r509/asn1.rb', line 136</span>
|
780
|
+
|
781
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_map_tag_to_serial_prefix'>map_tag_to_serial_prefix</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span><span class='rparen'>)</span>
|
782
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_tag'>tag</span>
|
783
|
+
<span class='kw'>when</span> <span class='int'>1</span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>email</span><span class='tstring_end'>"</span></span>
|
784
|
+
<span class='kw'>when</span> <span class='int'>2</span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>DNS</span><span class='tstring_end'>"</span></span>
|
785
|
+
<span class='kw'>when</span> <span class='int'>4</span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>dirName</span><span class='tstring_end'>"</span></span>
|
786
|
+
<span class='kw'>when</span> <span class='int'>6</span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>URI</span><span class='tstring_end'>"</span></span>
|
787
|
+
<span class='kw'>when</span> <span class='int'>7</span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>IP</span><span class='tstring_end'>"</span></span>
|
788
|
+
<span class='kw'>else</span>
|
789
|
+
<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'>Unimplemented GeneralName tag: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_tag'>tag</span><span class='rbrace'>}</span><span class='tstring_content'>. At this time R509 does not support GeneralName types other than rfc822Name, dNSName, uniformResourceIdentifier, iPAddress, and directoryName</span><span class='tstring_end'>"</span></span>
|
790
|
+
<span class='kw'>end</span>
|
791
|
+
<span class='kw'>end</span></pre>
|
792
|
+
</td>
|
793
|
+
</tr>
|
794
|
+
</table>
|
795
|
+
</div>
|
796
|
+
|
797
|
+
<div class="method_details ">
|
798
|
+
<h3 class="signature " id="map_tag_to_type-class_method">
|
799
|
+
|
800
|
+
+ (<tt>Symbol</tt>) <strong>map_tag_to_type</strong>(tag)
|
801
|
+
|
802
|
+
|
803
|
+
|
804
|
+
|
805
|
+
|
806
|
+
</h3><div class="docstring">
|
807
|
+
<div class="discussion">
|
808
|
+
|
809
|
+
<p>Symbol type</p>
|
810
|
+
|
811
|
+
|
812
|
+
</div>
|
813
|
+
</div>
|
814
|
+
<div class="tags">
|
815
|
+
<p class="tag_title">Parameters:</p>
|
816
|
+
<ul class="param">
|
817
|
+
|
818
|
+
<li>
|
819
|
+
|
820
|
+
<span class='name'>tag</span>
|
821
|
+
|
822
|
+
|
823
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
824
|
+
|
825
|
+
|
826
|
+
|
827
|
+
</li>
|
828
|
+
|
829
|
+
</ul>
|
830
|
+
|
831
|
+
<p class="tag_title">Returns:</p>
|
832
|
+
<ul class="return">
|
833
|
+
|
834
|
+
<li>
|
835
|
+
|
836
|
+
|
837
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
838
|
+
|
839
|
+
|
840
|
+
|
841
|
+
—
|
842
|
+
<div class='inline'>
|
843
|
+
<p>symbol type</p>
|
844
|
+
</div>
|
845
|
+
|
846
|
+
</li>
|
847
|
+
|
848
|
+
</ul>
|
849
|
+
|
850
|
+
</div><table class="source_code">
|
851
|
+
<tr>
|
852
|
+
<td>
|
853
|
+
<pre class="lines">
|
854
|
+
|
855
|
+
|
856
|
+
150
|
857
|
+
151
|
858
|
+
152
|
859
|
+
153
|
860
|
+
154
|
861
|
+
155
|
862
|
+
156
|
863
|
+
157
|
864
|
+
158
|
865
|
+
159
|
866
|
+
160
|
867
|
+
161
|
868
|
+
162
|
869
|
+
163
|
870
|
+
164</pre>
|
871
|
+
</td>
|
872
|
+
<td>
|
873
|
+
<pre class="code"><span class="info file"># File 'lib/r509/asn1.rb', line 150</span>
|
874
|
+
|
875
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_map_tag_to_type'>map_tag_to_type</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span><span class='rparen'>)</span>
|
876
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_tag'>tag</span>
|
877
|
+
<span class='kw'>when</span> <span class='int'>0</span> <span class='kw'>then</span> <span class='symbol'>:otherName</span>
|
878
|
+
<span class='kw'>when</span> <span class='int'>1</span> <span class='kw'>then</span> <span class='symbol'>:rfc822Name</span>
|
879
|
+
<span class='kw'>when</span> <span class='int'>2</span> <span class='kw'>then</span> <span class='symbol'>:dNSName</span>
|
880
|
+
<span class='kw'>when</span> <span class='int'>3</span> <span class='kw'>then</span> <span class='symbol'>:x400Address</span>
|
881
|
+
<span class='kw'>when</span> <span class='int'>4</span> <span class='kw'>then</span> <span class='symbol'>:directoryName</span>
|
882
|
+
<span class='kw'>when</span> <span class='int'>5</span> <span class='kw'>then</span> <span class='symbol'>:ediPartyName</span>
|
883
|
+
<span class='kw'>when</span> <span class='int'>6</span> <span class='kw'>then</span> <span class='symbol'>:uniformResourceIdentifier</span>
|
884
|
+
<span class='kw'>when</span> <span class='int'>7</span> <span class='kw'>then</span> <span class='symbol'>:iPAddress</span>
|
885
|
+
<span class='kw'>when</span> <span class='int'>8</span> <span class='kw'>then</span> <span class='symbol'>:registeredID</span>
|
886
|
+
<span class='kw'>else</span>
|
887
|
+
<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'>Invalid tag </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_tag'>tag</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
888
|
+
<span class='kw'>end</span>
|
889
|
+
<span class='kw'>end</span></pre>
|
890
|
+
</td>
|
891
|
+
</tr>
|
892
|
+
</table>
|
893
|
+
</div>
|
894
|
+
|
895
|
+
<div class="method_details ">
|
896
|
+
<h3 class="signature " id="map_type_to_tag-class_method">
|
897
|
+
|
898
|
+
+ (<tt>Integer</tt>) <strong>map_type_to_tag</strong>(type)
|
899
|
+
|
900
|
+
|
901
|
+
|
902
|
+
|
903
|
+
|
904
|
+
</h3><div class="docstring">
|
905
|
+
<div class="discussion">
|
906
|
+
|
907
|
+
<p>Maps a GeneralName type to the integer tag representation</p>
|
908
|
+
|
909
|
+
|
910
|
+
</div>
|
911
|
+
</div>
|
912
|
+
<div class="tags">
|
913
|
+
<p class="tag_title">Parameters:</p>
|
914
|
+
<ul class="param">
|
915
|
+
|
916
|
+
<li>
|
917
|
+
|
918
|
+
<span class='name'>type</span>
|
919
|
+
|
920
|
+
|
921
|
+
<span class='type'>(<tt>String</tt>, <tt>Symbol</tt>)</span>
|
922
|
+
|
923
|
+
|
924
|
+
|
925
|
+
—
|
926
|
+
<div class='inline'>
|
927
|
+
<p>of GeneralName</p>
|
928
|
+
</div>
|
929
|
+
|
930
|
+
</li>
|
931
|
+
|
932
|
+
</ul>
|
933
|
+
|
934
|
+
<p class="tag_title">Returns:</p>
|
935
|
+
<ul class="return">
|
936
|
+
|
937
|
+
<li>
|
938
|
+
|
939
|
+
|
940
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
941
|
+
|
942
|
+
|
943
|
+
|
944
|
+
—
|
945
|
+
<div class='inline'>
|
946
|
+
<p>tag for the type</p>
|
947
|
+
</div>
|
948
|
+
|
949
|
+
</li>
|
950
|
+
|
951
|
+
</ul>
|
952
|
+
|
953
|
+
</div><table class="source_code">
|
954
|
+
<tr>
|
955
|
+
<td>
|
956
|
+
<pre class="lines">
|
957
|
+
|
958
|
+
|
959
|
+
111
|
960
|
+
112
|
961
|
+
113
|
962
|
+
114
|
963
|
+
115
|
964
|
+
116
|
965
|
+
117
|
966
|
+
118
|
967
|
+
119
|
968
|
+
120
|
969
|
+
121
|
970
|
+
122
|
971
|
+
123
|
972
|
+
124
|
973
|
+
125
|
974
|
+
126
|
975
|
+
127
|
976
|
+
128
|
977
|
+
129
|
978
|
+
130
|
979
|
+
131
|
980
|
+
132</pre>
|
981
|
+
</td>
|
982
|
+
<td>
|
983
|
+
<pre class="code"><span class="info file"># File 'lib/r509/asn1.rb', line 111</span>
|
984
|
+
|
985
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_map_type_to_tag'>map_type_to_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span>
|
986
|
+
<span class='comment'># otherName [0] OtherName,
|
987
|
+
</span> <span class='comment'># rfc822Name [1] IA5String,
|
988
|
+
</span> <span class='comment'># dNSName [2] IA5String,
|
989
|
+
</span> <span class='comment'># x400Address [3] ORAddress,
|
990
|
+
</span> <span class='comment'># directoryName [4] Name,
|
991
|
+
</span> <span class='comment'># ediPartyName [5] EDIPartyName,
|
992
|
+
</span> <span class='comment'># uniformResourceIdentifier [6] IA5String,
|
993
|
+
</span> <span class='comment'># iPAddress [7] OCTET STRING,
|
994
|
+
</span> <span class='comment'># registeredID [8] OBJECT IDENTIFIER }
|
995
|
+
</span> <span class='kw'>case</span> <span class='id identifier rubyid_type'>type</span>
|
996
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>otherName</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:otherName</span> <span class='kw'>then</span> <span class='int'>0</span>
|
997
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rfc822Name</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:rfc822Name</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>email</span><span class='tstring_end'>"</span></span> <span class='kw'>then</span> <span class='int'>1</span>
|
998
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>dNSName</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:dNSName</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>DNS</span><span class='tstring_end'>"</span></span> <span class='kw'>then</span> <span class='int'>2</span>
|
999
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>x400Address</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:x400Address</span> <span class='kw'>then</span> <span class='int'>3</span>
|
1000
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>directoryName</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:directoryName</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>dirName</span><span class='tstring_end'>"</span></span> <span class='kw'>then</span> <span class='int'>4</span>
|
1001
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ediPartyName</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:ediPartyName</span> <span class='kw'>then</span> <span class='int'>5</span>
|
1002
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>uniformResourceIdentifier</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:uniformResourceIdentifier</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>URI</span><span class='tstring_end'>"</span></span> <span class='kw'>then</span> <span class='int'>6</span>
|
1003
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>iPAddress</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:iPAddress</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>IP</span><span class='tstring_end'>"</span></span> <span class='kw'>then</span> <span class='int'>7</span>
|
1004
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>registeredID</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:registeredID</span> <span class='kw'>then</span> <span class='int'>8</span>
|
1005
|
+
<span class='kw'>end</span>
|
1006
|
+
<span class='kw'>end</span></pre>
|
1007
|
+
</td>
|
1008
|
+
</tr>
|
1009
|
+
</table>
|
1010
|
+
</div>
|
1011
|
+
|
1012
|
+
</div>
|
1013
|
+
|
1014
|
+
<div id="instance_method_details" class="method_details_list">
|
1015
|
+
<h2>Instance Method Details</h2>
|
1016
|
+
|
1017
|
+
|
1018
|
+
<div class="method_details first">
|
1019
|
+
<h3 class="signature first" id="serialize_name-instance_method">
|
1020
|
+
|
1021
|
+
- (<tt>Hash</tt>) <strong>serialize_name</strong>
|
1022
|
+
|
1023
|
+
|
1024
|
+
|
1025
|
+
|
1026
|
+
|
1027
|
+
</h3><div class="docstring">
|
1028
|
+
<div class="discussion">
|
1029
|
+
|
1030
|
+
<p>Used to serialize GeneralName objects when issuing new certificates inside
|
1031
|
+
R509::CertificateAuthority::Signer</p>
|
1032
|
+
|
1033
|
+
|
1034
|
+
</div>
|
1035
|
+
</div>
|
1036
|
+
<div class="tags">
|
1037
|
+
|
1038
|
+
<p class="tag_title">Returns:</p>
|
1039
|
+
<ul class="return">
|
1040
|
+
|
1041
|
+
<li>
|
1042
|
+
|
1043
|
+
|
1044
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1045
|
+
|
1046
|
+
|
1047
|
+
|
1048
|
+
—
|
1049
|
+
<div class='inline'>
|
1050
|
+
<p>conf section and name serialized for OpenSSL extension creation</p>
|
1051
|
+
</div>
|
1052
|
+
|
1053
|
+
</li>
|
1054
|
+
|
1055
|
+
</ul>
|
1056
|
+
|
1057
|
+
</div><table class="source_code">
|
1058
|
+
<tr>
|
1059
|
+
<td>
|
1060
|
+
<pre class="lines">
|
1061
|
+
|
1062
|
+
|
1063
|
+
182
|
1064
|
+
183
|
1065
|
+
184
|
1066
|
+
185
|
1067
|
+
186
|
1068
|
+
187
|
1069
|
+
188
|
1070
|
+
189
|
1071
|
+
190
|
1072
|
+
191
|
1073
|
+
192
|
1074
|
+
193
|
1075
|
+
194
|
1076
|
+
195
|
1077
|
+
196
|
1078
|
+
197
|
1079
|
+
198
|
1080
|
+
199
|
1081
|
+
200</pre>
|
1082
|
+
</td>
|
1083
|
+
<td>
|
1084
|
+
<pre class="code"><span class="info file"># File 'lib/r509/asn1.rb', line 182</span>
|
1085
|
+
|
1086
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_serialize_name'>serialize_name</span>
|
1087
|
+
<span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='symbol'>:directoryName</span>
|
1088
|
+
<span class='id identifier rubyid_conf_name'>conf_name</span> <span class='op'>=</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>Random</span><span class='period'>.</span><span class='id identifier rubyid_random_bytes'>random_bytes</span><span class='lparen'>(</span><span class='int'>16</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_unpack'>unpack</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>H*</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
1089
|
+
<span class='id identifier rubyid_conf'>conf</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1090
|
+
<span class='id identifier rubyid_conf'>conf</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>[</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_conf_name'>conf_name</span><span class='rbrace'>}</span><span class='tstring_content'>]</span><span class='tstring_end'>"</span></span>
|
1091
|
+
<span class='ivar'>@value</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_el'>el</span><span class='op'>|</span>
|
1092
|
+
<span class='id identifier rubyid_conf'>conf</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_el'>el</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_el'>el</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
1093
|
+
<span class='kw'>end</span>
|
1094
|
+
<span class='id identifier rubyid_conf'>conf</span> <span class='op'>=</span> <span class='id identifier rubyid_conf'>conf</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</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='rparen'>)</span>
|
1095
|
+
<span class='id identifier rubyid_extension_string'>extension_string</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_serial_prefix'>serial_prefix</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='id identifier rubyid_conf_name'>conf_name</span>
|
1096
|
+
<span class='kw'>else</span>
|
1097
|
+
<span class='id identifier rubyid_conf'>conf</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1098
|
+
<span class='id identifier rubyid_extension_string'>extension_string</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_serial_prefix'>serial_prefix</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span>
|
1099
|
+
<span class='kw'>end</span>
|
1100
|
+
<span class='lbrace'>{</span>
|
1101
|
+
<span class='symbol'>:conf</span> <span class='op'>=></span> <span class='id identifier rubyid_conf'>conf</span><span class='comma'>,</span>
|
1102
|
+
<span class='symbol'>:extension_string</span> <span class='op'>=></span> <span class='id identifier rubyid_extension_string'>extension_string</span>
|
1103
|
+
<span class='rbrace'>}</span>
|
1104
|
+
<span class='kw'>end</span></pre>
|
1105
|
+
</td>
|
1106
|
+
</tr>
|
1107
|
+
</table>
|
1108
|
+
</div>
|
1109
|
+
|
1110
|
+
</div>
|
1111
|
+
|
1112
|
+
</div>
|
1113
|
+
|
1114
|
+
<div id="footer">
|
1115
|
+
Generated on Tue Apr 16 10:49:56 2013 by
|
1116
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1117
|
+
0.8.5 (ruby-1.9.3).
|
1118
|
+
</div>
|
1119
|
+
|
1120
|
+
</body>
|
1121
|
+
</html>
|