ruby-tls 1.0.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +100 -71
- data/lib/ruby-tls.rb +5 -7
- data/lib/ruby-tls/ssl.rb +582 -0
- data/lib/ruby-tls/version.rb +3 -3
- data/ruby-tls.gemspec +30 -32
- data/spec/client.crt +31 -31
- data/spec/client.key +51 -51
- data/spec/comms_spec.rb +110 -156
- data/spec/verify_spec.rb +155 -120
- metadata +37 -47
- data/EM-LICENSE +0 -60
- data/Rakefile +0 -19
- data/ext/Rakefile +0 -18
- data/ext/tls/page.cpp +0 -102
- data/ext/tls/page.h +0 -61
- data/ext/tls/ssl.cpp +0 -594
- data/ext/tls/ssl.h +0 -130
- data/lib/ruby-tls/connection.rb +0 -124
- data/lib/ruby-tls/ext.rb +0 -39
data/lib/ruby-tls/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module RubyTls
|
2
|
-
VERSION = "
|
3
|
-
end
|
1
|
+
module RubyTls
|
2
|
+
VERSION = "2.0.0"
|
3
|
+
end
|
data/ruby-tls.gemspec
CHANGED
@@ -1,32 +1,30 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "ruby-tls/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "ruby-tls"
|
7
|
-
s.version = RubyTls::VERSION
|
8
|
-
s.authors = ["Stephen von Takach"]
|
9
|
-
s.email = ["steve@cotag.me"]
|
10
|
-
s.licenses = ["
|
11
|
-
s.homepage = "https://github.com/cotag/ruby-tls"
|
12
|
-
s.summary = "Abstract TLS for Ruby"
|
13
|
-
s.description = <<-EOF
|
14
|
-
Allows transport layers outside Ruby TCP be secured.
|
15
|
-
EOF
|
16
|
-
|
17
|
-
|
18
|
-
s.add_dependency 'ffi-compiler', '>= 0.0.2'
|
19
|
-
s.add_dependency '
|
20
|
-
|
21
|
-
s.add_development_dependency 'rspec'
|
22
|
-
s.add_development_dependency 'yard'
|
23
|
-
|
24
|
-
|
25
|
-
s.files = Dir["{lib}/**/*"] + %w(
|
26
|
-
s.
|
27
|
-
s.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
s.require_paths = ["lib"]
|
32
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "ruby-tls/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "ruby-tls"
|
7
|
+
s.version = RubyTls::VERSION
|
8
|
+
s.authors = ["Stephen von Takach"]
|
9
|
+
s.email = ["steve@cotag.me"]
|
10
|
+
s.licenses = ["MIT"]
|
11
|
+
s.homepage = "https://github.com/cotag/ruby-tls"
|
12
|
+
s.summary = "Abstract TLS for Ruby"
|
13
|
+
s.description = <<-EOF
|
14
|
+
Allows transport layers outside Ruby TCP be secured.
|
15
|
+
EOF
|
16
|
+
|
17
|
+
|
18
|
+
s.add_dependency 'ffi-compiler', '>= 0.0.2'
|
19
|
+
s.add_dependency 'thread_safe'
|
20
|
+
|
21
|
+
s.add_development_dependency 'rspec'
|
22
|
+
s.add_development_dependency 'yard'
|
23
|
+
|
24
|
+
|
25
|
+
s.files = Dir["{lib}/**/*"] + %w(ruby-tls.gemspec README.md)
|
26
|
+
s.test_files = Dir["spec/**/*"]
|
27
|
+
s.extra_rdoc_files = ["README.md"]
|
28
|
+
|
29
|
+
s.require_paths = ["lib"]
|
30
|
+
end
|
data/spec/client.crt
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
MIIFRDCCAywCAQEwDQYJKoZIhvcNAQEFBQAwaDELMAkGA1UEBhMCRU0xFTATBgNV
|
3
|
-
BAgTDEV2ZW50TWFjaGluZTEVMBMGA1UEChMMRXZlbnRNYWNoaW5lMRQwEgYDVQQL
|
4
|
-
EwtEZXZlbG9wbWVudDEVMBMGA1UEAxMMRXZlb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WyXYfgsV2DSVOiK
|
43
|
+
iufjfoDzg5lLCEI+1XW3/LunrB/W4yPN1X/amf8234ublYyt+2ucD4NUGnP05xLa
|
44
|
+
N6P7M0MwdEEKkvMe0YBBSFH5kWK/dIOjqkgBDes20fVnuuz/tL1dZW7IiIP4dzaV
|
45
|
+
ZGEOwBEatCfqYetv6b/u3IUxDfS7Wg8CggEBALoOwkn5LGdQg+bpdZAKJspGnJWL
|
46
|
+
Kyr9Al2tvgc69rxfpZqS5eDLkYYCzWPpspSt0Axm1O7xOUDQDt42luaLNGJzHZ2Q
|
47
|
+
Hn0ZNMhyHpe8d8mIQngRjD+nuLI/uFUglPzabDOCOln2aycjg1mA6ecXP1XMEVbu
|
48
|
+
0RB/0IE36XTMfZ+u9+TRjkBLpmUaX1FdIQQWfwUou/LfaXotoQlhSGAcprLrncuJ
|
49
|
+
T44UATYEgO/q9pMM33bdE3eBYZHoT9mSvqoLCN4s0LuwOYItIxLKUj0GulL0VQOI
|
50
|
+
SZi+0A1c8cVDXgApkBrWPDQIR9JS4de0gW4hnDoUvHtUc2TYPRnz6N9MtFY=
|
51
|
+
-----END RSA PRIVATE KEY-----
|
data/spec/comms_spec.rb
CHANGED
@@ -1,156 +1,110 @@
|
|
1
|
-
require 'ruby-tls'
|
2
|
-
|
3
|
-
describe RubyTls do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
@
|
9
|
-
@
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
@
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
end
|
112
|
-
@server.decrypt(data) unless @client_stop
|
113
|
-
end
|
114
|
-
@client.handshake_cb do
|
115
|
-
@client_data << 'ready'
|
116
|
-
@interleaved << 'client ready'
|
117
|
-
|
118
|
-
@client.encrypt('client request') unless @client_stop
|
119
|
-
end
|
120
|
-
|
121
|
-
|
122
|
-
@server.close_cb do
|
123
|
-
@server_data << 'server stop'
|
124
|
-
@interleaved << 'server stop'
|
125
|
-
@server_stop = true
|
126
|
-
end
|
127
|
-
@server.dispatch_cb do |data|
|
128
|
-
@server_data << data
|
129
|
-
@interleaved << data
|
130
|
-
@server.encrypt('server response') unless @server_stop
|
131
|
-
end
|
132
|
-
@server.transmit_cb do |data|
|
133
|
-
@client.decrypt(data) unless @server_stop
|
134
|
-
end
|
135
|
-
@server.handshake_cb do
|
136
|
-
@server_data << 'ready'
|
137
|
-
@interleaved << 'server ready'
|
138
|
-
end
|
139
|
-
|
140
|
-
@client.start
|
141
|
-
@client.cleanup
|
142
|
-
@server.cleanup
|
143
|
-
|
144
|
-
# Calls to encrypt should not cause crashes after cleanup
|
145
|
-
@server.encrypt('server response')
|
146
|
-
@client.encrypt('client request')
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
expect(@client_data).to eq(['ready', 'server response'])
|
151
|
-
expect(@server_data).to eq(['ready', 'client request'])
|
152
|
-
expect(@interleaved).to eq(['server ready', 'client ready', 'client request', 'server response'])
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
1
|
+
require 'ruby-tls'
|
2
|
+
|
3
|
+
describe RubyTls do
|
4
|
+
|
5
|
+
describe RubyTls::SSL::Box do
|
6
|
+
|
7
|
+
it "should be able to send and receive encrypted comms" do
|
8
|
+
@server_data = []
|
9
|
+
@client_data = []
|
10
|
+
@interleaved = []
|
11
|
+
|
12
|
+
|
13
|
+
class Client1
|
14
|
+
def initialize(client_data, interleaved)
|
15
|
+
@client_data = client_data
|
16
|
+
@interleaved = interleaved
|
17
|
+
@ssl = RubyTls::SSL::Box.new(false, self)
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_reader :ssl
|
21
|
+
attr_accessor :stop
|
22
|
+
attr_accessor :server
|
23
|
+
|
24
|
+
def close_cb
|
25
|
+
@client_data << 'client stopped'
|
26
|
+
@interleaved << 'client stopped'
|
27
|
+
@stop = true
|
28
|
+
end
|
29
|
+
|
30
|
+
def dispatch_cb(data)
|
31
|
+
@client_data << data
|
32
|
+
@interleaved << data
|
33
|
+
end
|
34
|
+
|
35
|
+
def transmit_cb(data)
|
36
|
+
if not @server.started
|
37
|
+
@server.started = true
|
38
|
+
@server.ssl.start
|
39
|
+
end
|
40
|
+
@server.ssl.decrypt(data) unless @stop
|
41
|
+
end
|
42
|
+
|
43
|
+
def handshake_cb
|
44
|
+
@client_data << 'ready'
|
45
|
+
@interleaved << 'client ready'
|
46
|
+
|
47
|
+
sending = 'client request'
|
48
|
+
@ssl.encrypt(sending) unless @stop
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
class Server1
|
54
|
+
def initialize(client, server_data, interleaved)
|
55
|
+
@client = client
|
56
|
+
@server_data = server_data
|
57
|
+
@interleaved = interleaved
|
58
|
+
@ssl = RubyTls::SSL::Box.new(true, self)
|
59
|
+
end
|
60
|
+
|
61
|
+
attr_reader :ssl
|
62
|
+
attr_accessor :started
|
63
|
+
attr_accessor :stop
|
64
|
+
|
65
|
+
def close_cb
|
66
|
+
@server_data << 'server stop'
|
67
|
+
@interleaved << 'server stop'
|
68
|
+
@stop = true
|
69
|
+
end
|
70
|
+
|
71
|
+
def dispatch_cb(data)
|
72
|
+
@server_data << data
|
73
|
+
@interleaved << data
|
74
|
+
|
75
|
+
sending = 'server response'
|
76
|
+
@ssl.encrypt(sending) unless @stop
|
77
|
+
end
|
78
|
+
|
79
|
+
def transmit_cb(data)
|
80
|
+
@client.ssl.decrypt(data) unless @stop
|
81
|
+
end
|
82
|
+
|
83
|
+
def handshake_cb
|
84
|
+
@server_data << 'ready'
|
85
|
+
@interleaved << 'server ready'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
@client = Client1.new(@client_data, @interleaved)
|
91
|
+
@server = Server1.new(@client, @server_data, @interleaved)
|
92
|
+
@client.server = @server
|
93
|
+
|
94
|
+
|
95
|
+
@client.ssl.start
|
96
|
+
@client.ssl.cleanup
|
97
|
+
@server.ssl.cleanup
|
98
|
+
|
99
|
+
|
100
|
+
# Calls to encrypt should not cause crashes after cleanup
|
101
|
+
@server.ssl.encrypt('server response')
|
102
|
+
@client.ssl.encrypt('client request')
|
103
|
+
|
104
|
+
expect(@server_data).to eq(['ready', 'client request'])
|
105
|
+
expect(@client_data).to eq(['ready', 'server response'])
|
106
|
+
expect(@interleaved).to eq(['server ready', 'client ready', 'client request', 'server response'])
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|