polarssl 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +36 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/COPYING +674 -0
- data/COPYING.LESSER +171 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +20 -0
- data/RDOC_MAIN.rdoc +33 -0
- data/README.md +111 -0
- data/Rakefile +37 -0
- data/ext/polarssl/ctr_drbg.c +80 -0
- data/ext/polarssl/ctr_drbg.h +1 -0
- data/ext/polarssl/entropy.c +72 -0
- data/ext/polarssl/entropy.h +1 -0
- data/ext/polarssl/extconf.rb +13 -0
- data/ext/polarssl/polarssl.c +39 -0
- data/ext/polarssl/polarssl.h +3 -0
- data/ext/polarssl/ssl.c +415 -0
- data/ext/polarssl/ssl.h +1 -0
- data/lib/.gitkeep +0 -0
- data/lib/polarssl.rb +6 -0
- data/polarssl-ruby.sublime-project +8 -0
- data/polarssl.gemspec +21 -0
- data/test/ctr_drbg_test.rb +10 -0
- data/test/entropy_test.rb +14 -0
- data/test/ssl_connection_test.rb +41 -0
- data/test/test_helper.rb +2 -0
- data/test/verify_minitest_test.rb +9 -0
- metadata +77 -0
data/ext/polarssl/ssl.h
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
void Init_ssl();
|
data/lib/.gitkeep
ADDED
File without changes
|
data/lib/polarssl.rb
ADDED
data/polarssl.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
lib = File.expand_path("../lib/", __FILE__)
|
2
|
+
$:.unshift lib unless $:.include?(lib)
|
3
|
+
|
4
|
+
require 'polarssl/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'polarssl'
|
8
|
+
s.version = PolarSSL::VERSION
|
9
|
+
s.date = '2013-08-20'
|
10
|
+
s.summary = 'Use the PolarSSL cryptographic and SSL library in Ruby.'
|
11
|
+
s.description = 'A gem that lets you use the PolarSSL cryptography library with Ruby.'
|
12
|
+
s.authors = ['Michiel Sikkes']
|
13
|
+
s.email = 'michiel.sikkes@gmail.com'
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.homepage = 'http://github.com/michiels/polarssl-ruby'
|
16
|
+
s.license = 'LGPL-3'
|
17
|
+
s.test_files = Dir.glob('test/*_test.rb')
|
18
|
+
s.requirements = 'libpolarssl'
|
19
|
+
|
20
|
+
s.extensions = %w[ext/polarssl/extconf.rb]
|
21
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
require 'socket'
|
3
|
+
|
4
|
+
class SSLConnectionTest < MiniTest::Unit::TestCase
|
5
|
+
|
6
|
+
def test_simple_connection
|
7
|
+
|
8
|
+
socket = TCPSocket.new('polarssl.org', 443)
|
9
|
+
|
10
|
+
entropy = PolarSSL::Entropy.new
|
11
|
+
|
12
|
+
ctr_drbg = PolarSSL::CtrDrbg.new(entropy)
|
13
|
+
|
14
|
+
ssl = PolarSSL::SSL.new
|
15
|
+
|
16
|
+
ssl.set_endpoint(PolarSSL::SSL::SSL_IS_CLIENT)
|
17
|
+
ssl.set_authmode(PolarSSL::SSL::SSL_VERIFY_NONE)
|
18
|
+
ssl.set_rng(ctr_drbg)
|
19
|
+
|
20
|
+
ssl.set_socket(socket)
|
21
|
+
|
22
|
+
ssl.handshake
|
23
|
+
|
24
|
+
ssl.write("GET / HTTP/1.0\r\nHost: polarssl.org\r\n\r\n")
|
25
|
+
|
26
|
+
response = ""
|
27
|
+
|
28
|
+
while chunk = ssl.read(1024)
|
29
|
+
response << chunk
|
30
|
+
end
|
31
|
+
|
32
|
+
assert response.length > 0
|
33
|
+
|
34
|
+
ssl.close_notify
|
35
|
+
|
36
|
+
socket.close
|
37
|
+
|
38
|
+
ssl.close
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: polarssl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michiel Sikkes
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-20 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A gem that lets you use the PolarSSL cryptography library with Ruby.
|
14
|
+
email: michiel.sikkes@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions:
|
17
|
+
- ext/polarssl/extconf.rb
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- .gitignore
|
21
|
+
- .ruby-version
|
22
|
+
- .travis.yml
|
23
|
+
- COPYING
|
24
|
+
- COPYING.LESSER
|
25
|
+
- Gemfile
|
26
|
+
- Gemfile.lock
|
27
|
+
- RDOC_MAIN.rdoc
|
28
|
+
- README.md
|
29
|
+
- Rakefile
|
30
|
+
- ext/polarssl/ctr_drbg.c
|
31
|
+
- ext/polarssl/ctr_drbg.h
|
32
|
+
- ext/polarssl/entropy.c
|
33
|
+
- ext/polarssl/entropy.h
|
34
|
+
- ext/polarssl/extconf.rb
|
35
|
+
- ext/polarssl/polarssl.c
|
36
|
+
- ext/polarssl/polarssl.h
|
37
|
+
- ext/polarssl/ssl.c
|
38
|
+
- ext/polarssl/ssl.h
|
39
|
+
- lib/.gitkeep
|
40
|
+
- lib/polarssl.rb
|
41
|
+
- polarssl-ruby.sublime-project
|
42
|
+
- polarssl.gemspec
|
43
|
+
- test/ctr_drbg_test.rb
|
44
|
+
- test/entropy_test.rb
|
45
|
+
- test/ssl_connection_test.rb
|
46
|
+
- test/test_helper.rb
|
47
|
+
- test/verify_minitest_test.rb
|
48
|
+
homepage: http://github.com/michiels/polarssl-ruby
|
49
|
+
licenses:
|
50
|
+
- LGPL-3
|
51
|
+
metadata: {}
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements:
|
67
|
+
- libpolarssl
|
68
|
+
rubyforge_project:
|
69
|
+
rubygems_version: 2.0.2
|
70
|
+
signing_key:
|
71
|
+
specification_version: 4
|
72
|
+
summary: Use the PolarSSL cryptographic and SSL library in Ruby.
|
73
|
+
test_files:
|
74
|
+
- test/ctr_drbg_test.rb
|
75
|
+
- test/entropy_test.rb
|
76
|
+
- test/ssl_connection_test.rb
|
77
|
+
- test/verify_minitest_test.rb
|