r509-ca-http 0.1

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.
Files changed (41) hide show
  1. data/README.md +122 -0
  2. data/Rakefile +38 -0
  3. data/doc/R509.html +117 -0
  4. data/doc/R509/CertificateAuthority.html +117 -0
  5. data/doc/R509/CertificateAuthority/Http.html +131 -0
  6. data/doc/R509/CertificateAuthority/Http/Factory.html +115 -0
  7. data/doc/R509/CertificateAuthority/Http/Factory/CsrFactory.html +189 -0
  8. data/doc/R509/CertificateAuthority/Http/Factory/SpkiFactory.html +189 -0
  9. data/doc/R509/CertificateAuthority/Http/Server.html +133 -0
  10. data/doc/R509/CertificateAuthority/Http/SubjectParser.html +265 -0
  11. data/doc/R509/CertificateAuthority/Http/ValidityPeriodConverter.html +207 -0
  12. data/doc/_index.html +206 -0
  13. data/doc/class_list.html +53 -0
  14. data/doc/css/common.css +1 -0
  15. data/doc/css/full_list.css +57 -0
  16. data/doc/css/style.css +328 -0
  17. data/doc/file.README.html +209 -0
  18. data/doc/file_list.html +55 -0
  19. data/doc/frames.html +28 -0
  20. data/doc/index.html +209 -0
  21. data/doc/js/app.js +214 -0
  22. data/doc/js/full_list.js +173 -0
  23. data/doc/js/jquery.js +4 -0
  24. data/doc/method_list.html +92 -0
  25. data/doc/top-level-namespace.html +112 -0
  26. data/lib/r509/certificateauthority/http/factory.rb +15 -0
  27. data/lib/r509/certificateauthority/http/server.rb +237 -0
  28. data/lib/r509/certificateauthority/http/subjectparser.rb +33 -0
  29. data/lib/r509/certificateauthority/http/validityperiodconverter.rb +16 -0
  30. data/lib/r509/certificateauthority/http/version.rb +7 -0
  31. data/lib/r509/certificateauthority/http/views/test_issue.erb +85 -0
  32. data/lib/r509/certificateauthority/http/views/test_revoke.erb +31 -0
  33. data/lib/r509/certificateauthority/http/views/test_unrevoke.erb +26 -0
  34. data/spec/fixtures/test_ca.cer +22 -0
  35. data/spec/fixtures/test_ca.key +28 -0
  36. data/spec/fixtures/test_config.yaml +18 -0
  37. data/spec/http_spec.rb +250 -0
  38. data/spec/spec_helper.rb +22 -0
  39. data/spec/subject_parser_spec.rb +51 -0
  40. data/spec/validity_period_converter_spec.rb +79 -0
  41. metadata +165 -0
