SecureSockets2 2.01 Beta
Copyright (c) RISC OS Developments 2026. All rights reserved.
CDDL 1.0

SecureSockets2 is one shared TLS module based on OpenSSL 3.5.9 LTS. Its
binary is SecureSockets2, while its registered module title is SecureSockets
2.00 so historic Secure_* clients work unchanged. It supports TLS 1.2 and
TLS 1.3, certificate-chain validation and optional hostname checking.
The module and its OpenSSL engine use the ARMv4 instruction-set baseline,
supporting ARMv4 RISC OS 4 systems as well as later ARM machines.

Where it lives
--------------
!SecureSockets2 belongs in !Boot.Resources, where the boot sequence finds
it and sets SecureSockets2$Dir. Programs that need it load it with
  RMEnsure SecureSockets 2.01 Run <SecureSockets2$Dir>.!Run
Archives that use SecureSockets2 carry it in a !Boot folder: open
Configure, choose Boot, then Merge, and drag that !Boot folder to the
window. Merging also brings the current certificate store (below).

Reading large amounts of data
-----------------------------
Secure_Read returns at most one TLS record (16384 bytes) per call, whatever
the buffer size, so always read in a loop until you have all the data. See
SecureDocs for the details, including how to wait on the socket safely.

Certificates
------------
SecureSockets2 trusts the RISC OS certificate store, InetDBase:CertData
(!Boot.Resources.!Internet.files.CertData), the same store AcornSSL uses.
It is the Mozilla root list, published by RISC OS Open in the InetRes
sources. *SecureSockets2Status names the Mozilla date of the store in use.

Keeping the store up to date
----------------------------
SecureSockets2 can replace InetDBase:CertData with a newer one, but only
with one approved by a manifest signed with the offline RISC OS
Developments key. The manifest lists every certificate of the new store;
SecureSockets2 reads the candidate with the same OpenSSL code that will
load it, refuses anything but plain certificates, and installs it only if
its certificates are exactly those listed and the manifest is newer than
the last one installed. The previous store is kept beside it as
CertDataOld, and every decision is logged in Choices:SecureSockets2.CertLog.

CertUpdate, in this directory, does this automatically. !Boot starts it
once per session; it checks at most once every IntervalDays (30) and does
nothing at all until a signed manifest is published and named in
Choices:SecureSockets2.Update, a text file of Key:Value lines:
  ManifestURL:https://.../CertData.tlsc
  CertDataURL:https://gitlab.riscosopen.org/RiscOS/Sources/SystemRes/InetRes/-/raw/master/Resources/files/CertData
  IntervalDays:30
CertDataURL defaults to the address above. To check at once and see the
result:
  *WimpTask Run <SecureSockets2$Dir>.CertUpdate -now

A store can also be installed by hand, for example from removable media:
  *SecureSockets2InstallCerts [-check] <CertData> <manifest>

Signed updates stay unavailable until a production public key is built in;
until then SecureSockets2 refuses every manifest and the store is changed
only by merging !Boot.

Commands:
  *SecureSockets2Status
  *SecureSockets2InstallCerts [-check] <certificates> <manifest>
  *SecureSockets2Load <signed-manifest>
  *SecureSockets2Check <signed-manifest>
  *SecureSockets2Deactivate
The last three manage LanMan98's additional-trust manifest, which also
stays inactive until a production key is installed.

The public interface is the historic Secure_* SWI family at &54280. It is
provided directly by this one module; the old TLSManager/SecureSockets2
private SWI interface is no longer exported. Historic hostname-less clients
such as !AntiSpam receive certificate-chain verification. Updated clients
can also pass a hostname for SNI and DNS-name verification; see SecureDocs.

The public interface supports up to eight live connections. SecureSockets2
cannot be killed while connections are open. There is no second module file
and no System:Modules.Secure copy.

OpenSSL retains its Apache-2.0 licence. See the OpenSSL directory for its
licence, acknowledgements and exact source identity. SecureSockets2 and
CertUpdate are CDDL-1.0, Copyright RISC OS Developments 2026.
