{"id":21158696,"url":"https://github.com/wqweto/vbasyncsocket","last_synced_at":"2026-02-09T08:04:48.451Z","repository":{"id":37561975,"uuid":"124236424","full_name":"wqweto/VbAsyncSocket","owner":"wqweto","description":"Sockets with pure VB6 impl of TLS encryption","archived":false,"fork":false,"pushed_at":"2025-06-24T10:44:42.000Z","size":3836,"stargazers_count":179,"open_issues_count":20,"forks_count":36,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-08-15T09:02:48.381Z","etag":null,"topics":["aead","aes-gcm","aes-ni","async","chacha20-poly1305","ecdsa","ocsp","pbes2","pclmulqdq","secp256r1","ssl","tls","vb6","win98","winhttprequest","winsock","x25519"],"latest_commit_sha":null,"homepage":"","language":"Visual Basic 6.0","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wqweto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-03-07T12:59:46.000Z","updated_at":"2025-07-24T04:32:01.000Z","dependencies_parsed_at":"2023-12-12T11:29:33.271Z","dependency_job_id":"325933a0-a4c4-4d1b-bc51-b1dcfbece3a7","html_url":"https://github.com/wqweto/VbAsyncSocket","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/wqweto/VbAsyncSocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wqweto%2FVbAsyncSocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wqweto%2FVbAsyncSocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wqweto%2FVbAsyncSocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wqweto%2FVbAsyncSocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wqweto","download_url":"https://codeload.github.com/wqweto/VbAsyncSocket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wqweto%2FVbAsyncSocket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271578517,"owners_count":24784051,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aead","aes-gcm","aes-ni","async","chacha20-poly1305","ecdsa","ocsp","pbes2","pclmulqdq","secp256r1","ssl","tls","vb6","win98","winhttprequest","winsock","x25519"],"created_at":"2024-11-20T12:32:20.058Z","updated_at":"2026-02-09T08:04:43.423Z","avatar_url":"https://github.com/wqweto.png","language":"Visual Basic 6.0","funding_links":[],"categories":[],"sub_categories":[],"readme":"## VbAsyncSocket\n\nSimple and thin WinSock API wrappers for VB6 loosly based on the original [`CAsyncSocket`](https://docs.microsoft.com/en-us/cpp/mfc/reference/casyncsocket-class?view=vs-2017) wrapper in [`MFC`](https://docs.microsoft.com/en-us/cpp/mfc/mfc-and-atl?view=vs-2017).\n\n### Description\n\nBase class `cAsyncSocket` wraps OS non-blocking sockets that can be used to implement various network components in VB6 -- clients and servers -- and supports both async and blocking network communications.\n\nAdditionally there is a source-compatible `cTlsSocket` class for transparent TLS transport layer encryption with several crypto backend implementations:\n\n1. `mdTlsThunks` is a pure VB6 with ASM thunks implementation for TLS 1.3 and (legacy) TLS 1.2 client-side and server-side support with no dependency on external libraries (like openssl)\n\n2. `mdTlsNative` is a native client-side and server-side TLS support using OS provided SSPI/Schannel library for all available protocol versions.\n\n3. `mdTlsSodium` is a stripped down compact backend with dependency on libsodium for crypto primitives (no ASM thunking used) with a total compiled size of 64KB.\n\nThe VB6 with thunks backend implementation auto-detects AES-NI and PCLMULQDQ instruction set availability on client machine and switches to [performance optimized implementation of AES](https://github.com/wqweto/VbAsyncSocket/blob/4b7f4d8bc650688e2b6ad5460c997ed1df26d2e0/lib/thunks/sshaes.c#L100-L240)[-GCM](https://github.com/wqweto/VbAsyncSocket/blob/4b7f4d8bc650688e2b6ad5460c997ed1df26d2e0/lib/thunks/gf128.c#L116-L165) which is even faster that OS native SSPI/Schannel implementation of this cipher suit. The VB6 with thunks backend and native backend support legacy OSes up to NT 4.0 and Windows 98 while libsodium DLL is compiled with XP support only.\n\n### Usage\n\nStart by including `src\\cAsyncSocket.cls` in your project to have a convenient wrapper of most WinSock API functions.\n\nOptionally you can add `src\\cTlsSocket.cls` and `src\\mdTlsThunks.bas` pair of source files to your project for TLS secured connections using VB6 with thunks backend or add `src\\cTlsSocket.cls` and `src\\mdTlsNative.bas` pair of source files for an alternative backend using native OS provided SSPI/Schannel library.\n\n#### WinHttpRequest Replacement Class\n\nStart by including `src\\cAsyncSocket.cls`, `src\\cTlsSocket.cls` and `src\\mdTlsThunks.bas` backend for TLS support (or any other backend) and finally add `contrib\\cHttpRequest.cls` for the TLS 1.3 capable source-compatible replacement class.\n\nNotice that the original `Open` method and `Option` property of the `WinHttpRequest` object have been suffixed with an underscore (`_`) in the replacement implementation (a limitation of the VB6 IDE) so some source-code fixes will be required to integrate the replacement `cHttpRequest` class.\n\n#### Sample SMTP with STARTTLS\n\nHere is a working sample with error checking omitted for brevity for accessing smtp.gmail.com over port 587.\n\nAt first the communication goes over unencrypted plain-text socket, then later it is switched to TLS secured one before issuing the final `QUIT` command.\n\n    With New cTlsSocket\n        .SyncConnect \"smtp.gmail.com\", 587, UseTls:=False\n        Debug.Print .SyncReceiveText();\n        .SyncSendText \"HELO 127.0.0.1\" \u0026 vbCrLf\n        Debug.Print .SyncReceiveText();\n        .SyncSendText \"STARTTLS\" \u0026 vbCrLf\n        Debug.Print .SyncReceiveText();\n        .SyncStartTls \"smtp.gmail.com\"\n        Debug.Print \"TLS handshake complete: \" \u0026 .RemoteHostName\n        .SyncSendText \"QUIT\" \u0026 vbCrLf\n        Debug.Print .SyncReceiveText();\n    End With\n\nWhich produces debug output in `Immediate Window` similar to this:\n    \n    220 smtp.gmail.com ESMTP c69sm2955334lfg.23 - gsmtp\n    250 smtp.gmail.com at your service\n    220 2.0.0 Ready to start TLS\n    1428790.043 [INFO] Using TLS_AES_128_GCM_SHA256 from smtp.gmail.com [mdTlsThunks.pvTlsParseHandshakeServerHello]\n    1428790.057 [INFO] Valid ECDSA_SECP256R1_SHA256 signature [mdTlsThunks.pvTlsSignatureVerify]\n    TLS handshake complete: smtp.gmail.com\n    221 2.0.0 closing connection c69sm2955334lfg.23 - gsmtp\n\n### Is it any good?\n\n[Yes](https://news.ycombinator.com/item?id=3067434).\n\n### Implemented Cipher Suites\n\nThis list includes cipher suites as implemented in the ASM thunks backend while the native backend list depends on the OS version and SSPI/Schannel settings.\n\nCipher Suite | First\u0026nbsp;In | Selection String | Notes\n--|--|--|--\n\u003csub\u003e\u003csup\u003eTLS_AES_128_GCM_SHA256                          \u003c/sup\u003e\u003c/sub\u003e|TLS 1.3|EECDH+AESGCM|AEAD\n\u003csub\u003e\u003csup\u003eTLS_AES_256_GCM_SHA384                          \u003c/sup\u003e\u003c/sub\u003e|TLS 1.3|EECDH+AESGCM|AEAD\n\u003csub\u003e\u003csup\u003eTLS_CHACHA20_POLY1305_SHA256                    \u003c/sup\u003e\u003c/sub\u003e|TLS 1.3|EECDH+AESGCM|AEAD\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256         \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|EECDH+AESGCM|AEAD\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256           \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|EECDH+AESGCM|AEAD\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384         \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|EECDH+AESGCM|AEAD\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384           \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|EECDH+AESGCM|AEAD\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256   \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|EECDH+CHACHA20|AEAD\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256     \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|EECDH+CHACHA20|AEAD\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256         \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|EECDH+AES+SHA256|Weak, Exotic\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256           \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|EECDH+AES+SHA256|Weak, Exotic\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384         \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|EECDH+AES+SHA384|Weak, Exotic\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384           \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|EECDH+AES+SHA384|Weak, Exotic\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA            \u003c/sup\u003e\u003c/sub\u003e|TLSv1|EECDH+AES+SHA1|Weak, HMAC-SHA1\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_RSA_WITH_AES_128_CBC_SHA              \u003c/sup\u003e\u003c/sub\u003e|TLSv1|EECDH+AES+SHA1|Weak, HMAC-SHA1\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA            \u003c/sup\u003e\u003c/sub\u003e|TLSv1|EECDH+AES+SHA1|Weak, HMAC-SHA1\n\u003csub\u003e\u003csup\u003eTLS_ECDHE_RSA_WITH_AES_256_CBC_SHA              \u003c/sup\u003e\u003c/sub\u003e|TLSv1|EECDH+AES+SHA1|Weak, HMAC-SHA1\n\u003csub\u003e\u003csup\u003eTLS_RSA_WITH_AES_128_GCM_SHA256                 \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|RSA+AESGCM|Weak, No FS\n\u003csub\u003e\u003csup\u003eTLS_RSA_WITH_AES_256_GCM_SHA384                 \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|RSA+AESGCM|Weak, No FS\n\u003csub\u003e\u003csup\u003eTLS_RSA_WITH_AES_128_CBC_SHA256                 \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|RSA+AES+SHA256|Weak, No FS, Exotic\n\u003csub\u003e\u003csup\u003eTLS_RSA_WITH_AES_256_CBC_SHA256                 \u003c/sup\u003e\u003c/sub\u003e|TLS 1.2|RSA+AES+SHA256|Weak, No FS, Exotic\n\u003csub\u003e\u003csup\u003eTLS_RSA_WITH_AES_128_CBC_SHA                    \u003c/sup\u003e\u003c/sub\u003e|SSLv3|RSA+AES+SHA1|Weak, No FS, HMAC-SHA1\n\u003csub\u003e\u003csup\u003eTLS_RSA_WITH_AES_256_CBC_SHA                    \u003c/sup\u003e\u003c/sub\u003e|SSLv3|RSA+AES+SHA1|Weak, No FS, HMAC-SHA1\n\nNote that \"exotic\" cipher suites are included behind a conditional compilation flag only (off by default).\n\n### Legacy Support\n\nScreenshot from Windows 98 Second Edition running on Pentium II\n\n[\u003cimg src=\"https://dl.unicontsoft.com/upload/pix/ss_vbasyncsocket_win9x.png\" width=\"250\"/\u003e](https://dl.unicontsoft.com/upload/pix/ss_vbasyncsocket_win9x.png)\n\n### ToDo\n\n - [x] Allow client to assign client certificate for connection\n - [x] Provide UI for end-user to choose suitable certificates from Personal certificate store\n - [x] Add wrapper for http protocol\n - [ ] Add wrapper for ftp protocol\n - [x] Add WinSock control replacement\n - [ ] Add more samples (incl. `vbcurl.exe` utility)\n - [x] Refactor subclassing thunk to use msg queue not to re-enter IDE in debug mode\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwqweto%2Fvbasyncsocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwqweto%2Fvbasyncsocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwqweto%2Fvbasyncsocket/lists"}