All Projects → Fr0sT-Brutal → Delphi_SChannelTLS

Fr0sT-Brutal / Delphi_SChannelTLS

Licence: MIT license
Helper functions and socket classes to perform TLS communication by means of WinAPI (SChannel)

Programming Languages

pascal
1382 projects

Projects that are alternatives of or similar to Delphi SChannelTLS

boost-wintls
Native Windows TLS stream wrapper for use with boost::asio
Stars: ✭ 24 (+9.09%)
Mutual labels:  tls, schannel
ssl-cert-check
Check expiry dates of local and remote SSL certificates
Stars: ✭ 28 (+27.27%)
Mutual labels:  tls
WIZ750SR
WIZnet Serial to Ethernet(S2E) module based on W7500 chip, WIZ107/108SR S2E compatible device
Stars: ✭ 13 (-40.91%)
Mutual labels:  tls
sslcontext-kickstart
🔐 A lightweight high level library for configuring a http client or server based on SSLContext or other properties such as TrustManager, KeyManager or Trusted Certificates to communicate over SSL TLS for one way authentication or two way authentication provided by the SSLFactory. Support for Java, Scala and Kotlin based clients with examples. Av…
Stars: ✭ 295 (+1240.91%)
Mutual labels:  tls
pelauncher
Portable Executable launcher for Windows NT bypassing loader
Stars: ✭ 49 (+122.73%)
Mutual labels:  winapi
sqlite-gui
Lightweight SQLite editor for Windows
Stars: ✭ 151 (+586.36%)
Mutual labels:  winapi
Captain
Captain Claw external hack
Stars: ✭ 18 (-18.18%)
Mutual labels:  winapi
gls
goroutine local storage (use context instead if possible)
Stars: ✭ 52 (+136.36%)
Mutual labels:  tls
UptimeFaker
Generic Windows library designed to help detecting issues related to high PC uptime
Stars: ✭ 53 (+140.91%)
Mutual labels:  winapi
openssl
Fork of OpenSSL that includes prototype quantum-resistant algorithms and ciphersuites based on liboqs
Stars: ✭ 215 (+877.27%)
Mutual labels:  tls
ical2json
A simple node package to convert ical data to json
Stars: ✭ 46 (+109.09%)
Mutual labels:  ics
python-jicson
python ics to json lib
Stars: ✭ 11 (-50%)
Mutual labels:  ics
acmed
ACME (RFC 8555) client daemon
Stars: ✭ 121 (+450%)
Mutual labels:  tls
MaiSense
Touch Sensor Emulation for SDEY - 💦 Touchlaundry Disco
Stars: ✭ 110 (+400%)
Mutual labels:  winapi
TLS-Redirection
TLS Redirection
Stars: ✭ 109 (+395.45%)
Mutual labels:  tls
v2ray-tls-websocket-nginx
🌎The ULTIMATE V2Ray proxy configuration powered by Project V.
Stars: ✭ 29 (+31.82%)
Mutual labels:  tls
Inflame
User-mode Windows DLL injector written in Assembly language (FASM syntax) with WinAPI.
Stars: ✭ 63 (+186.36%)
Mutual labels:  winapi
AsciiImage
AsciiImage for Delphi
Stars: ✭ 34 (+54.55%)
Mutual labels:  delphinuspackage
cero
Scrape domain names from SSL certificates of arbitrary hosts
Stars: ✭ 316 (+1336.36%)
Mutual labels:  tls
every2cal
🙌에브리타임 캘린더를 ics파일로 바꿔줍니다
Stars: ✭ 33 (+50%)
Mutual labels:  ics

Delphi SChannel (TLS with WinAPI)

SChannel is Windows built-in implementation of TLS protocols. This allows supporting secure connections without any external library.

Repo contains:

  • SChannel.Utils.pas - unit with transport-agnostic helper functions for easy implementation of TLS communication by means of Windows SChannel.

  • SChannel.SyncHandshake.pas - sample of transport-agnostic synchronous TLS handshake using callback functions for real communication

  • SChannel.Jwa*.pas - API declarations borrowed from JEDI project

  • SChannel.IcsWSocket.pas - ICS TWSocket descendant that performs TLS communication

  • Demo\ - demo project for performing any textual (mainly HTTPS) requests via secure connection

  • Enable TLS 1.1 and 1.2 for W7.reg - registry patch that enables TLS 1.1 and 1.2 on Windows 7 (these are actual protocol versions that are not enabled by default on W7)

Installation

There are no installable components - you can just download sources, add paths and use units. But if you prefer packages, there are two of them created with RAD XE2. Just open one of them in IDE and it should upgrade the package to current version.

  • SChannel_XE2.dproj contains all units except ICS socket. Use it if you have no ICS installed
  • SChannel_XE2_ICS.dproj contains all units including ICS socket in SChannel.IcsWSocket.pas. Requires ICS installed

Both packages are configured to build units to ..\Bin\$(Config)\$(Platform) to reduce mess and avoid recompiling SChannel units each time a project is built. So you can add SChannel\Bin\Release\$(Platform) to your Search path and SChannel\Source to Browsing path. In this case don't forget to build the package for all platforms you use. After that installation is complete.

Installation via Delphinus

Installation via Delphinus package manager is also possible. However, it's an initial version that has some limitations:

  • Search path entry will point to sources folder
  • Package is not built

Developer note

This project was started because I needed TLS in my Delphi apps and didn't like shipping two OpenSSL libs. Initial version was 1:1 rewrite of SChannel sample found in Internet. Currently it is used in my 24*7 projects but I implemented only those functions which I needed. I'm not familiar with all this cryptostuff so don't expect advanced certificate validations, secure servers and so on. But if you wish to add something missing I'll consider your PR with pleasure :).

Note - SChannel bug

There's SChannel bug that causes functions rarely and randomly return SEC_E_BUFFER_TOO_SMALL or SEC_E_MESSAGE_ALTERED status during handshake. Good description of the issue could be found here (in brief: it only happens on Windows 7 and 8, with TLSv1.2 and TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 and TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 cipher suites). To deal with the issue, several measures were taken:

  1. Increased number of buffers for handshake (what cURL team did) - didn't help

  2. Added function IsWinHandshakeBug to SChannel.Utils.pas that allows to conveniently check for the bug in except section of a DoClientHandshake call. Just a helper to make special processing like

    ...
    try
      DoClientHandshake(FSessionData, FHandShakeData);
    except on E: ESSPIError do
      // Hide Windows handshake bug and restart the process
      if (FHandShakeData.Stage = hssReadSrvHello) and IsWinHandshakeBug(E.SecStatus) then
      begin
        Log(Format('Handshake bug: "%s", retrying', [E.Message]));
        DeleteContext(FHandShakeData.hContext);
        DoHandshakeStart;
        Exit;
      end
      else
        raise E;
    end;
    ...
  3. TSChannelWSocket class from IcsSChannelSocket.pas and PerformClientHandshake function from SChannel.SyncHandshake.pas already implement one-time retrying invisibly to a caller.

IcsSChannelSocket

Socket class descending from ICS TWSocket that does many things for you. Key features:

  • Automatic handshake retry when handshake bug (see above) is encountered
  • TLS channel could be started/finished at any moment by setting Secure property; OnTLSDone and OnTLSShutdown events will signal channel state
  • Session data could be shared between multiple sockets with SessionData.SharedCreds property. When sessions are shared, handshake becomes significantly shorter so it worths it
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].