@@ -0,0 +1,79 @@
1
+ require File.dirname(__FILE__) + "/spec_helper"
2
+
3
+ describe R509::CertificateAuthority::Http::ValidityPeriodConverter do
4
+ before :all do
5
+ @converter = R509::CertificateAuthority::Http::ValidityPeriodConverter.new
6
+ end
7
+
8
+ it "when validity period is nil" do
9
+ expect { @converter.convert(nil) }.to raise_error(ArgumentError, "Must provide validity period")
10
+ end
11
+ it "when validity period is integer, negative" do
12
+ expect { @converter.convert(-1) }.to raise_error(ArgumentError, "Validity period must be positive")
13
+ end
14
+ it "when validity period is string, negative" do
15
+ expect { @converter.convert("-1") }.to raise_error(ArgumentError, "Validity period must be positive")
16
+ end
17
+ it "when validity period is integer, zero" do
18
+ expect { @converter.convert(0) }.to raise_error(ArgumentError, "Validity period must be positive")
19
+ end
20
+ it "when validity period is string, zero" do
21
+ expect { @converter.convert("0") }.to raise_error(ArgumentError, "Validity period must be positive")
22
+ end
23
+ it "when validity period is integer, 86400" do
24
+ not_before = Time.now - 6*60*60
25
+ not_after = Time.now + 1*24*60*60
26
+ period = @converter.convert(86400)
27
+ period[:not_before].to_i.should == not_before.to_i
28
+ period[:not_after].to_i.should == not_after.to_i
29
+ end
30
+ it "when validity period is string, 86400" do
31
+ not_before = Time.now - 6*60*60
32
+ not_after = Time.now + 1*24*60*60
33
+ period = @converter.convert("86400")
34
+ period[:not_before].to_i.should == not_before.to_i
35
+ period[:not_after].to_i.should == not_after.to_i
36
+ end
37
+ it "when validity period is integer, 31536000" do
38
+ not_before = Time.now - 6*60*60
39
+ not_after = Time.now + 365*24*60*60
40
+ period = @converter.convert(31536000)
41
+ period[:not_before].to_i.should == not_before.to_i
42
+ period[:not_after].to_i.should == not_after.to_i
43
+ end
44
+ it "when validity period is string, 31536000" do
45
+ not_before = Time.now - 6*60*60
46
+ not_after = Time.now + 365*24*60*60
47
+ period = @converter.convert("31536000")
48
+ period[:not_before].to_i.should == not_before.to_i
49
+ period[:not_after].to_i.should == not_after.to_i
50
+ end
51
+ it "when validity period is integer, 63072000" do
52
+ not_before = Time.now - 6*60*60
53
+ not_after = Time.now + 730*24*60*60
54
+ period = @converter.convert(63072000)
55
+ period[:not_before].to_i.should == not_before.to_i
56
+ period[:not_after].to_i.should == not_after.to_i
57
+ end
58
+ it "when validity period is string, 63072000" do
59
+ not_before = Time.now - 6*60*60
60
+ not_after = Time.now + 730*24*60*60
61
+ period = @converter.convert("63072000")
62
+ period[:not_before].to_i.should == not_before.to_i
63
+ period[:not_after].to_i.should == not_after.to_i
64
+ end
65
+ it "when validity period is integer, 94608000" do
66
+ not_before = Time.now - 6*60*60
67
+ not_after = Time.now + 1095*24*60*60
68
+ period = @converter.convert(94608000)
69
+ period[:not_before].to_i.should == not_before.to_i
70
+ period[:not_after].to_i.should == not_after.to_i
71
+ end
72
+ it "when validity period is string, 94608000" do
73
+ not_before = Time.now - 6*60*60
74
+ not_after = Time.now + 1095*24*60*60
75
+ period = @converter.convert("94608000")
76
+ period[:not_before].to_i.should == not_before.to_i
77
+ period[:not_after].to_i.should == not_after.to_i
78
+ end
79
+ end
metadata ADDED
@@ -0,0 +1,165 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: r509-ca-http
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sean Schulte
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: r509
16
+ requirement: &2153996280 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.8.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2153996280
25
+ - !ruby/object:Gem::Dependency
26
+ name: sinatra
27
+ requirement: &2153995280 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *2153995280
36
+ - !ruby/object:Gem::Dependency
37
+ name: dependo
38
+ requirement: &2153993860 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *2153993860
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &2153992680 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2153992680
58
+ - !ruby/object:Gem::Dependency
59
+ name: rack-test
60
+ requirement: &2153991840 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2153991840
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: &2153990960 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *2153990960
80
+ - !ruby/object:Gem::Dependency
81
+ name: simplecov
82
+ requirement: &2153969260 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *2153969260
91
+ description: A CA API. What, you want more info?
92
+ email: sirsean@gmail.com
93
+ executables: []
94
+ extensions: []
95
+ extra_rdoc_files: []
96
+ files:
97
+ - README.md
98
+ - Rakefile
99
+ - lib/r509/certificateauthority/http/factory.rb
100
+ - lib/r509/certificateauthority/http/server.rb
101
+ - lib/r509/certificateauthority/http/subjectparser.rb
102
+ - lib/r509/certificateauthority/http/validityperiodconverter.rb
103
+ - lib/r509/certificateauthority/http/version.rb
104
+ - lib/r509/certificateauthority/http/views/test_issue.erb
105
+ - lib/r509/certificateauthority/http/views/test_revoke.erb
106
+ - lib/r509/certificateauthority/http/views/test_unrevoke.erb
107
+ - spec/fixtures/test_ca.cer
108
+ - spec/fixtures/test_ca.key
109
+ - spec/fixtures/test_config.yaml
110
+ - spec/http_spec.rb
111
+ - spec/spec_helper.rb
112
+ - spec/subject_parser_spec.rb
113
+ - spec/validity_period_converter_spec.rb
114
+ - doc/_index.html
115
+ - doc/class_list.html
116
+ - doc/css/common.css
117
+ - doc/css/full_list.css
118
+ - doc/css/style.css
119
+ - doc/file.README.html
120
+ - doc/file_list.html
121
+ - doc/frames.html
122
+ - doc/index.html
123
+ - doc/js/app.js
124
+ - doc/js/full_list.js
125
+ - doc/js/jquery.js
126
+ - doc/method_list.html
127
+ - doc/R509/CertificateAuthority/Http/Factory/CsrFactory.html
128
+ - doc/R509/CertificateAuthority/Http/Factory/SpkiFactory.html
129
+ - doc/R509/CertificateAuthority/Http/Factory.html
130
+ - doc/R509/CertificateAuthority/Http/Server.html
131
+ - doc/R509/CertificateAuthority/Http/SubjectParser.html
132
+ - doc/R509/CertificateAuthority/Http/ValidityPeriodConverter.html
133
+ - doc/R509/CertificateAuthority/Http.html
134
+ - doc/R509/CertificateAuthority.html
135
+ - doc/R509.html
136
+ - doc/top-level-namespace.html
137
+ homepage: http://vikinghammer.com
138
+ licenses: []
139
+ post_install_message:
140
+ rdoc_options: []
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: 1.8.6
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ none: false
151
+ requirements:
152
+ - - ! '>='
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ segments:
156
+ - 0
157
+ hash: -1665680864456780668
158
+ requirements: []
159
+ rubyforge_project:
160
+ rubygems_version: 1.8.10
161
+ signing_key:
162
+ specification_version: 3
163
+ summary: A (relatively) simple certificate authority API written to work with r509
164
+ test_files: []
165
+ has_rdoc: