eassl2 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +24 -0
- data/LICENSE.txt +57 -0
- data/README.txt +10 -0
- data/Rakefile +53 -0
- data/Readme.mkd +44 -0
- data/VERSION +1 -0
- data/eassl2.gemspec +93 -0
- data/lib/eassl/authority_certificate.rb +59 -0
- data/lib/eassl/certificate.rb +87 -0
- data/lib/eassl/certificate_authority.rb +46 -0
- data/lib/eassl/certificate_name.rb +41 -0
- data/lib/eassl/key.rb +70 -0
- data/lib/eassl/serial.rb +33 -0
- data/lib/eassl/signing_request.rb +55 -0
- data/lib/eassl.rb +71 -0
- data/test/CA/cacert.pem +17 -0
- data/test/CA/cakey.pem +18 -0
- data/test/CA/serial.txt +1 -0
- data/test/certificate.pem +23 -0
- data/test/csr.pem +11 -0
- data/test/encrypted_key.pem +9 -0
- data/test/helper.rb +21 -0
- data/test/test_eassl.rb +33 -0
- data/test/test_eassl_authority_certificate.rb +60 -0
- data/test/test_eassl_certificate.rb +109 -0
- data/test/test_eassl_certificate_authority.rb +126 -0
- data/test/test_eassl_key.rb +106 -0
- data/test/test_eassl_key_csr.rb +29 -0
- data/test/test_eassl_sign_cert.rb +35 -0
- data/test/test_eassl_signing_request.rb +62 -0
- data/test/unencrypted_key.pem +6 -0
- data/test/unencrypted_key2.pem +27 -0
- metadata +141 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEasslKeyCsr < Test::Unit::TestCase
|
4
|
+
def test_generate_self_signed
|
5
|
+
|
6
|
+
options = {
|
7
|
+
:country => "GB",
|
8
|
+
:state => "London",
|
9
|
+
:city => "London",
|
10
|
+
:organization => "Venda Ltd",
|
11
|
+
:department => "Development",
|
12
|
+
:email => "ssl@dev.venda.com",
|
13
|
+
:common_name => "foo.dev.venda.com"
|
14
|
+
}
|
15
|
+
|
16
|
+
ea_key = EaSSL::Key.new
|
17
|
+
ea_name = EaSSL::CertificateName.new(options)
|
18
|
+
ea_csr = EaSSL::SigningRequest.new(:name => ea_name, :key => ea_key)
|
19
|
+
|
20
|
+
csr = OpenSSL::X509::Request.new ea_csr.ssl.to_s
|
21
|
+
assert csr
|
22
|
+
|
23
|
+
assert_equal "/C=GB/ST=London/L=London/O=Venda Ltd/OU=Development/CN=foo.dev.venda.com/emailAddress=ssl@dev.venda.com", csr.subject.to_s
|
24
|
+
|
25
|
+
key = OpenSSL::PKey::RSA.new ea_key.private_key.to_s
|
26
|
+
assert key
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEasslSignCert < Test::Unit::TestCase
|
4
|
+
def test_sign_csr
|
5
|
+
|
6
|
+
csr_text = <<CSR
|
7
|
+
-----BEGIN CERTIFICATE REQUEST-----
|
8
|
+
MIIBhDCB7gIBADBFMQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEh
|
9
|
+
MB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEB
|
10
|
+
AQUAA4GNADCBiQKBgQC+RvNakUHlmlT3jMtkVx0Eajv6sxtzyk0qmSRKHU9/2q+1
|
11
|
+
3/jUM9fnc18hDBoI9PsObJc8CueXFnOVN9fyaQQXyr/mesvYgNn+XTSkE8HWiFSP
|
12
|
+
CMD3Sc8picEFEW5G/ZDrkqmygIY9E/kk9tQmWFolfIjWCTQPe/xh0f9kK/MkYwID
|
13
|
+
AQABoAAwDQYJKoZIhvcNAQEFBQADgYEAp5Bf2vGSzAB9uhWZ3bDPmAcvFDgXRSrk
|
14
|
+
3qlsOLDFy2uxHZxrJROo89YstwHMEDPHN2uNMpMaAfT2aiAVwQbjeu7/wQ5rnf35
|
15
|
+
LY18Mf/fqkFIqSolbHhaV3j1MvBMseAj3GidItX/HZiwzU2dSsb36o8KthkO5IX1
|
16
|
+
9R2JzARogT0=
|
17
|
+
-----END CERTIFICATE REQUEST-----
|
18
|
+
CSR
|
19
|
+
|
20
|
+
ca_path = File.join(File.dirname(__FILE__), 'CA')
|
21
|
+
ca = EaSSL::CertificateAuthority.load(:ca_path => ca_path, :ca_password => '1234')
|
22
|
+
csr = EaSSL::SigningRequest.new.load(csr_text)
|
23
|
+
cert = EaSSL::Certificate.new(:signing_request => csr, :ca_certificate => ca.certificate)
|
24
|
+
cert.sign(ca.key)
|
25
|
+
|
26
|
+
c = OpenSSL::X509::Certificate.new cert.to_pem
|
27
|
+
assert c
|
28
|
+
|
29
|
+
# subject from CSR text above
|
30
|
+
assert_equal '/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd', c.subject.to_s
|
31
|
+
|
32
|
+
# issuer from test CA
|
33
|
+
assert_equal "/C=US/O=Venda/OU=auto-CA/CN=CA", c.issuer.to_s
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestEasslSigningRequest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_new_csr_gen_default_key
|
6
|
+
name = EaSSL::CertificateName.new(:common_name => 'foo.bar.com')
|
7
|
+
csr = EaSSL::SigningRequest.new(:name => name)
|
8
|
+
assert csr
|
9
|
+
assert_equal "/C=US/ST=North Carolina/L=Fuquay Varina/O=WebPower Design/OU=Web Security/CN=foo.bar.com/emailAddress=eassl@rubyforge.org", csr.subject.to_s
|
10
|
+
assert csr.key
|
11
|
+
assert_equal 2048, csr.key.length
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_new_csr_specify_key
|
15
|
+
file = File.join(File.dirname(__FILE__), 'unencrypted_key2.pem')
|
16
|
+
key = EaSSL::Key.load(file)
|
17
|
+
name = EaSSL::CertificateName.new(:common_name => 'foo.bar.com')
|
18
|
+
csr = EaSSL::SigningRequest.new(:name => name, :key => key)
|
19
|
+
assert csr
|
20
|
+
assert_equal "/C=US/ST=North Carolina/L=Fuquay Varina/O=WebPower Design/OU=Web Security/CN=foo.bar.com/emailAddress=eassl@rubyforge.org", csr.subject.to_s
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_load_csr_file
|
24
|
+
file = File.join(File.dirname(__FILE__), 'csr.pem')
|
25
|
+
csr = EaSSL::SigningRequest.load(file)
|
26
|
+
assert csr
|
27
|
+
assert_equal '/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd', csr.subject.to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_load_csr_text
|
31
|
+
csr_text = <<CSR
|
32
|
+
-----BEGIN CERTIFICATE REQUEST-----
|
33
|
+
MIIBhDCB7gIBADBFMQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEh
|
34
|
+
MB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEB
|
35
|
+
AQUAA4GNADCBiQKBgQC+RvNakUHlmlT3jMtkVx0Eajv6sxtzyk0qmSRKHU9/2q+1
|
36
|
+
3/jUM9fnc18hDBoI9PsObJc8CueXFnOVN9fyaQQXyr/mesvYgNn+XTSkE8HWiFSP
|
37
|
+
CMD3Sc8picEFEW5G/ZDrkqmygIY9E/kk9tQmWFolfIjWCTQPe/xh0f9kK/MkYwID
|
38
|
+
AQABoAAwDQYJKoZIhvcNAQEFBQADgYEAp5Bf2vGSzAB9uhWZ3bDPmAcvFDgXRSrk
|
39
|
+
3qlsOLDFy2uxHZxrJROo89YstwHMEDPHN2uNMpMaAfT2aiAVwQbjeu7/wQ5rnf35
|
40
|
+
LY18Mf/fqkFIqSolbHhaV3j1MvBMseAj3GidItX/HZiwzU2dSsb36o8KthkO5IX1
|
41
|
+
9R2JzARogT0=
|
42
|
+
-----END CERTIFICATE REQUEST-----
|
43
|
+
CSR
|
44
|
+
csr = EaSSL::SigningRequest.new.load(csr_text)
|
45
|
+
assert csr
|
46
|
+
assert_equal '/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd', csr.subject.to_s
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_load_nonexistent_file
|
50
|
+
assert_raises Errno::ENOENT do
|
51
|
+
key = EaSSL::SigningRequest.load('./foo')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_load_bad_file
|
56
|
+
file = File.join(File.dirname(__FILE__), '..', 'Rakefile')
|
57
|
+
assert_raises RuntimeError do
|
58
|
+
key = EaSSL::SigningRequest.load(file)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIGsAgEAAiEAy57X7ZFkqicM+Nb9kOjCBs0Fz3dc3F3nhqx9cDnwHaMCAwEAAQIh
|
3
|
+
ALOYKsOzVaJuRxbEKWpCob5hIpOCJqwmdA9cFbrEv9zhAhEA/B/sb8dzCvaFM/p5
|
4
|
+
Bt6Y7QIRAM7AD/gt+xiWUH8z+ra7js8CEQCXelqkofFloc1P+GnkjbLVAhAriPXT
|
5
|
+
5JrDCqPYpTFd2RCxAhEA+WMGuSLXT3xK5XP/LHIiVg==
|
6
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1,27 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIEpAIBAAKCAQEAw9G3VIUg4bLOKIjAab7iUvplYWm2O0CeCO7eDnOO5ChtBjLi
|
3
|
+
SoJAca0bE/8T1IYs10lsihuNSQgjqlBm87crrzNPTR/QmMUBxII15IBW8FL4pgcX
|
4
|
+
CBpniUtFzlxdTrvq9P9bg7U+v5VTcd7bMhvfpVikK9oyLMmDnEHakd1MzXW4kukR
|
5
|
+
u6QecjXZGzT7brzH7aRJ7boTJWfx/elAh6GPwBFaMOShQbBNDB4e+19yfRUeXHM5
|
6
|
+
pS/2fhQXXDWc0x9WZ9VTNjRfFGUl6RhYNMz3MpMWZV6Tibkg/kmWtNlmHwI+libt
|
7
|
+
s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nXi4uJMYu4L1hTBe
|
22
|
+
1ummhxdCGWkWGqkl4ei0tN4qMAkf1SrmNAs4bq2NOCynttnyB8LZT7xGSvFHp9Mn
|
23
|
+
UXCLhtyaGizYgO1yi623JY0PhQniIZa76RXnLxqxj7zllvaZz8acsb42zxfn/2TS
|
24
|
+
EBm1/10CgYBHVOKSK5JRtzw2uEzjr/CQhR3Eckxlh487yJuH4nOaXiUP4qBzeuV3
|
25
|
+
O8DtW1+lHVIlJhaiTCQnqUJIagSBk0IltOu+f1w13i0+BAMsK7HIhy3KNBP93fB/
|
26
|
+
MV+O+vFlY9kvVWXaRrLkZnUDF5klZSf59RokH1E5oq7xKTGvjdOpig==
|
27
|
+
-----END RSA PRIVATE KEY-----
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eassl2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Paul Nicholson
|
9
|
+
- Paul Meserve
|
10
|
+
- Chris Andrews
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
date: 2012-07-20 00:00:00.000000000Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: bundler
|
18
|
+
requirement: &2158396340 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.0.0
|
24
|
+
type: :development
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *2158396340
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jeweler
|
29
|
+
requirement: &2158393240 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.5.2
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *2158393240
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rcov
|
40
|
+
requirement: &2158392540 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
type: :development
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *2158392540
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: simplecov
|
51
|
+
requirement: &2158391940 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *2158391940
|
60
|
+
description: This gem is a more featureful but still drop-in replacement for eassl
|
61
|
+
0.1.1643
|
62
|
+
email: chris@nodnol.org
|
63
|
+
executables: []
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files:
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.txt
|
68
|
+
files:
|
69
|
+
- .document
|
70
|
+
- Gemfile
|
71
|
+
- Gemfile.lock
|
72
|
+
- LICENSE.txt
|
73
|
+
- README.txt
|
74
|
+
- Rakefile
|
75
|
+
- Readme.mkd
|
76
|
+
- VERSION
|
77
|
+
- eassl2.gemspec
|
78
|
+
- lib/eassl.rb
|
79
|
+
- lib/eassl/authority_certificate.rb
|
80
|
+
- lib/eassl/certificate.rb
|
81
|
+
- lib/eassl/certificate_authority.rb
|
82
|
+
- lib/eassl/certificate_name.rb
|
83
|
+
- lib/eassl/key.rb
|
84
|
+
- lib/eassl/serial.rb
|
85
|
+
- lib/eassl/signing_request.rb
|
86
|
+
- test/CA/cacert.pem
|
87
|
+
- test/CA/cakey.pem
|
88
|
+
- test/CA/serial.txt
|
89
|
+
- test/certificate.pem
|
90
|
+
- test/csr.pem
|
91
|
+
- test/encrypted_key.pem
|
92
|
+
- test/helper.rb
|
93
|
+
- test/test_eassl.rb
|
94
|
+
- test/test_eassl_authority_certificate.rb
|
95
|
+
- test/test_eassl_certificate.rb
|
96
|
+
- test/test_eassl_certificate_authority.rb
|
97
|
+
- test/test_eassl_key.rb
|
98
|
+
- test/test_eassl_key_csr.rb
|
99
|
+
- test/test_eassl_sign_cert.rb
|
100
|
+
- test/test_eassl_signing_request.rb
|
101
|
+
- test/unencrypted_key.pem
|
102
|
+
- test/unencrypted_key2.pem
|
103
|
+
homepage: http://github.com/chrisa/eassl
|
104
|
+
licenses:
|
105
|
+
- Ruby
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
segments:
|
117
|
+
- 0
|
118
|
+
hash: -1370647162444039818
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 1.8.6
|
128
|
+
signing_key:
|
129
|
+
specification_version: 3
|
130
|
+
summary: EaSSL is a library aimed at making openSSL certificate generation and management
|
131
|
+
easier and more ruby-ish.
|
132
|
+
test_files:
|
133
|
+
- test/helper.rb
|
134
|
+
- test/test_eassl.rb
|
135
|
+
- test/test_eassl_authority_certificate.rb
|
136
|
+
- test/test_eassl_certificate.rb
|
137
|
+
- test/test_eassl_certificate_authority.rb
|
138
|
+
- test/test_eassl_key.rb
|
139
|
+
- test/test_eassl_key_csr.rb
|
140
|
+
- test/test_eassl_sign_cert.rb
|
141
|
+
- test/test_eassl_signing_request.rb
|