r509-ca-http 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -55,7 +55,7 @@ Required POST parameters:
55
55
 
56
56
  Optional POST parameters:
57
57
 
58
- - reason (must be an integer, if it's not provided it defaults to 0)
58
+ - reason (must be an integer or nil. nil by default)
59
59
 
60
60
  The revoke method returns the newly generated CRL, after revocation.
61
61
 
@@ -180,7 +180,7 @@
180
180
  </div>
181
181
 
182
182
  <div id="footer">
183
- Generated on Wed Apr 17 15:24:09 2013 by
183
+ Generated on Wed May 15 11:10:01 2013 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
185
  0.8.6.1 (ruby-1.9.3).
186
186
  </div>
@@ -180,7 +180,7 @@
180
180
  </div>
181
181
 
182
182
  <div id="footer">
183
- Generated on Wed Apr 17 15:24:09 2013 by
183
+ Generated on Wed May 15 11:10:01 2013 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
185
  0.8.6.1 (ruby-1.9.3).
186
186
  </div>
@@ -106,7 +106,7 @@
106
106
  </div>
107
107
 
108
108
  <div id="footer">
109
- Generated on Wed Apr 17 15:24:09 2013 by
109
+ Generated on Wed May 15 11:10:01 2013 by
110
110
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
111
111
  0.8.6.1 (ruby-1.9.3).
112
112
  </div>
@@ -124,7 +124,7 @@
124
124
  </div>
125
125
 
126
126
  <div id="footer">
127
- Generated on Wed Apr 17 15:24:09 2013 by
127
+ Generated on Wed May 15 11:10:01 2013 by
128
128
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
129
  0.8.6.1 (ruby-1.9.3).
130
130
  </div>
@@ -256,7 +256,7 @@
256
256
  </div>
257
257
 
258
258
  <div id="footer">
259
- Generated on Wed Apr 17 15:24:09 2013 by
259
+ Generated on Wed May 15 11:10:01 2013 by
260
260
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
261
261
  0.8.6.1 (ruby-1.9.3).
262
262
  </div>
@@ -198,7 +198,7 @@
198
198
  </div>
199
199
 
200
200
  <div id="footer">
201
- Generated on Wed Apr 17 15:24:09 2013 by
201
+ Generated on Wed May 15 11:10:01 2013 by
202
202
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
203
203
  0.8.6.1 (ruby-1.9.3).
204
204
  </div>
@@ -106,7 +106,7 @@
106
106
  <dt id="VERSION-constant" class="">VERSION =
107
107
 
108
108
  </dt>
109
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.2.1</span><span class='tstring_end'>&quot;</span></span></pre></dd>
109
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.2.2</span><span class='tstring_end'>&quot;</span></span></pre></dd>
110
110
 
111
111
  </dl>
112
112
 
@@ -122,7 +122,7 @@
122
122
  </div>
123
123
 
124
124
  <div id="footer">
125
- Generated on Wed Apr 17 15:24:09 2013 by
125
+ Generated on Wed May 15 11:10:01 2013 by
126
126
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
127
127
  0.8.6.1 (ruby-1.9.3).
128
128
  </div>
@@ -108,7 +108,7 @@
108
108
  </div>
109
109
 
110
110
  <div id="footer">
111
- Generated on Wed Apr 17 15:24:09 2013 by
111
+ Generated on Wed May 15 11:10:01 2013 by
112
112
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
113
113
  0.8.6.1 (ruby-1.9.3).
114
114
  </div>
data/doc/R509.html CHANGED
@@ -108,7 +108,7 @@
108
108
  </div>
109
109
 
110
110
  <div id="footer">
111
- Generated on Wed Apr 17 15:24:09 2013 by
111
+ Generated on Wed May 15 11:10:01 2013 by
112
112
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
113
113
  0.8.6.1 (ruby-1.9.3).
114
114
  </div>
data/doc/_index.html CHANGED
@@ -197,7 +197,7 @@
197
197
  </div>
198
198
 
199
199
  <div id="footer">
200
- Generated on Wed Apr 17 15:24:09 2013 by
200
+ Generated on Wed May 15 11:10:00 2013 by
201
201
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
202
202
  0.8.6.1 (ruby-1.9.3).
203
203
  </div>
data/doc/file.README.html CHANGED
@@ -127,7 +127,7 @@
127
127
  <p>Optional POST parameters:</p>
128
128
 
129
129
  <ul>
130
- <li>reason (must be an integer, if it&#39;s not provided it defaults to 0)</li>
130
+ <li>reason (must be an integer or nil. nil by default)</li>
131
131
  </ul>
132
132
 
133
133
  <p>The revoke method returns the newly generated CRL, after revocation.</p>
@@ -200,7 +200,7 @@
200
200
  </div></div>
201
201
 
202
202
  <div id="footer">
203
- Generated on Wed Apr 17 15:24:09 2013 by
203
+ Generated on Wed May 15 11:10:00 2013 by
204
204
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
205
205
  0.8.6.1 (ruby-1.9.3).
206
206
  </div>
data/doc/index.html CHANGED
@@ -127,7 +127,7 @@
127
127
  <p>Optional POST parameters:</p>
128
128
 
129
129
  <ul>
130
- <li>reason (must be an integer, if it&#39;s not provided it defaults to 0)</li>
130
+ <li>reason (must be an integer or nil. nil by default)</li>
131
131
  </ul>
132
132
 
133
133
  <p>The revoke method returns the newly generated CRL, after revocation.</p>
@@ -200,7 +200,7 @@
200
200
  </div></div>
201
201
 
202
202
  <div id="footer">
203
- Generated on Wed Apr 17 15:24:09 2013 by
203
+ Generated on Wed May 15 11:10:00 2013 by
204
204
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
205
205
  0.8.6.1 (ruby-1.9.3).
206
206
  </div>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Wed Apr 17 15:24:09 2013 by
106
+ Generated on Wed May 15 11:10:01 2013 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.6.1 (ruby-1.9.3).
109
109
  </div>
@@ -130,6 +130,11 @@ module R509
130
130
 
131
131
  if params.has_key?("extensions") and params["extensions"].has_key?("subjectAlternativeName")
132
132
  san_names = params["extensions"]["subjectAlternativeName"].select { |name| not name.empty? }
133
+ elsif params.has_key?("extensions") and params["extensions"].has_key?("dNSNames")
134
+ san_names = R509::ASN1::GeneralNames.new
135
+ params["extensions"]["dNSNames"].select{ |name| not name.empty? }.each do |name|
136
+ san_names.create_item(:tag => 2, :value => name.strip)
137
+ end
133
138
  else
134
139
  san_names = []
135
140
  end
@@ -1,7 +1,7 @@
1
1
  module R509
2
2
  module CertificateAuthority
3
3
  module HTTP
4
- VERSION="0.2.1"
4
+ VERSION="0.2.2"
5
5
  end
6
6
  end
7
7
  end
data/spec/http_spec.rb CHANGED
@@ -133,6 +133,38 @@ describe R509::CertificateAuthority::HTTP::Server do
133
133
  last_response.should be_ok
134
134
  last_response.body.should == "signed cert"
135
135
  end
136
+ it "issues a CSR with dNSNames" do
137
+ csr = double("csr")
138
+ @csr_factory.should_receive(:build).with(:csr => "csr").and_return(csr)
139
+ @validity_period_converter.should_receive(:convert).with("365").and_return({:not_before => 1, :not_after => 2})
140
+ subject = R509::Subject.new [["CN", "domain.com"]]
141
+ @subject_parser.should_receive(:parse).with(anything, "subject").and_return(subject)
142
+ general_names = double("general names")
143
+ R509::ASN1::GeneralNames.should_receive(:new).and_return(general_names)
144
+ general_names.should_receive(:create_item).with(:tag => 2, :value => "domain1.com")
145
+ general_names.should_receive(:create_item).with(:tag => 2, :value => "domain2.com")
146
+ cert = double("cert")
147
+ @certificate_authorities["test_ca"].should_receive(:sign).with(:csr => csr, :profile_name => "profile", :subject => subject, :san_names => general_names, :not_before => 1, :not_after => 2).and_return(cert)
148
+ cert.should_receive(:to_pem).and_return("signed cert")
149
+
150
+ post "/1/certificate/issue", "ca" => "test_ca", "profile" => "profile", "subject" => "subject", "validityPeriod" => 365, "csr" => "csr", "extensions[dNSNames][]" => ["domain1.com","domain2.com"]
151
+ last_response.should be_ok
152
+ last_response.body.should == "signed cert"
153
+ end
154
+ it "issues a CSR with both SAN names and dNSNames provided (and ignore the dNSNames)" do
155
+ csr = double("csr")
156
+ @csr_factory.should_receive(:build).with(:csr => "csr").and_return(csr)
157
+ @validity_period_converter.should_receive(:convert).with("365").and_return({:not_before => 1, :not_after => 2})
158
+ subject = R509::Subject.new [["CN", "domain.com"]]
159
+ @subject_parser.should_receive(:parse).with(anything, "subject").and_return(subject)
160
+ cert = double("cert")
161
+ @certificate_authorities["test_ca"].should_receive(:sign).with(:csr => csr, :profile_name => "profile", :subject => subject, :san_names => ["domain1.com", "domain2.com"], :not_before => 1, :not_after => 2).and_return(cert)
162
+ cert.should_receive(:to_pem).and_return("signed cert")
163
+
164
+ post "/1/certificate/issue", "ca" => "test_ca", "profile" => "profile", "subject" => "subject", "validityPeriod" => 365, "csr" => "csr", "extensions[subjectAlternativeName][]" => ["domain1.com","domain2.com"], "extensions[dNSNames][]" => ["domain3.com", "domain4.com"]
165
+ last_response.should be_ok
166
+ last_response.body.should == "signed cert"
167
+ end
136
168
  it "issues an SPKI without SAN extensions" do
137
169
  @validity_period_converter.should_receive(:convert).with("365").and_return({:not_before => 1, :not_after => 2})
138
170
  subject = R509::Subject.new [["CN", "domain.com"]]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r509-ca-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-17 00:00:00.000000000 Z
12
+ date: 2013-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: r509
16
- requirement: &2161942760 !ruby/object:Gem::Requirement
16
+ requirement: &2154140280 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.9.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2161942760
24
+ version_requirements: *2154140280
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sinatra
27
- requirement: &2161942340 !ruby/object:Gem::Requirement
27
+ requirement: &2154139840 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2161942340
35
+ version_requirements: *2154139840
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dependo
38
- requirement: &2161941880 !ruby/object:Gem::Requirement
38
+ requirement: &2154139360 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2161941880
46
+ version_requirements: *2154139360
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &2161941460 !ruby/object:Gem::Requirement
49
+ requirement: &2154138900 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2161941460
57
+ version_requirements: *2154138900
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rack-test
60
- requirement: &2161941040 !ruby/object:Gem::Requirement
60
+ requirement: &2154138480 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2161941040
68
+ version_requirements: *2154138480
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
- requirement: &2161940620 !ruby/object:Gem::Requirement
71
+ requirement: &2154138060 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2161940620
79
+ version_requirements: *2154138060
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: simplecov
82
- requirement: &2161940200 !ruby/object:Gem::Requirement
82
+ requirement: &2154137580 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2161940200
90
+ version_requirements: *2154137580
91
91
  description: A HTTP CA API for r509
92
92
  email: sirsean@gmail.com
93
93
  executables: []
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  version: '0'
155
155
  segments:
156
156
  - 0
157
- hash: -833608814562001051
157
+ hash: 2820993732791311661
158
158
  requirements: []
159
159
  rubyforge_project:
160
160
  rubygems_version: 1.8.10