All Projects → eduardsui → Tlse

eduardsui / Tlse

Licence: bsd-2-clause
Single C file TLS 1.2/1.3 implementation, using tomcrypt as crypto library

Programming Languages

c
50402 projects - #5 most used programming language

Labels

Projects that are alternatives of or similar to Tlse

Kubernetes Under The Hood
This tutorial is someone planning to install a Kubernetes cluster and wants to understand how everything fits together.
Stars: ✭ 279 (-25.6%)
Mutual labels:  tls
Utls
Fork of the Go standard TLS library, providing low-level access to the ClientHello for mimicry purposes.
Stars: ✭ 306 (-18.4%)
Mutual labels:  tls
Certify
Automatic client and server certificate distribution and maintenance
Stars: ✭ 341 (-9.07%)
Mutual labels:  tls
Beast
HTTP and WebSocket built on Boost.Asio in C++11
Stars: ✭ 3,241 (+764.27%)
Mutual labels:  tls
Trojan Go
Go实现的Trojan代理,支持多路复用/路由功能/CDN中转/Shadowsocks混淆插件,多平台,无依赖。A Trojan proxy written in Go. An unidentifiable mechanism that helps you bypass GFW. https://p4gefau1t.github.io/trojan-go/
Stars: ✭ 4,049 (+979.73%)
Mutual labels:  tls
Certmagic
Automatic HTTPS for any Go program: fully-managed TLS certificate issuance and renewal
Stars: ✭ 3,864 (+930.4%)
Mutual labels:  tls
Firefly
Firefly is an asynchronous web framework for rapid development of high-performance web application.
Stars: ✭ 277 (-26.13%)
Mutual labels:  tls
Kadnode
P2P DNS with content key, crypto key and PKI support. DynDNS alternative.
Stars: ✭ 359 (-4.27%)
Mutual labels:  tls
O Saft
O-Saft - OWASP SSL advanced forensic tool
Stars: ✭ 306 (-18.4%)
Mutual labels:  tls
Kore
Kore (https://kore.io) is an easy to use web application platform for writing scalable web APIs in C. Its main goals are security, scalability and allowing rapid development and deployment of such APIs.
Stars: ✭ 3,477 (+827.2%)
Mutual labels:  tls
Ralloc
Mirror of https://gitlab.redox-os.org/redox-os/ralloc
Stars: ✭ 290 (-22.67%)
Mutual labels:  tls
Jetty.project
Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more
Stars: ✭ 3,260 (+769.33%)
Mutual labels:  tls
Tlsfuzzer
SSL and TLS protocol test suite and fuzzer
Stars: ✭ 335 (-10.67%)
Mutual labels:  tls
Swift Nio Ssl
TLS Support for SwiftNIO, based on BoringSSL.
Stars: ✭ 280 (-25.33%)
Mutual labels:  tls
Scapy Ssl tls
SSL/TLS layers for scapy the interactive packet manipulation tool
Stars: ✭ 354 (-5.6%)
Mutual labels:  tls
Certificates
🛡️ A private certificate authority (X.509 & SSH) & ACME server for secure automated certificate management, so you can use TLS everywhere & SSO for SSH.
Stars: ✭ 3,693 (+884.8%)
Mutual labels:  tls
Wolfmqtt
wolfMQTT is a small, fast, portable MQTT client implementation, including support for TLS 1.3.
Stars: ✭ 316 (-15.73%)
Mutual labels:  tls
Illustrated Tls13
The Illustrated TLS 1.3 Connection: Every byte explained
Stars: ✭ 372 (-0.8%)
Mutual labels:  tls
Trustme
#1 quality TLS certs while you wait, for the discerning tester
Stars: ✭ 355 (-5.33%)
Mutual labels:  tls
Acme Client
Let's Encrypt / ACME client written in PHP for the CLI.
Stars: ✭ 337 (-10.13%)
Mutual labels:  tls

TLSe

Single C file TLS 1.3, 1.2, 1.1 and 1.0(without the weak ciphers) implementation, using libtomcrypt as crypto library. It also supports DTLS 1.2 and 1.0. Before using tlse.c you may want to download and compile tomcrypt; alternatively you may use libtomcrypt.c (see Compiling). I'm working at an alternative efficient RSA signing, DH and Curve25519 implementation, to allow the compilation, alternatively, without tomcrypt, on devices where memory and code size is an issue.

Note: It does not implement 0-RTT. Client-side TLS 1.3 support is experimental.

Like this project ? You may donate Bitcoin for this project at 14LqvMzFfaJ82C7wY5iavvTf9HPELYWsax

Compiling

Simple TLS client: $ gcc tlshello.c -o tlshello -ltomcrypt -ltommath -DLTM_DESC

For debuging tls connections, the DEBUG flag must be set (-DDEBUG).

Simple TLS server: $ gcc tlsserverhello.c -o tlsserverhello -ltomcrypt -ltommath -DLTM_DESC

The entire library is a single c file that you just include in your source.

The library may also use the libtomcrypt.c amalgamation. In this case, the client may be compiled:

$ gcc tlshello.c -o tlshello -DTLS_AMALGAMATION

and the server:

$ gcc tlsserverhello.c -o tlsserverhello -DTLS_AMALGAMATION

tlse.h is optional (is safe to just include tlse.c). Alternatively, you may include tlse.h and add tlse.c to your makefile (useful when linking against C++).

If thread-safety is needed, you need to call tls_init() before letting any other threads in, and not use the same object from multiple threads without a mutex. Other than that, TLSe and libtomcrypt are thread-safe. Also, you may want to define LTC_PTHREAD if you're using libtomcrypt.

TLSe supports KTLS on linux kernel 4.13 or higher. KTLS is a TLS implementation in the linux kernel. If TLS_RX is not defined, KTLS is send-only (you may use send/sendfile to send data, but you may not use recv). Also, the negotiation must be handled by TLSe. If KTLS support is needed, define WITH_KTLS (compile with -DWITH_KTLS). Note that is not clear which header should be included for linux structure, you may need to check these structures and constants: https://github.com/torvalds/linux/blob/master/Documentation/networking/tls.txt.

Usage

You just #include "tlse.c" in your code. Everything is a single file.

Features

The main feature of this implementation is the ability to serialize TLS context, via tls_export_context and re-import it, via tls_import_context in another pre-forked worker process (socket descriptor may be sent via sendmsg).

For now it supports TLS 1.2, TLS 1.1 + 1.0 (when TLS_LEGACY_SUPPORT is defined / default is on), RSA, ECDSA, DHE, ECDHE ciphers: TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256` and `TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384.

The following ciphers are supported but disabled by default: TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_GCM_SHA384. To enable these ciphers, TLSe must be compiled with -DNO_TLS_ROBOT_MITIGATION. ROBOT attack is mitigated by default, but it is recommended to disable RSA encryption to avoid future vulnerabilities.

TLSe now supports ChaCha20/Poly1305 ciphers: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 and TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256. These ciphers are enabled by default.

It has a low level interface, efficient for non-blocking, asynchronous sockets, and a blocking, libssl-style interface.

It implements all that is needed for the TLS protocol version 1.2 and a pem/der parser. From tomcrypt it uses RSA, ECDSA and AES(GCM and CBC) encryption/decryption, SHA1, SHA256, SHA384, SHA512 and HMAC functions.

Now it supports client certificate. To request a client certificate, call tls_request_client_certificate(TLSContext *) following tls_accept(TLSContext *).

It implements SNI extension (Server Name Indication). To get the SNI string call tls_sni(TLSContext *). It also implements SCSV and ALPN (see tls_add_alpn(struct TLSContext *, const char *) and const char *tls_alpn(struct TLSContext *).

The library supports certificate validation by using tls_certificate_chain_is_valid, tls_certificate_chain_is_valid_root, tls_certificate_valid_subject and tls_certificate_is_valid(checks not before/not after). Note that certificates fed to tls_certificate_chain_is_valid must be in correct order (certificate 2 signs certificate 1, certificate 3 signs certificate 2 and so on; also certificate 1 (first) is the certificate to be used in key exchange).

This library was written to be used by my other projects Concept Applications Server and Concept Native Client

Examples

  1. examples/tlsclienthello.c simple client example
  2. examples/tlshelloworld.c simple server example
  3. examples/tlssimple.c simple blocking client using libssl-ish API
  4. examples/tlssimpleserver.c simple blocking server using libssl-ish API

After compiling the examples, in the working directory, you should put fullchain.pem and privkey.pem in a directory called testcert for running the server examples. I've used letsencrypt for certificate generation (is free!).

Important security note

Note that for DTLS, it doesn't implement a state machine, so using this DTLS implementation with UDP (server) may expose your server to DoS attack.

License

Public domain, BSD, MIT. Choose one.

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].