All Projects → Asmod4n → Mruby Tls

Asmod4n / Mruby Tls

Licence: apache-2.0
mruby wrapper for libtls from http://www.libressl.org/

Programming Languages

c
50402 projects - #5 most used programming language

Labels

Projects that are alternatives of or similar to Mruby Tls

Netcoreserver
Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
Stars: ✭ 799 (+15880%)
Mutual labels:  ssl, tls
Pyopenssl
A Python wrapper around the OpenSSL library
Stars: ✭ 701 (+13920%)
Mutual labels:  ssl, tls
S2n Tls
s2n : an implementation of the TLS/SSL protocols
Stars: ✭ 4,029 (+80480%)
Mutual labels:  ssl, tls
Scapy Ssl tls
SSL/TLS layers for scapy the interactive packet manipulation tool
Stars: ✭ 354 (+6980%)
Mutual labels:  ssl, tls
Certigo
A utility to examine and validate certificates in a variety of formats
Stars: ✭ 662 (+13140%)
Mutual labels:  ssl, tls
Trustme
#1 quality TLS certs while you wait, for the discerning tester
Stars: ✭ 355 (+7000%)
Mutual labels:  ssl, tls
Twisted
Event-driven networking engine written in Python.
Stars: ✭ 4,442 (+88740%)
Mutual labels:  ssl, tls
Jetty.project
Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more
Stars: ✭ 3,260 (+65100%)
Mutual labels:  ssl, tls
Mitmproxy
An interactive TLS-capable intercepting HTTP proxy for penetration testers and software developers.
Stars: ✭ 25,495 (+509800%)
Mutual labels:  ssl, tls
Cppserver
Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
Stars: ✭ 528 (+10460%)
Mutual labels:  ssl, tls
Acme Client
Let's Encrypt / ACME client written in PHP for the CLI.
Stars: ✭ 337 (+6640%)
Mutual labels:  ssl, tls
Devcert
Local HTTPS development made easy
Stars: ✭ 655 (+13000%)
Mutual labels:  ssl, tls
Tlsfuzzer
SSL and TLS protocol test suite and fuzzer
Stars: ✭ 335 (+6600%)
Mutual labels:  ssl, tls
Illustrated Tls13
The Illustrated TLS 1.3 Connection: Every byte explained
Stars: ✭ 372 (+7340%)
Mutual labels:  ssl, tls
O Saft
O-Saft - OWASP SSL advanced forensic tool
Stars: ✭ 306 (+6020%)
Mutual labels:  ssl, tls
Ssl Proxy
🔒 Simple zero-config SSL reverse proxy with real autogenerated certificates (LetsEncrypt, self-signed, provided)
Stars: ✭ 427 (+8440%)
Mutual labels:  ssl, tls
Kubernetes Under The Hood
This tutorial is someone planning to install a Kubernetes cluster and wants to understand how everything fits together.
Stars: ✭ 279 (+5480%)
Mutual labels:  ssl, tls
Beast
HTTP and WebSocket built on Boost.Asio in C++11
Stars: ✭ 3,241 (+64720%)
Mutual labels:  ssl, tls
Pem
Create private keys and certificates with node.js
Stars: ✭ 496 (+9820%)
Mutual labels:  ssl, tls
Testssl.sh
Testing TLS/SSL encryption anywhere on any port
Stars: ✭ 5,676 (+113420%)
Mutual labels:  ssl, tls

mruby-tls

Prerequisites

libtls needs to be somewhere the mruby compiler can find it.

For example on macOS you need to add the folowing to your build_config.rb after installing it with brew install libressl

conf.gem mgem: 'mruby-tls' do |spec|
  spec.cc.include_paths << '/usr/local/opt/libressl/include'
  spec.linker.library_paths << '/usr/local/opt/libressl/lib'
end

By default libtls looks in /etc/ssl/cert.pem for ca certs, you can find how to change that in the examples below.

Example

client = Tls::Client.new
client.connect('github.com:443').write("GET / HTTP/1.1\r\nHost: github.com\r\nConnection: close\r\n\r\n")
print client.read
client.close

Its also possible to connect via service descriptions.

client.connect('github.com', 'https')

You can also use port numbers as the second Argument.

client.connect('github.com', '443')

If your ca certs are in another path.

client = Tls::Client.new(ca_file: '/usr/local/etc/libressl/cert.pem')

If you later want to change a config setting

client.config.ca_file = '/etc/ssl/cert.pem'

You can also create a configuration object to share with several connections.

config = Tls::Config.new # see https://github.com/Asmod4n/mruby-tls/blob/master/mrblib/config.rb for options.

client = Tls::Client.new config

You can later on change the configuration object

client.config = config

Server example

openssl ecparam -name secp256r1 -genkey -out private-key.pem
openssl req -new -x509 -key private-key.pem -out server.pem
tls_server = Tls::Server.new(key_file: 'private-key.pem', cert_file: 'server.pem')
tcp_server = TCPServer.new 5000 # requires mruby-socket
tcp_client = tcp_server.accept
tls_client = tls_server.accept_socket tcp_client.fileno
tls_client.write "hallo\n"
tls_client.close

Client Connections don't have a configurable config at the moment

The following Errors can be thrown:

SystemCallError # Errno::*
Tls::WantPollin # The underlying read file descriptor needs to be readable in order to continue.
Tls::WantPollout # The underlying write file descriptor needs to be writeable in order to continue.

This maps the C Api 1:1, to get a overview http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/tls_accept_fds.3?query=tls%5finit&sec=3 is a good starting point.

License

Copyright 2015,2016 Hendrik Beskow

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].