ruby-tls 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6b5c1cc1141c7f766b1321efc906a5e7c80b43bc
4
- data.tar.gz: 7b4ebd9ce165bb26a5b0c0b90ede1d25548cafe5
5
- SHA512:
6
- metadata.gz: dd6c9eabcc26971ba5f2c8d6c8776578d78b52a09f78a65c16037099056b9d6db0b2863d9fe89a5ef36510478c392edb734b35218f58a027ec249d422fa1826e
7
- data.tar.gz: 75788c47a3e44f23db722fea7ca6b18361603c333b3adeb6f68a0fef4a1f30d0a48ec91393807c6441d416adbe8d790d28b7b275898c8e7d920a76dea24de684
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzZhOGMwMDFjOWZlZDIwZGE5NmUyZTI1OTk3NmYyNTcyYTA4ZjMxNA==
5
+ data.tar.gz: !binary |-
6
+ ZTdlMmE4Y2YyOTdhOTJhNjQ0MmVmNmU1YTExMzA0ODM2NDIxZDQ0Nw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MTZkZTgwMWY3NTMyYjFiZjU1MjkwY2YzZGQxNDkxOGE4M2JjMmNhZGZmZjM2
10
+ OWZkMzgzMmQ0YjA4YzdmNWFlN2MyMWVmYjdmZTYxNjAyYTZlNjUxZmRkNzhk
11
+ OGRhMWRhYTVmMjA1ZTFjMTc5NzgwYWU5ZDkzMTA1MWE0YzIyN2M=
12
+ data.tar.gz: !binary |-
13
+ OTY4N2ExNTYxYWEwNmM1ZTI3ZTI0MTgxNjc3YzZhYjkwM2JhNTkwZDI0YTBj
14
+ MjViYmI2NzZiNWI1OTU0YmUwZTM4MDJhYzk5MmQzY2M4ODQzM2QyZWE3Nzg2
15
+ MjRhNWNkZTBiNWMyNzVlY2JkNmFjN2EyOGZhZGFlMDM2NGM2ODk=
data/EM-LICENSE CHANGED
@@ -1,60 +1,60 @@
1
- EventMachine is copyrighted free software owned by Francis Cianfrocca
2
- (blackhedd ... gmail.com). The Owner of this software permits you to
3
- redistribute and/or modify the software under either the terms of the GPL
4
- version 2 (see the file GPL), or the conditions below ("Ruby License"):
5
-
6
- 1. You may make and give away verbatim copies of the source form of this
7
- software without restriction, provided that you retain ALL of the
8
- original copyright notices and associated disclaimers.
9
-
10
- 2. You may modify your copy of the software in any way, provided that
11
- you do at least ONE of the following:
12
-
13
- a) place your modifications in the Public Domain or otherwise
14
- make them Freely Available, such as by posting said
15
- modifications to Usenet or an equivalent medium, or by allowing
16
- the author to include your modifications in the software.
17
-
18
- b) use the modified software only within your corporation or
19
- organization.
20
-
21
- c) give non-standard binaries non-standard names, with
22
- instructions on where to get the original software distribution.
23
-
24
- d) make other distribution arrangements with the Owner.
25
-
26
- 3. You may distribute the software in object code or binary form,
27
- provided that you do at least ONE of the following:
28
-
29
- a) distribute the binaries and library files of the software,
30
- together with instructions (in a manual page or equivalent)
31
- on where to get the original distribution.
32
-
33
- b) accompany the distribution with the machine-readable source of
34
- the software.
35
-
36
- c) give non-standard binaries non-standard names, with
37
- instructions on where to get the original software distribution.
38
-
39
- d) make other distribution arrangements with the Owner.
40
-
41
- 4. You may modify and include parts of the software into any other
42
- software (possibly commercial), provided you comply with the terms in
43
- Sections 1, 2, and 3 above. But some files in the distribution
44
- are not written by the Owner, so they may be made available to you
45
- under different terms.
46
-
47
- For the list of those files and their copying conditions, see the
48
- file LEGAL.
49
-
50
- 5. The scripts and library files supplied as input to or produced as
51
- output from the software do not automatically fall under the
52
- copyright of the software, but belong to whoever generated them,
53
- and may be sold commercially, and may be aggregated with this
54
- software.
55
-
56
- 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
57
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
58
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
59
- PURPOSE.
60
-
1
+ EventMachine is copyrighted free software owned by Francis Cianfrocca
2
+ (blackhedd ... gmail.com). The Owner of this software permits you to
3
+ redistribute and/or modify the software under either the terms of the GPL
4
+ version 2 (see the file GPL), or the conditions below ("Ruby License"):
5
+
6
+ 1. You may make and give away verbatim copies of the source form of this
7
+ software without restriction, provided that you retain ALL of the
8
+ original copyright notices and associated disclaimers.
9
+
10
+ 2. You may modify your copy of the software in any way, provided that
11
+ you do at least ONE of the following:
12
+
13
+ a) place your modifications in the Public Domain or otherwise
14
+ make them Freely Available, such as by posting said
15
+ modifications to Usenet or an equivalent medium, or by allowing
16
+ the author to include your modifications in the software.
17
+
18
+ b) use the modified software only within your corporation or
19
+ organization.
20
+
21
+ c) give non-standard binaries non-standard names, with
22
+ instructions on where to get the original software distribution.
23
+
24
+ d) make other distribution arrangements with the Owner.
25
+
26
+ 3. You may distribute the software in object code or binary form,
27
+ provided that you do at least ONE of the following:
28
+
29
+ a) distribute the binaries and library files of the software,
30
+ together with instructions (in a manual page or equivalent)
31
+ on where to get the original distribution.
32
+
33
+ b) accompany the distribution with the machine-readable source of
34
+ the software.
35
+
36
+ c) give non-standard binaries non-standard names, with
37
+ instructions on where to get the original software distribution.
38
+
39
+ d) make other distribution arrangements with the Owner.
40
+
41
+ 4. You may modify and include parts of the software into any other
42
+ software (possibly commercial), provided you comply with the terms in
43
+ Sections 1, 2, and 3 above. But some files in the distribution
44
+ are not written by the Owner, so they may be made available to you
45
+ under different terms.
46
+
47
+ For the list of those files and their copying conditions, see the
48
+ file LEGAL.
49
+
50
+ 5. The scripts and library files supplied as input to or produced as
51
+ output from the software do not automatically fall under the
52
+ copyright of the software, but belong to whoever generated them,
53
+ and may be sold commercially, and may be aggregated with this
54
+ software.
55
+
56
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
57
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
58
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
59
+ PURPOSE.
60
+
data/README.md CHANGED
@@ -1,69 +1,69 @@
1
- # ruby-tls
2
-
3
- Ruby-TLS decouples the management of encrypted communications, putting you in charge of the transport layer. It can be used as an alternative to Ruby's SSLSocket.
4
-
5
-
6
- ## Install the gem
7
-
8
- Install it with [RubyGems](https://rubygems.org/)
9
-
10
- gem install ruby-tls
11
-
12
- or add this to your Gemfile if you use [Bundler](http://gembundler.com/):
13
-
14
- gem "ruby-tls"
15
-
16
-
17
- Windows users will require an installation of OpenSSL (32bit or 64bit matching the Ruby installation) and be setup with [Ruby Installers DevKit](http://rubyinstaller.org/downloads/)
18
-
19
-
20
- ## Usage
21
-
22
- ```ruby
23
- require 'rubygems'
24
- require 'ruby-tls'
25
-
26
- #
27
- # Create a new TLS connection and attach callbacks
28
- #
29
- connection = RubyTls::Connection.new do |state|
30
- state.handshake_cb do
31
- puts "TLS handshake complete"
32
- end
33
-
34
- state.transmit_cb do |data|
35
- puts "Data for transmission to remote"
36
- end
37
-
38
- state.dispatch_cb do |data|
39
- puts "Clear text data that has been decrypted"
40
- end
41
-
42
- state.close_cb do |inst, data|
43
- puts "An error occurred, the transport layer should be shutdown"
44
- end
45
- end
46
-
47
- #
48
- # Init the handshake
49
- #
50
- connection.start
51
-
52
- #
53
- # Start sending data to the remote, this will trigger the
54
- # transmit_cb with encrypted data to send.
55
- #
56
- connection.encrypt('client request')
57
-
58
- #
59
- # Similarly when data is received from the remote it should be
60
- # passed to connection.decrypt where the dispatch_cb will be
61
- # called with clear text
62
- #
63
- ```
64
-
65
-
66
- ## License and copyright
67
-
68
- The core SSL code was originally extracted and isolated from [EventMachine](https://github.com/eventmachine/eventmachine/). So is licensed under the same terms, either the GPL or Ruby's License.
69
-
1
+ # ruby-tls
2
+
3
+ Ruby-TLS decouples the management of encrypted communications, putting you in charge of the transport layer. It can be used as an alternative to Ruby's SSLSocket.
4
+
5
+
6
+ ## Install the gem
7
+
8
+ Install it with [RubyGems](https://rubygems.org/)
9
+
10
+ gem install ruby-tls
11
+
12
+ or add this to your Gemfile if you use [Bundler](http://gembundler.com/):
13
+
14
+ gem "ruby-tls"
15
+
16
+
17
+ Windows users will require an installation of OpenSSL (32bit or 64bit matching the Ruby installation) and be setup with [Ruby Installers DevKit](http://rubyinstaller.org/downloads/)
18
+
19
+
20
+ ## Usage
21
+
22
+ ```ruby
23
+ require 'rubygems'
24
+ require 'ruby-tls'
25
+
26
+ #
27
+ # Create a new TLS connection and attach callbacks
28
+ #
29
+ connection = RubyTls::Connection.new do |state|
30
+ state.handshake_cb do
31
+ puts "TLS handshake complete"
32
+ end
33
+
34
+ state.transmit_cb do |data|
35
+ puts "Data for transmission to remote"
36
+ end
37
+
38
+ state.dispatch_cb do |data|
39
+ puts "Clear text data that has been decrypted"
40
+ end
41
+
42
+ state.close_cb do |inst, data|
43
+ puts "An error occurred, the transport layer should be shutdown"
44
+ end
45
+ end
46
+
47
+ #
48
+ # Init the handshake
49
+ #
50
+ connection.start
51
+
52
+ #
53
+ # Start sending data to the remote, this will trigger the
54
+ # transmit_cb with encrypted data to send.
55
+ #
56
+ connection.encrypt('client request')
57
+
58
+ #
59
+ # Similarly when data is received from the remote it should be
60
+ # passed to connection.decrypt where the dispatch_cb will be
61
+ # called with clear text
62
+ #
63
+ ```
64
+
65
+
66
+ ## License and copyright
67
+
68
+ The core SSL code was originally extracted and isolated from [EventMachine](https://github.com/eventmachine/eventmachine/). So is licensed under the same terms, either the GPL or Ruby's License.
69
+
data/Rakefile CHANGED
@@ -1,19 +1,19 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rspec/core/rake_task'
4
-
5
- task :default => [:compile, :test]
6
-
7
- task :compile do
8
- protect = ['ssl.cpp', 'ssl.h', 'page.cpp', 'page.h']
9
- Dir["ext/tls/**/*"].each do |file|
10
- begin
11
- next if protect.include? File.basename(file)
12
- FileUtils.rm file
13
- rescue
14
- end
15
- end
16
- system 'cd ext && rake'
17
- end
18
-
19
- RSpec::Core::RakeTask.new(:test)
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rspec/core/rake_task'
4
+
5
+ task :default => [:compile, :test]
6
+
7
+ task :compile do
8
+ protect = ['ssl.cpp', 'ssl.h', 'page.cpp', 'page.h']
9
+ Dir["ext/tls/**/*"].each do |file|
10
+ begin
11
+ next if protect.include? File.basename(file)
12
+ FileUtils.rm file
13
+ rescue
14
+ end
15
+ end
16
+ system 'cd ext && rake'
17
+ end
18
+
19
+ RSpec::Core::RakeTask.new(:test)
data/ext/Rakefile CHANGED
@@ -1,18 +1,18 @@
1
- require 'ffi-compiler/compile_task'
2
-
3
- FFI::Compiler::CompileTask.new('ruby-tls-ext') do |t|
4
- t.cflags << "-Wall -Wextra -O3"
5
- t.cflags << "-D_GNU_SOURCE=1" if RbConfig::CONFIG["host_os"].downcase =~ /mingw/
6
- t.cflags << "-arch x86_64 -arch i386" if t.platform.mac?
7
- t.ldflags << "-arch x86_64 -arch i386" if t.platform.mac?
8
-
9
- # Link to OpenSSL
10
- if FFI::Platform.windows?
11
- path = File.dirname(ENV["OPENSSL_CONF"])
12
- path = File.expand_path("../", path)
13
- t.cflags << "-I \"#{path}/include\""
14
- t.ldflags << "-L\"#{path}/lib\" -lssleay32 -llibeay32"
15
- else
16
- t.ldflags << "-lssl -lcrypto"
17
- end
18
- end
1
+ require 'ffi-compiler/compile_task'
2
+
3
+ FFI::Compiler::CompileTask.new('ruby-tls-ext') do |t|
4
+ t.cflags << "-Wall -Wextra -O3"
5
+ t.cflags << "-D_GNU_SOURCE=1" if RbConfig::CONFIG["host_os"].downcase =~ /mingw/
6
+ t.cflags << "-arch x86_64 -arch i386" if t.platform.mac?
7
+ t.ldflags << "-arch x86_64 -arch i386" if t.platform.mac?
8
+
9
+ # Link to OpenSSL
10
+ if FFI::Platform.windows?
11
+ path = File.dirname(ENV["OPENSSL_CONF"])
12
+ path = File.expand_path("../", path)
13
+ t.cflags << "-I \"#{path}/include\""
14
+ t.ldflags << "-L\"#{path}/lib\" -lssleay32 -llibeay32"
15
+ else
16
+ t.ldflags << "-lssl -lcrypto"
17
+ end
18
+ end
data/ext/tls/page.cpp CHANGED
@@ -1,107 +1,107 @@
1
- /*****************************************************************************
2
-
3
- $Id$
4
-
5
- File: page.cpp
6
- Date: 30Apr06
7
-
8
- Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
9
- Gmail: blackhedd
10
-
11
- This program is free software; you can redistribute it and/or modify
12
- it under the terms of either: 1) the GNU General Public License
13
- as published by the Free Software Foundation; either version 2 of the
14
- License, or (at your option) any later version; or 2) Ruby's License.
15
-
16
- See the file COPYING for complete licensing information.
17
-
18
- *****************************************************************************/
19
-
20
-
21
- #include "page.h"
22
-
23
-
24
- /******************
25
- PageList::PageList
26
- ******************/
27
-
28
- PageList::PageList()
29
- {
30
- }
31
-
32
-
33
- /*******************
34
- PageList::~PageList
35
- *******************/
36
-
37
- PageList::~PageList()
38
- {
39
- while (HasPages())
40
- PopFront();
41
- }
42
-
43
-
44
- /***************
45
- PageList::Front
46
- ***************/
47
-
48
- void PageList::Front (const char **page, int *length)
49
- {
50
- assert (page && length);
51
-
52
- if (HasPages()) {
53
- Page p = Pages.front();
54
- *page = p.Buffer;
55
- *length = p.Size;
56
- }
57
- else {
58
- *page = NULL;
59
- *length = 0;
60
- }
61
- }
62
-
63
-
64
- /******************
65
- PageList::PopFront
66
- ******************/
67
-
68
- void PageList::PopFront()
69
- {
70
- if (HasPages()) {
71
- Page p = Pages.front();
72
- Pages.pop_front();
73
- if (p.Buffer)
74
- free ((void*)p.Buffer);
75
- }
76
- }
77
-
78
-
79
- /******************
80
- PageList::HasPages
81
- ******************/
82
-
83
- bool PageList::HasPages()
84
- {
85
- return (Pages.size() > 0) ? true : false;
86
- }
87
-
88
-
89
- /**************
90
- PageList::Push
91
- **************/
92
-
93
- void PageList::Push (const char *buf, int size)
94
- {
95
- if (buf && (size > 0)) {
96
- char *copy = (char*) malloc (size);
97
- if (!copy)
98
- throw runtime_error ("no memory in pagelist");
99
- memcpy (copy, buf, size);
100
- Pages.push_back (Page (copy, size));
101
- }
102
- }
103
-
104
-
105
-
106
-
107
-
1
+ /*****************************************************************************
2
+
3
+ $Id$
4
+
5
+ File: page.cpp
6
+ Date: 30Apr06
7
+
8
+ Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
9
+ Gmail: blackhedd
10
+
11
+ This program is free software; you can redistribute it and/or modify
12
+ it under the terms of either: 1) the GNU General Public License
13
+ as published by the Free Software Foundation; either version 2 of the
14
+ License, or (at your option) any later version; or 2) Ruby's License.
15
+
16
+ See the file COPYING for complete licensing information.
17
+
18
+ *****************************************************************************/
19
+
20
+
21
+ #include "page.h"
22
+
23
+
24
+ /******************
25
+ PageList::PageList
26
+ ******************/
27
+
28
+ PageList::PageList()
29
+ {
30
+ }
31
+
32
+
33
+ /*******************
34
+ PageList::~PageList
35
+ *******************/
36
+
37
+ PageList::~PageList()
38
+ {
39
+ while (HasPages())
40
+ PopFront();
41
+ }
42
+
43
+
44
+ /***************
45
+ PageList::Front
46
+ ***************/
47
+
48
+ void PageList::Front (const char **page, int *length)
49
+ {
50
+ assert (page && length);
51
+
52
+ if (HasPages()) {
53
+ Page p = Pages.front();
54
+ *page = p.Buffer;
55
+ *length = p.Size;
56
+ }
57
+ else {
58
+ *page = NULL;
59
+ *length = 0;
60
+ }
61
+ }
62
+
63
+
64
+ /******************
65
+ PageList::PopFront
66
+ ******************/
67
+
68
+ void PageList::PopFront()
69
+ {
70
+ if (HasPages()) {
71
+ Page p = Pages.front();
72
+ Pages.pop_front();
73
+ if (p.Buffer)
74
+ free ((void*)p.Buffer);
75
+ }
76
+ }
77
+
78
+
79
+ /******************
80
+ PageList::HasPages
81
+ ******************/
82
+
83
+ bool PageList::HasPages()
84
+ {
85
+ return (Pages.size() > 0) ? true : false;
86
+ }
87
+
88
+
89
+ /**************
90
+ PageList::Push
91
+ **************/
92
+
93
+ void PageList::Push (const char *buf, int size)
94
+ {
95
+ if (buf && (size > 0)) {
96
+ char *copy = (char*) malloc (size);
97
+ if (!copy)
98
+ throw runtime_error ("no memory in pagelist");
99
+ memcpy (copy, buf, size);
100
+ Pages.push_back (Page (copy, size));
101
+ }
102
+ }
103
+
104
+
105
+
106
+
107
+