mirror of
https://github.com/BepInEx/Il2Cpp.TlsAdapter.git
synced 2026-11-21 07:29:28 -10:00
master
Il2Cpp TLS Providers for Mono 6.12
Implements common Mono TLS providers for modding Unity games which use Il2Cpp runtime.
This allows to use HTTPS the same way you'd do it in a normal Unity game using Mono runtime.
Currently, this repo implements the following TLS providers:
- UnityTls -- official Unity TLS provider adapted from unity-mono repository
- LegacyTls -- port of old mono SSL 1.0-3.0 and TLS 1.0 providers to new Mobile TLS API
All TLS providers were updated for use with Mono 6.12.
How to use
If you use BepInEx
You don't have to do anything: this adapter is automatically included and initialized by BepInEx core.
You can use normal HTTP/HTTPS API like you are used to.
If you don't use BepInEx
If you don't write BepInEx plugins, you have to bootstrap this adapter yourself.
To do this:
- Download latest version of the bootstrapper from releases.
- Download latest version of HarmonyX from releases.
- In your main code, reference
Il2Cpp.TlsAdapter.dlland include the following line before using any HTTP/HTTPS requests:This will initialize the adapter and automatically pick the best available TLS provider.using Il2Cpp.TlsAdapter; Il2CppTlsAdapter.Initialize(); - Optional: To enable UnityTLS, you need to provide pointer to the UnityTLS native interface with:
If no interface is specified, LegacyTls is used instead.
Il2CppTlsAdapter.Options.UnityTlsInterface = /* Obtain and assign the interface pointer */:
WIP The tool is not ready yet: for example UnityTls is not configurable and Initialze doesn't do much interesting at the moment.