Feature notes
Release notes 4.1.5.364
================================================================================
CHANGES - StreamSec Tools
(StreamSec Security Library for Embarcadero Delphi)
================================================================================
Grouped by subject. Entries marked BEHAVIOUR CHANGE alter what existing code
does without any source change on your part - read those before upgrading.
WHAT THIS FILE COVERS. Changes made SINCE release 4.1.5.363, which was
released on 2026-11-09. What that release itself brought is in
CHANGES_4.1.5.363.txt
and every earlier release is archived beside it the same way, one file per
version. So this file is always short: it is the difference between the zip
you have and the one you are looking at, and nothing else.
--------------------------------------------------------------------------------
PLATFORMS: macOS WITH DELPHI XE3 TO XE7
================================================================================
Three units meant for every platform did not compile for macOS with the
oldest compilers the library supports. The failures of entries 1 and 2 were in
every release from 4.1.2.355, the first with the file jail and the SFTP
server, to 4.1.5.363; that of entry 3 in every release from 4.1.1.349 to
4.1.5.363. Nothing changes with any other compiler or on any other platform.
1. FIXED - the file jail did not compile for macOS with Delphi XE3 to XE7, so
neither did the SFTP server, which uses it
stFileJail.Posix (stFileJail, TstSFTPServerSubSystem).
THE STEP THAT FAILED is the one open() call that pins the jail's root
directory. It passed two arguments, and the Posix.Fcntl of XE3 to XE7
declares open with the creation mode as a third argument that cannot be
left out, so the compiler stopped at stFileJail.Posix.pas with E2035 Not
enough actual parameters. From XE8 on the RTL declares open with a
variable argument list, which is why every newer compiler, and every other
platform, compiled the unit. The call now passes 0 as the mode. open reads
the mode only together with O_CREAT, which this call does not use, so the
jail does exactly what it did before wherever it compiled. Windows builds
use stFileJail.Windows and were never affected.
2. FIXED - the SFTP server did not compile for macOS with Delphi XE3 and XE4
StreamSec.SFTP.ServerSubSystem (TstSFTPServerSubSystem).
THE STEP THAT FAILED is the timestamp update of SSH_FXP_SETSTAT, which
calls utimes. XE3 and XE4 declare the timeval record in Posix.SysTime but
not utimes, which reached that unit in XE5, so the compiler stopped with
E2003 Undeclared identifier: 'utimes'. The failure of entry 1 came first
and hid this one. The unit now declares utimes itself for those two
compilers, as the later RTLs declare it, and so calls the same C library
function. Nothing changes with XE5 and later, or on Windows.
3. FIXED - TstCertificateViewer did not compile for macOS with Delphi XE3, XE4
and XE5
StreamSec.DSI.CertificateViewer.
Outside Windows the viewer is a FireMonkey control, and its
ComponentPlatformsAttribute offers it for OSX32 with these versions. THE
STEP THAT FAILED is the compile of that FireMonkey part. XE3 has no unit
FMX.StdCtrls - its TPanel and TLabel are in FMX.Controls - so the compiler
stopped at the uses clause with F1026 File not found: 'FMX.StdCtrls.dcu'.
XE4 and XE5 have the unit, but they, like XE3, name the TAlignLayout values
alClient and alLeft where XE6 and later name them Client and Left, so the
compiler stopped with E2003 Undeclared identifier: 'Client'. The unit now
takes TPanel and TLabel from the unit that declares them in each version,
and names the two alignment values the way each version does. The control
and its layout are otherwise unchanged. With these versions it has been
compiled for macOS, not run there. Windows builds use the VCL control and
were never affected.
--------------------------------------------------------------------------------
PACKAGES
================================================================================
What the runtime packages for the older Delphi versions contain.
4. NEW - the runtime packages for Delphi XE3 to 12 contain
StreamSec.DSI.PkixRequestCertGenerator and StreamSec.Pdf.Canvas
StrSecIV170 to StrSecIV290.
Both units came with 4.1.3.358, and until now only StrSecIV370, the
package for Delphi 13, contained them. TstRequestCertificateGenerator
issues certificates from PKCS#10 requests; tPdfCanvas composes PDF pages.
With an older Delphi a project could use the first, compiled into the
project itself, but not the second with XE3 to XE7: tPdfCanvas formats
its numbers with TFormatSettings.Invariant, which TFormatSettings has from
XE8 on, so the compiler stopped with E2003 Undeclared identifier:
'Invariant'. With those versions the unit now formats with a copy of the
current format settings whose decimal separator is a dot, which is all
that format reads, so the PDF text is the same: two decimals and a dot,
whatever the locale. From XE8 on nothing changes.
5. CHANGED - StrSecIV180 no longer contains st3DES
StrSecIV180 (Delphi XE4).
It was the last package that still did; every other one leaves the unit
out, and nothing in the library uses it. A project for XE4 that uses
st3DES now compiles it into the project, as with every other version.
--------------------------------------------------------------------------------
SHARED READ LOCKS OFF WINDOWS
================================================================================
The library's multi-read locks now let readers share on every platform, as
they always did on Windows. The defect of entry 6 was in every 4.x release,
on every platform but Windows.
6. FIXED, BEHAVIOUR CHANGE - off Windows, a thread decoding ASN.1 and a thread
sweeping the collector could wait for each other for ever
stGC, StreamSec.SSH.PublicKeyList and StreamSec.Snif.ClassServer; the new
unit stRWSync.
The collector behind the ASN.1 objects (stGC), the SSH public key list and
the Snif user list guard their data with
TMultiReadExclusiveWriteSynchronizer. The RTL lets readers of that class
share on Windows only. On macOS, iOS, Android and Linux it declares the
class as TSimpleRWSync, whose read lock excludes other readers as its
write lock does.
THE STEP THAT FAILED is a sweep (tGCManager.Sweep) running while another
thread decodes. The decoding thread holds an object's lock for reading and
waits for the collector's weak-field lock; the sweep holds the weak-field
lock for writing and waits to read that object. On Windows the two reads
share and both threads go on. Elsewhere each waited for the other, and
neither thread ever returned. One decoding thread and one sweeping thread
are enough; on Linux64 a test that does just that stopped in every run.
An application is affected when one thread calls Sweep while another
decodes certificates, CMS or other ASN.1 - a server that reclaims memory
on a timer, say. One that never sweeps beside a decoding thread is not.
Calling tGCManager.SetUseLocks(True) before the first ASN.1 object exists
avoided the deadlock, because the per-object locks are then not created,
and it still works.
The new unit stRWSync has tReadWriteSync, a synchronizer with the
semantics of the Windows one: readers share; a thread nests reads, writes,
and reads inside its own write; a thread that reads may read again while
a writer waits; a new reader waits while a writer waits; and a thread that
reads and asks to write does not keep another writer out while it waits,
so two such threads cannot wait for each other, and BeginWrite answers
False when another thread wrote in the meantime, as the RTL's does. The
three units use it through tMultiReadSync, which is the RTL's class on
Windows and under Free Pascal and tReadWriteSync on Delphi's other
targets. Nothing changes on Windows or under Free Pascal.
BEHAVIOUR CHANGE: off Windows, readers of these locks now run at the same
time, where before they ran one at a time.
--------------------------------------------------------------------------------
REVOCATION: THE DSI OCSP FILTER AND THE DSI CRL FILTER
================================================================================
How long the DSI OCSP filter reuses a verdict, and which lists of the DSI
CRL filter count as fresh coverage of an issuer. Both defects were in every
release from 4.1.1.349 to 4.1.5.363.
7. FIXED - the DSI OCSP filter could reuse a cached verdict for longer than
RevocationCacheMaxAge after the system clock was set back
StreamSec.DSI.PkixOcsp (TstCustomKeyFilterOCSP, tKeyFilterOCSP).
THE STEP THAT FAILED is the age of a cached verdict, which was the
difference between two readings of the wall clock taken as an absolute
value. With the clock set back by some time, a verdict was reused for up
to RevocationCacheMaxAge plus that time: with the default of one hour and
the clock set back 30 minutes, a verdict 80 minutes old was still reused,
so a certificate revoked in between kept the "good" the cache held. A
clock set back past the moment the verdict was taken gave a small
positive age as well. A clock set forward, or time the system spent
suspended, only shortened the reuse.
The age is now measured on the monotonic tick (stTlsUtils.GetTickCount64)
and on the wall clock (UTC), as the revocation verdict cache of
TstCertificateManager measures it (entry 97 of 4.1.5.363): a verdict is
reused only while it is at most RevocationCacheMaxAge old on both, and
the wall-clock age is not negative. Neither a step of the wall clock nor
a suspend lengthens the reuse, and a change of time zone alone does not
affect it. RevocationCacheMaxAge keeps its meaning and its default.
8. FIXED, BEHAVIOUR CHANGE - HasFreshCRLFor counted a delta CRL or a
partition as fresh coverage of its issuer, so TstOcspServer could answer
"good" for a certificate no list it held said anything about
StreamSec.DSI.PkixKeyFilter (TstCustomKeyFilterCRL.HasFreshCRLFor) and
StreamSec.DSI.PkixOcspServer (TstOcspServer); the new function
CRLIsComplete in StreamSec.DSI.PkixCRL.
TstOcspServer answers "good" for a certificate its CRL filter does not
revoke only when HasFreshCRLFor says that the filter holds a fresh list of
the certificate's issuer, and "unknown" otherwise. THE STEP THAT FAILED is
that check: any fresh list of the issuer counted, including a delta CRL,
which names only what changed since its base list, and a list whose
issuingDistributionPoint limits what it covers, for instance to user
certificates. With only such a list of an issuer held, the responder
answered "good" for certificates outside it - every certificate not in a
delta list, a CA certificate beside a user-certificates partition - on the
strength of a list that said nothing about them.
HasFreshCRLFor now counts a fresh complete list only: one with neither a
deltaCRLIndicator nor an issuingDistributionPoint (CRLIsComplete).
BEHAVIOUR CHANGE: with only delta lists or partitions of an issuer held,
HasFreshCRLFor answers False and TstOcspServer answers "unknown" for that
issuer's certificates that the lists do not revoke. The same holds for a
list whose issuingDistributionPoint or delta indicator is present and
cannot be decoded: its revocations still apply, but it is no longer
counted as coverage. Revoked certificates are answered "revoked" as
before.
--------------------------------------------------------------------------------
REVOCATION: A CERTIFICATE'S OWN CHECK IN TsmX509TrustedCertificates
================================================================================
The revocation check TsmX509TrustedCertificates makes of a certificate
itself, when the certificate is verified, added or imported, as distinct
from the step that checks the CA certificates of its chain. Entries 9 and 10
retire the two known limits that entry 98 of 4.1.5.363 and PKIX.txt stated.
The defects of entries 9 to 11 were in every release from 4.0.1.313 to
4.1.5.363.
9. FIXED, BEHAVIOUR CHANGE - the first list of the issuer decided a
certificate's own revocation check, whatever that list covered (RFC 5280
section 6.3.3)
StreamSec.Mobile.X509Comp (TsmX509TrustedCertificates).
THE STEP THAT FAILED is the CRL step of the check, which took the lists
of the issuer held in the store and the stores it delegates to, and let
the first that was fresh and authentic decide: "revoked" when it named
the certificate, "not revoked" when it did not. When that first list was
a partition (a list whose issuingDistributionPoint limits it, for
instance to CA certificates or to another distribution point), or a
complete list behind which a delta CRL or a partition revoked the
certificate, a revoked certificate was taken as not revoked, under
rpHardFail too, and the CRL download for the certificate's own partition
was not made.
The check now reads every fresh, authentic list of the issuer, as the
step that checks the CA certificates of a chain already did. A list that
names the certificate revokes it, with the reasons read as that step
reads them: an entry with the reason removeFromCRL revokes nothing, and a
hold (certificateHold) lasts until a later list of its scope ends it. The
certificate is taken as not revoked only when a list whose scope covers it
does not name it, or names it only with a hold that a later list ends. A
complete list covers every certificate of its issuer. A partition covers
one when it is of its kind (onlyContainsUserCerts for a certificate that
is no CA, onlyContainsCACerts for one that is) and, when the partition
names a distribution point, the certificate names that point in its
cRLDistributionPoints, in a distribution point not limited to some
reasons. A delta CRL never covers on its own, nor does a list for some
reasons only (onlySomeReasons), an indirect list, a list of attribute
certificates only (onlyContainsAttributeCerts), or one whose
issuingDistributionPoint cannot be read. A list that raises while it is
read is passed over. When no list decides, the CRL download is made
(OnFetchCRL), and after it the check is inconclusive as before: accepted
under rpSoftFail, refused under rpHardFail.
A hold is answered as a revocation and no longer kept in the
certificate's revocation verdict cache as one. A revocation kept there is
never replaced, so a hold kept as one outlasted the list that ended it;
now the next check reads the lists again. And a later list ends a hold
only when it is itself fresh: one past its nextUpdate, which the check
does not read, does not end it.
BEHAVIOUR CHANGE: a store that holds only lists which do not cover a
certificate - a partition of CA certificates for an end-entity
certificate, a partition of another distribution point, a delta CRL -
now finds its check inconclusive where it used to answer "not revoked",
and asks OnFetchCRL for a list. A delta CRL's release entry
(removeFromCRL) is no longer taken as a revocation, and a hold that a
later list ends no longer revokes the certificate: with a complete list
that put a CA certificate on hold and a delta CRL that released it, that
certificate and its chain are now accepted, and a certificate refused
while it was on hold is accepted once a list that releases it is added.
10. FIXED - a certificate's own revocation check found the lists of its
issuer only through the issuer certificate found first, which could be
a cross certificate of the CA without cRLSign
StreamSec.Mobile.X509Comp (TsmX509TrustedCertificates).
THE STEP THAT FAILED is the search for the lists: it asked for those of
the certificate of the issuer that the store found first, and a CRL is
taken as signed by a certificate only when that certificate has the
cRLSign key usage. When the first was a cross certificate of the CA
without cRLSign, held ahead of the CA's own certificate - in the store the
check starts from, which a TLS peer can add certificates to when its
Certificate message is read - no list of the CA was found: when OCSP gave
no answer, a certificate the CA's list revokes was accepted under
rpSoftFail, and every certificate of that CA was refused as inconclusive
under rpHardFail.
The check now reads the lists that any certificate of the issuer held in
the store or the stores it delegates to signed, as the step that checks
the CA certificates of a chain already did. The order of the certificates
no longer matters.
11. FIXED - AddCRL compared the CRL number of a partition or a delta CRL with
the lists of other scopes, and took a held delta CRL for a complete one
StreamSec.Mobile.X509Comp (TsmX509TrustedCertificates.AddCRL); the new
function CRLHaveSamePoint in StreamSec.DSI.PkixCRL.
THE STEP THAT FAILED is the comparison AddCRL makes before it takes a
partition or a delta CRL. RFC 5280 section 5.2.3 numbers each scope - one
issuer and one issuingDistributionPoint - on its own, its complete and
delta lists in one sequence. AddCRL compared the new list's number with
every list of the issuer held, so a partition was refused with
crcSuperseeded because a list of another scope had as high a number, and
the base a delta CRL names was taken as found in a complete list of
another scope. And a held delta CRL was recognised by a test no delta CRL
meets, so it was taken for a complete list: a newer delta CRL of the
scope was added beside it instead of replacing it, and its number could
count as the base of another delta CRL.
AddCRL now compares only with the lists of the same issuer and
issuingDistributionPoint (CRLHaveSamePoint), and takes a delta CRL only
when a complete list of its scope with the base number is held, answering
crcBaseNotFound otherwise, as it did when no list of the issuer had that
number. A newer delta CRL of a scope replaces the older one. Complete
lists of an issuer without issuingDistributionPoint are compared as
before.
--------------------------------------------------------------------------------
SFTP CLIENT
================================================================================
Entry 12 retires a defect release 4.1.4.361 named and left: the NOT CHANGED
bullet of its entry 72. It was in every 4.x release. It needs a server that
answers a request for a file's attributes with a status rather than with the
attributes, which the SFTP drafts allow, and neither this library's own SFTP
server nor OpenSSH's sftp-server answers that way.
12. FIXED - TstSFTPClient.Size read the attributes a server had not sent, and
the application died with an access violation
StreamSec.SFTP.Client (TstSFTPClient.Size); the doc comments of Stat,
LStat and FStat in StreamSec.SFTP.Transport.
THE STEP THAT FAILED is the SSH_FXP_FSTAT request Size sends once the
file is open. draft-ietf-secsh-filexfer-02 section 6.8 lets the server
answer a stat request with "either SSH_FXP_ATTRS or SSH_FXP_STATUS". A
status of an error code raises eSFTPStatusError in the transport, but
SSH_FX_OK and SSH_FX_EOF are no errors: FStat then returns no attributes
at all, and Size read the size through the interface it did not get. On
Win32 and Win64 that is an access violation reading address 0, raised
inside the component - an exception an application cannot tell apart
from a defect of its own.
Size now raises eSFTPClientError naming the file when FStat returns no
attributes, and closes the handle as it did before. Nothing changes when
the server answers with the attributes, or with an error status.
NOT CHANGED:
- GetFile takes no attributes as attributes it does not know and reads
until a READ returns nothing, as it has since entry 72 of 4.1.4.361.
- tSFTPTransport.OpenFile, OpenDir, ReadLink and RealPath return an
empty handle or name when a server answers them with SSH_FX_OK or
SSH_FX_EOF, as before.
- The doc comments of Stat, LStat and FStat now say that the result is
nil after such a status, so an application that calls them itself can
test for it. The code of those three functions is unchanged.
--------------------------------------------------------------------------------
SSH SERVER CHANNELS
================================================================================
Entry 13 is the server's twin of entry 144 of 4.1.4.361: the defect that
entry's NOT CHANGED bullet named and left ("the SSH server's channels answer
the client's CLOSE the same way round ... and are not changed here"). It was
in every 4.x release.
13. FIXED - a channel of an SSH server that the client closed, and that a
consumer of the channel closed at that moment, could send the client a
second SSH_MSG_CHANNEL_CLOSE, or none at all
StreamSec.SSH.ServerChannel (tCustomSSHServerChannel).
A server answers the client's SSH_MSG_CHANNEL_CLOSE on the connection's
thread: the channel goes to csClosing, and the server's own CLOSE goes
back to the client (RFC 4254 section 5.3), once - a channel's Close sends
no CLOSE when one has been sent. The channel's consumer completes it to
csClosed with Close: a port-forwarding thread, a subsystem thread, a
program thread that holds the channel. A consumer that polls the
channel's State calls that Close the moment the connection's thread has
made the channel csClosing.
THE STEP THAT FAILED is the answer to the client's CLOSE. It made the
channel csClosing first, and only then counted the server's CLOSE as
sent. A Close on another thread that came in between found csClosing and
no CLOSE counted, and took the reply over:
- It counted the CLOSE as sent whether or not it had a broker left to
send it on. A consumer whose connection is being torn down has taken
the channel off its broker, and its Close then sent nothing; the
connection's thread, finding the CLOSE counted, sent nothing either.
No CHANNEL_CLOSE went back at all, so the client's channel stayed
csClosing and kept its slot in the client's broker until the
connection ended.
- With the connection up and the channel still on its broker, both
threads could find no CLOSE counted and send one: two
SSH_MSG_CHANNEL_CLOSE for the channel. A TstSSHSocketClient ignores
the second, the channel being gone by then; other clients were not
tried.
Nothing was raised either way: a server channel's broker drops a send
that fails.
HOW OFTEN. Only the few instructions between the two steps are open, so
rarely; it was not seen in a run that did not widen the window. In a
build that held the connection's thread between them, the client was
left without its CHANNEL_CLOSE every time.
NOW:
- The reply is counted as sent, and the broker it is to go through read,
before the channel is made csClosing. A Close that finds csClosing
finds the CLOSE counted and sends nothing; it may take the channel off
the broker meanwhile, and the reply still goes out.
- The server's CLOSE is counted by an atomic compare-exchange wherever it
is counted - in Close and in the answer to the client's CLOSE - and
only the one that counts it sends it, so one CLOSE goes out however
those meet. SendEOF, which sends no EOF after the CLOSE, reads the
count the same way.
NEW: tCustomSSHServerChannel.InternalAfterPeerClose, a protected virtual
method that does nothing. The connection's thread calls it when the
client's CLOSE has made an open channel csClosing, before the server's
CLOSE goes back. A subclass may override it, as it may
InternalBeforeRemoveFromBroker. It mirrors tSSHClientChannel's method of
the same name (entry 144 of 4.1.4.361).
THE DISCRIMINATING TEST: register a tSSHServerChannel subclass as the
session channel and have its InternalAfterPeerClose, on the connection's
thread, let a thread of your own take the channel off its broker
(iSSHServerChannelEvents.RemoveFromBroker) and close it, and wait until
that Close has returned. Open a session channel from a logged-in client
and close it there. The release before this one has no
InternalAfterPeerClose; built with it added where it made the channel
csClosing, and nothing else, the client's channel stays csClosing every
time - no CHANNEL_CLOSE comes back. In this one it ends csClosed.
PLATFORMS. The code is the same on every platform.
SshServerChannelCloseRaceTest gains a step 9 doing the above three
times, 15 checks, 339 in all. On Win32, Win64 and Linux64 the release
with only InternalAfterPeerClose added fails 3 of them on each - each
try's "the client has the CHANNEL_CLOSE back, so its channel is
csClosed" - and this one passes all 339 on each.
NOT INVOLVED: the transport, the key exchange and the ciphers; taking a
channel off its broker; and what a channel does when the connection
ends, which answers through the same path and is unchanged.
NOT CHANGED:
- A channel with no consumer still completes its own close right after
the reply (entry 112 of 4.1.4.361), and a channel that has one is
still left csClosing for that consumer's Close.
- Close still sends the reply when the connection's thread has not
claimed it: a consumer that closes a channel the peer has not closed
sends the first CLOSE, as before.
- The legacy unit stSSHServerChannel, which no longer ships, is not
changed.
--------------------------------------------------------------------------------
A FILE THE LIBRARY READS, READ BY SOMEONE ELSE AS WELL
================================================================================
Both defects were in every release up to and including 4.1.5.363: entry 14 on
Windows, entry 15 on Linux64.
14. FIXED, BEHAVIOUR CHANGE - a file the library loads may be open in another
reader at the same time
stASN1Base, stSecUtils, stSimpleXML, StreamSec.DSI.KeyManager,
StreamSec.Mobile.TlsInternalServer, StreamSec.Mobile.X509Comp,
StreamSec.SFTP.Client.
THE RULE. A read into memory opens the file fmOpenRead or
fmShareDenyWrite, as TStrings.LoadFromFile and TMemoryStream.LoadFromFile
in the Delphi RTL do: other readers share it, and a writer is refused
while it is read.
THE STEP THAT FAILED is the open. tASN1Base.LoadFromFile - and so every
certificate, CRL, PFX and other ASN.1 structure loaded by file name,
among them ImportFromPFX of TsmCustomTLSInternalServer and
TsmAsyncTLSServer and ImportFromPFXFile of TstCertificateManager - opened
the file with fmOpenRead and no share mode. In the RTL's FileOpen that is
share mode 0, which on Windows means dwShareMode 0: exclusive. So did
TsmCustomTLSInternalServer.LoadMyCertsFromFile and LoadTrustedCertsFromFile
for a .cer, .crt or .der file, TsmX509TrustedCertificates.ImportFromCMSFile
(and through it LoadRootCertsFromFile for a .p7b or .p7c file), the two
DigestFile and the two HMACFile of stSecUtils,
tSimpleAnsiXML.LoadFromFile, TstBaseSaveableKeyContainer.LoadFromFile (a
key index or key filter) and TstSFTPClient.CmpFile for its local file.
SYMPTOM. On Windows, while any other handle was open on the file -
another process or thread loading the same PFX, a virus scanner, an
editor showing a certificate - the load raised EFOpenError "The process
cannot access the file because it is being used by another process", and
while the library read a file no one else could open it. Seen when
several servers started at once imported one PFX.
NOW. Those calls open fmOpenRead or fmShareDenyWrite. A file another
program holds open for writing is refused with EFOpenError, as before, so
a file being written is not read half done; on Windows a key index the
library is saving admits no reader until it is closed (SaveToFile writes
through fmCreate). TstSFTPClient.CmpFile opens its local file
fmShareDenyNone, as PutFile already did: the file is the user's and may
be open for writing in another program, and a change under it only makes
the compare answer False.
BEHAVIOUR CHANGE on POSIX: fmShareDenyWrite takes an fcntl F_RDLCK on the
file, where fmOpenRead alone took no lock at all. A file another process
holds under an fcntl write lock is refused with EFOpenError where it was
read before, and so is a file on a network file system that refuses locks
with an error other than EINVAL or ENOTSUP; a file system that does not
support locks at all is read as before.
NOT CHANGED, each for its own reason:
- The reads of /dev/random and /dev/urandom (stEntropySourcePosix,
stOSXRandom) take no lock: on POSIX fmOpenRead alone asks for none, and
a read lock on a character device buys nothing.
- Loads that already named a share mode, and the opens that are exclusive
by design.
- The legacy units that no longer ship (stX509, stDER, stMPKeyManager,
stSFTPClient, stCustomMetaData, stFileEncList).
TESTED with Delphi 13 on Win32, Win64 and Linux64: each of the loads
above that runs without a network, on a fixture copied to a fresh
directory, with no other handle, with another reader holding the file
fmShareDenyWrite and fmShareDenyNone, and on Windows with a writer
holding it; each load checked for the content it read - the certificate
re-encoded, the key algorithm of the PFX, one certificate added from a
.der and from a PKCS#7 OpenSSL made, the digests and MACs against the
same octets in memory, the XML and the key index written first. Against
the same test built from the units before this change, 22 of the 44
checks fail on Win32 and Win64.
15. FIXED - a key index or key filter saved on Linux64 could not be loaded
again
StreamSec.DSI.KeyManager (TstBaseSaveableKeyContainer.LoadFromStream).
THE STEP THAT FAILED is the digest the load computes over the file's
text. SaveToStream digests the text with CRLF line breaks on every
platform. The load set the same CRLF line breaks and then, on Linux,
turned every LF of that text into CRLF as well, so every line break it
digested was CR CRLF and the digest was never the one SaveToStream had
written. LoadFromFile of a key index or key filter then raised
eKeyManagerError "Stored digest does not match contents" for the file it
had just saved. Windows and macOS, iOS and Android were not affected: the
replacement was made only where LINUX is defined.
The load now digests the text SaveToStream digested, so a file saved on
Linux64 loads on Linux64 and on Windows alike, and the replacement is
left only for a compiler without TStrings.LineBreak, which no supported
one is. Files saved by earlier releases are unaffected: the text and its
digest are the same octets as before on every platform.
TESTED on Linux64: the key index written and loaded again in
FileShareReadTest, where 3 of its 33 checks fail against the unit before
this change.
--------------------------------------------------------------------------------
HTTP/2 CLIENT: A LONG UPLOAD
================================================================================
The defect was in every release that has the HTTP/2 client, from 4.1.2.355 to
4.1.5.363. It is in the HTTP/2 client only. The HTTP/2 server (TsmHTTPSv2)
never charged a WINDOW_UPDATE and receives uploads of any size, and HTTP/1.1
and HTTP/3 have no such frame.
16. FIXED - a request body of more than a few megabytes sent over HTTP/2
ended the connection
StreamSec.Http.Http2Client (tHttp2ClientConn), and through it
TsmHTTPSClient and every other client that sends over HTTP/2.
THE STEP THAT FAILED is the client's count of frames that advance no
request (MaxUnproductiveFrames, 1000 by default: PING, SETTINGS,
RST_STREAM, empty DATA and the like, each costing a token, each
completed response giving eight back). It charged every WINDOW_UPDATE
as such a frame. A request body is sent in DATA frames of at most
16 KiB, and a server returns the credit they spent in WINDOW_UPDATE
frames, for the stream and for the connection, while no response
completes. So an upload used the budget up by itself: after about a
thousand WINDOW_UPDATE frames the client ended the connection with
GOAWAY ENHANCE_YOUR_CALM, "peer sent too many frames that advance no
request", and the exchange failed as "the h2 stream failed (reason 4,
error 11)". How many megabytes that is depends on how often the server
returns credit: against this library's own server, about 16. Several
smaller uploads on one connection added up the same way where the
responses between them gave back less than they had cost.
A WINDOW_UPDATE that returns credit the client spent is now free. The
client keeps, for each stream and for the connection, the request body
octets it has sent and not been given credit for; a WINDOW_UPDATE is
charged only when that count is zero, which is when it advances no
request. One that returns what was spent and enlarges the window in the
same frame is free as well. What a server can send without being
charged is therefore bounded by the octets the client itself sent, and
a flood of WINDOW_UPDATE frames on a connection that is sending nothing
ends the connection as before.
NOT CHANGED: the budget and its default, the other frames it counts,
and the refund. MaxUnproductiveFrames is not published on
TsmHTTPSClient, so an application had no setting that avoided the
failure; sending the upload over HTTP/1.1 did.
TESTED with Delphi 13 on Win32 and Win64 in Http2UploadTest, which until
now ran every case with the budget switched off: an upload of 46.9 MiB
in 3000 frames under the default budget, the server returning stream
and connection credit after each frame, completes and costs no token;
credit with nothing sent costs a token each time; 100 octets sent make
100 one-octet credits free and the next one charged; a flood of
connection credit ends the connection with ENHANCE_YOUR_CALM (15 new
checks, 139 in all; Http2ClientTest unchanged at 43). Over TLS on the
loopback address a file of 1 GiB was then uploaded over HTTP/2 from a
client built on this unit to a server built on the library, identical
octets, in 110 seconds; the same client built on the unit before this
change fails from about 16 MiB.
--------------------------------------------------------------------------------
HTTP: A FILE AT EITHER END OF A REQUEST
================================================================================
Entry 17 is new. The defect of entry 18 is in releases 4.1.5.362 and
4.1.5.363 as described; earlier releases made that decision in another way
and were not tested.
17. NEW - a request body is read from a stream and a response body is written
to a stream, as they are sent and received: TsmHTTPSClient.BeginStreamed,
and HttpReceiveToStream for a server's streaming route
StreamSec.Mobile.HTTPSClient (TsmHTTPSClient, TsmAdvancedHTTPSClient),
StreamSec.Http.Streaming, StreamSec.Http.Client.
WHAT WAS MISSING. A server could already send a response from a stream
(SetContentStream, HttpSendFile, HttpSendStreamRange). The other three
directions went through memory or through the application's own loop:
the client kept every octet of a response it had read until the exchange
was let go, so a download was bounded by Limits.BodyBytes (64 MiB by
default) and by a 32-bit buffer; a client upload was fed piece by piece
with TrySendBody; and a server's streaming route read its body with Read
and WaitForBody.
THE CLIENT. BeginStreamed(aMethod, aURL, aHeaders, aRequestBody,
aOwnsRequestBody, aResponseBody, aOwnsResponseBody, aMaxResponseBytes)
returns iHttpStreamedExchange, an iHttpExchange with WaitForEnd,
BytesSent, BytesReceived and ReceivedToStream. Either stream may be nil.
- The request stream is sent from its position to its end, with that
length as Content-Length. The pump thread reads it, at most 16 KiB at
a time into the 64 KiB upload queue, as fast as the connection takes
it.
- The response stream receives the body of a 2xx response as it arrives;
on HTTP/2 and HTTP/3 the receive credit goes back as each piece is
written. Limits.BodyBytes does not apply to it: aMaxResponseBytes is
its bound (0 for none), and a response of any size can be stored, on
HTTP/1.1, HTTP/2 and HTTP/3. The body of any other status stays in
memory, under Limits.BodyBytes, for Read and ReadAll, and the stream
is not touched.
- An owned stream is freed when its body ends - a file is closed before
WaitForEnd returns True - or when the exchange fails or is cancelled.
If BeginStreamed raises, both streams are still the caller's.
- A stream that raises, or a request stream that ends before the length
it reported, fails the exchange with the stream's own message.
- The streams are used by the client's pump thread, so a slow stream
slows every exchange on that connection.
THE SERVER. HttpReceiveToStream(aExchange, aStream, aBufferBytes,
aIdleMSec, aBytes) is the worker's Read/WaitForBody loop with a stream
as its destination; it answers hsrrComplete, hsrrFailed, or hsrrPending
after aIdleMSec without data.
UNDERNEATH, in StreamSec.Http.Client: HttpCheckResponseFraming has an
overload with an Int64 length that accepts a Content-Length up to
cHttpMaxFramedLength ($0FFFFFFFFFFFFFFF), and tHttpChunkDecoder has a
LargeBody property that lifts its bound of MaxInt div 2 decoded octets.
Both are for a caller that passes the body on and assembles none of it.
The existing overload and the default are unchanged: a body kept in
memory is refused above MaxInt div 2 as before.
NOT CHANGED: iHttpExchange, iHttpUploadExchange and every existing call.
Nothing is followed or resent by BeginStreamed; a redirect is the
response. A request stream needs a known length; a body of unknown
length is still sent with BeginUpload.
TESTED with Delphi 13 on Win32 and Win64 in the new HttpsStreamedTest, the
library's client against the library's servers over TLS and QUIC on the
loopback address, on HTTP/1.1, HTTP/2 and HTTP/3 (reached through
Alt-Svc), with the client's Limits.BodyBytes at 1 MiB and files of
20 MiB: a download into a file, an upload from a file stored by
HttpReceiveToStream, and a file sent and received in one exchange, each
compared octet for octet and with the heap unchanged; an empty body both
ways; a 404 left out of the stream; the stream's own bound; a stream
that fails its writes; a request stream shorter than it reports; an
upload the server refuses; owned streams freed at the end and not freed
by a call that raises; a Content-Length of 5 GiB accepted by the new
overload and refused by the old (122 checks). Not tested: a body above
2 GiB end to end, and Linux64.
18. FIXED - after a connection the server had reset, every later request on
that client raised "TLS client: already connecting or connected."
StreamSec.Mobile.HTTPSClient (TsmCustomHTTPSClient.PrepareConnection).
THE STEP THAT FAILED is the decision to close the old connection before
a new one is opened. It closed a connection whose wire had ended only
while its socket still counted as connected. A connection that ended in
a reset - an HTTP/1.1 server answering an upload before its end and
closing while the client is still sending - no longer does, so the old
connection was left as it was, in a state that is not "closed", and the
Connect that followed refused to run. The client stayed that way until
Disconnect was called by hand.
A connection whose wire has ended is now closed whatever its socket
reports, and the next request opens a new one.
TESTED in HttpsStreamedTest on HTTP/1.1: a download after an upload the
server refused with 413; against the unit before this change that
request raises.
--------------------------------------------------------------------------------
KEYS, PFX FILES, REQUESTS AND CERTIFICATES OTHER TOOLS WRITE
================================================================================
Entries 19 to 26 came from opening, one after another, the files OpenSSL
3.5, Windows and Java write for keys, PFX files, certification requests and
certificates. Each says what reading such a file did, and what it does now.
Each defect was in every release that has the code it names, from the
StreamSec Tools 4.0 previews and betas of 2012 up to and including
4.1.5.363; the certificate reload of entries 23 and 26 is in 4.1.5.363
only, the first release with tCertificateReloader.
TESTED with Delphi 13 on Win32, Win64 and Linux64 in one test,
PkcsFileReadTest, 62 checks; each entry names its own. Its fixtures are files
OpenSSL 3.5 made, made again by a script beside it, which changes some of
them and says how. Against the same test built from the units before these
entries, 44 of the 62 checks fail, the same 44 on Win32 and on Win64.
19. FIXED, BEHAVIOUR CHANGE - a PKCS#8 private key encrypted with PBES1 was an
access violation, whatever the password
StreamSec.DSI.Pkcs8 (tEncryptionAlgorithmIdentifier.MakeCipher), stPkcs5
(tPBKDF1).
PBES1 is the scheme of RFC 8018 section 6.1: pbeWithMD2AndDES-CBC,
pbeWithMD5AndDES-CBC, pbeWithSHA1AndDES-CBC and the same three with
RC2-CBC. OpenSSL writes it for "openssl pkcs8 -topk8 -v1 PBE-SHA1-DES"
and the like.
THE STEP THAT FAILED is the key derivation. MakeCipher gave PBKDF1 a salt
it had never read from the key's PBEParameter, and PBKDF1 hashed through
that nil reference: EAccessViolation from DecryptPrivateKeyInfo, and
from EncryptPrivateKeyInfo under a PBES1 scheme. Two more defects were
behind it:
- The cipher was keyed with all 16 octets PBKDF1 derives. PBES1 keys DES
and RC2 with the first eight and takes the next eight as the IV; with
16 octets DES is two-key triple DES here, and RC2 had a 128-bit key.
The IV was right.
- tPBKDF1 refused MD2 with an assertion, so the two MD2 schemes failed
with the salt read as well.
NOW. The salt is read, the cipher is keyed with octets 0 to 7, and
PBKDF1 takes MD2 as it takes MD5 and SHA-1. A key under one of the six
schemes decrypts with its password; under another password
DecryptPrivateKeyInfo returns nil, as for PBES2.
BEHAVIOUR CHANGE: an encryption algorithm that is neither PBES2 nor one
of the six - a PKCS#12 PBE scheme, for one, which StreamSec.DSI.Pkcs12
reads - raises eDSIPkcs8Algorithm naming its identifier, where it raised
eASN1Error "Unidentified type".
NOT CHANGED:
- PBES2 and scrypt. A PBES1 scheme still needs its cipher and hash
linked: stDes, stArc2, stMD2, stMD5, stSHA1.
- What is written. EncryptPrivateKeyInfo under a PBES1 scheme goes
through the same MakeCipher and no longer meets the nil salt; the salt
GenerateRandomParams gives a PBES1 key is 16 octets, or 4 octets of the
time when no random generator is assigned, where RFC 8018 appendix A.3
asks for 8. This library reads such a key back; a reader that checks
the size refuses it. Writing a PBES1 key was not tested.
TESTED in PkcsFileReadTest: keys OpenSSL 3.5 encrypted under
pbeWithSHA1AndDES-CBC and pbeWithSHA1AndRC2-CBC, and one under
pbeWithMD2AndDES-CBC, decrypt to OpenSSL's unencrypted key octet for
octet; the pbeWithSHA1AndDES-CBC key gives nil under a wrong password
(the other two are not tried with one); a PKCS#12 PBE key read here
raises eDSIPkcs8Algorithm naming 1.2.840.113549.1.12.1.3. OpenSSL 3.5 has
no MD2: the script that makes the fixtures derives that key itself, its
MD2 checked against the test values of RFC 1319, and OpenSSL encrypts
with it.
20. FIXED - a DSA, NR or X9.42 Diffie-Hellman private key read where
StreamSec.DSI.FFC is not linked was an access violation
StreamSec.DSI.Pkcs8 (tPrivateKeyInfo).
THE STEP THAT FAILED is taking the key out of its PrivateKeyInfo
(ExtractDLPrivateKey, and through it ExtractSignPrivateKey and a
Supports for iDLPrivateKey). It asked for the finite-field provider and
called it without looking; with StreamSec.DSI.FFC not linked there is
none, and the call went through nil. The elliptic-curve, RSA and
arithmetic providers were asked for the same way.
NOW. These raise eDSIProviderNotRegistered naming the unit to link -
StreamSec.DSI.FFC, StreamSec.DSI.ECC, StreamSec.DSI.IFC or
StreamSec.DSI.Arith - as ML-DSA, ML-KEM and EdDSA keys already did. With
the unit linked nothing changes.
TESTED in PkcsFileReadTest, which does not link StreamSec.DSI.FFC: an
unencrypted DSA key OpenSSL 3.5 wrote raises eDSIProviderNotRegistered
naming the unit.
21. FIXED, BEHAVIOUR CHANGE - a PKCS#8 key encrypted with a PBES2 scheme this
library does not implement was reported as a wrong password
StreamSec.DSI.Pkcs8 (tPBES2Params.MakeCipher), and through it
tEncryptedPrivateKeyInfo and the PBES2 key bags and safes of a PFX.
THE STEP THAT FAILED is the choice of cipher. PBES2 names its encryption
scheme by identifier, and this library has DES-CBC, DES-EDE3-CBC, RC2-CBC
and AES-128, AES-192 and AES-256 in CBC mode. For any other - Camellia,
which "openssl pkcs8 -v2 camellia-256-cbc" writes, SEED, an AEAD mode -
MakeCipher derived a key and then made no cipher, and
DecryptPrivateKeyInfo returned nil: what a wrong password gets.
NOW. MakeCipher raises eDSIPkcs8Algorithm naming the scheme's identifier,
before any key is derived. A key derivation function other than PBKDF2
and scrypt is refused the same way.
BEHAVIOUR CHANGE: DecryptPrivateKeyInfo raises for such a key where it
returned nil. Code that took nil for "ask for the password again" now
learns that no password will do.
TESTED in PkcsFileReadTest: a key OpenSSL 3.5 encrypted under
camellia-256-cbc raises eDSIPkcs8Algorithm naming
1.2.392.200011.61.1.1.1.4; one under aes-256-cbc decrypts as before, and
gives nil under a wrong password.
22. FIXED, BEHAVIOUR CHANGE - CheckSignature against an issuer key this
library cannot verify with raised, or called through a nil key, and a
signature whose hash is not linked was reported as bad
StreamSec.DSI.PkixSigned (tSigned.CheckSignature), StreamSec.DSI.PkixCert
(tMPPublicKey), stPkixConst.
THE STEP THAT FAILED, for three kinds of issuer key, is taking the
issuer's public key out for verifying, after the pre-checks and the hash
floor:
- A key that does not sign - ML-KEM, composite ML-KEM, an algorithm the
library does not know - gave no verifying key, and CheckSignature set
its digest algorithm through it: EAccessViolation. So did
SignatureDigestAlg, VerBuf and VerDig of the iMPPublicKey that a
certificate, a request or a SubjectPublicKeyInfo hands out for such a
key, whoever called them.
- An elliptic curve the library has no arithmetic for (secp256k1,
brainpoolP256r1 and others) raised eASN1DataError "Unable to interpret
curve identifier" out of CheckSignature.
- A DSA, NR or Diffie-Hellman key with StreamSec.DSI.FFC not linked
raised eDSIProviderNotRegistered out of it.
svsFullVerification met these as well whenever the pre-checks passed: a
self-issued certificate checked against itself, a CA whose key is on
such a curve.
THE STEP THAT FAILED for a signature whose hash is not linked is the
verification. The pre-checks record pcvUnsupportedHashAlgorithm, but
svsVerifySignatureOnly goes on to the signature with no digest of what
was signed. With an RSA key, as in the test, the verification of nothing
returned False and pcvInvalidSignature was added: the signature was
reported as bad when it had not been examined.
NOW. CheckSignature returns False and says why:
- a key that does not sign: pcvInterfaceNotSupportedKey, "The issuer's
public key is not one this library verifies signatures with";
- a key that cannot be read: pcvInterfaceNotSupportedKey, with the
reason - the curve, the unit to link, or the key's encoding;
- no hash: pcvUnsupportedHashAlgorithm, and the signature is not
examined, so pcvInvalidSignature is not added.
A tMPPublicKey with no verifying key reports haDefault as its digest
algorithm, ignores a new one, and VerBuf and VerDig return False. The
doc comment of CheckSignature now lists every case in which no state
examines the signature.
BEHAVIOUR CHANGE: any eASN1Error or eDSIError raised while CheckSignature
takes the issuer's public key out - among them eASN1DataError for a curve
the library lacks or a key that does not decode, and
eDSIProviderNotRegistered for a unit not linked - gives False with
pcvInterfaceNotSupportedKey and the exception's message, where the
exception went to the caller. A signature whose hash is not linked gives
False without pcvInvalidSignature.
NOT CHANGED:
- A key-agreement key that the library reads as a discrete-log key -
X25519, X448, id-ecDH, Diffie-Hellman with StreamSec.DSI.FFC linked -
goes on to the signature check as before.
- An RSASSA-PSS signature whose MGF1 hash is not linked still raises out
of the verification.
TESTED in PkcsFileReadTest with OpenSSL 3.5's certificates: a
self-issued CA certificate for an ML-KEM-768 key, signed with P-256,
checked against itself under svsVerifySignatureOnly and under
svsFullVerification; self-signed secp256k1 and DSA certificates
(StreamSec.DSI.FFC not linked) and an RSA one signed with MD5 (stMD5 not
linked), under svsVerifySignatureOnly, the last without
pcvInvalidSignature; the ML-KEM certificate's iMPPublicKey called
directly: SignatureDigestAlg reads haDefault after haSHA256 is set, and
VerBuf and VerDig are False. A self-signed P-256 CA certificate made the
same way verifies under svsFullVerification, as the control.
23. FIXED, BEHAVIOUR CHANGE - a PFX with no MAC, with a MAC the library does
not compute, with a cipher it does not list or with a PKCS#12 iteration
count of 0 was an assertion, an access violation, an internal ASN.1
error or a wrong password, and a safe that did not decrypt was left out
without a word
StreamSec.DSI.Pkcs12 (tMacData, tPKCS12EncryptionAlgorithmIdentifier,
tPKCS12KDF, tAuthenticatedSafe).
THE STEPS THAT FAILED, one for each kind of file:
- No MacData, which "openssl pkcs12 -export -nomac" writes.
ExtractAuthSafeContent with a password verifies the MAC, and
tMacData.Verify read the digest of a MacData that is not there:
EAssertionFailed in stASN1Base.
- A MAC digest the DigParams table does not list: RIPEMD-160 as OpenSSL
names it (1.3.36.3.2.1), SHA-512/256, SHA-3. Verify read its
parameters as a CHOICE none of whose alternatives fits: eASN1Error
"Unidentified type".
- A PBMAC1 MAC (RFC 9879) whose key derivation is not PBKDF2, whose PRF
or MAC scheme is not HMAC with SHA-1, SHA-224, SHA-256, SHA-384 or
SHA-512, whose key length is missing or above 1024 octets, or whose
iteration count is outside 1 to 16,000,000 - and any PBMAC1 MAC while
stPkcs5 is not linked. Verify returned False: what a wrong password
gets.
- A safe or a shrouded key bag under an encryption algorithm other than
the six PKCS#12 PBE schemes and PBES2 - a PBES1 scheme, which "openssl
pkcs12 -export -certpbe PBE-SHA1-DES" writes, or any identifier the
table does not list. MakeCipher gave no cipher. ExtractAllSafeContents
decrypted the safe through it, an access violation, and
DecryptPrivateKeyInfo returned nil, what a wrong password gets.
- An iteration count of 0 for the PKCS#12 key derivation, in a safe, a
key bag or the MacData, and a hash that derivation does not take:
EAssertionFailed in tPKCS12KDF. A PBKDF2 count of 0 is entry 25.
- A safe that did not decrypt - under another password ("openssl pkcs12
-twopass", or a PFX with no MAC opened with a wrong password), with no
password, or in public-key privacy mode. ExtractAllSafeContents went
on without it, so a PFX could come back without its certificates, or
without anything, and no error. An encrypted safe counted as
decrypted whenever it gave any octets at all: under a wrong password
an RC4 safe always does, and a block cipher safe whose padding happens
to check about once in 128, and those octets went on to the ASN.1
reader, which raised an error of its own.
- A data safe with no octets, which is no SafeContents, was skipped.
NOW:
- Verify returns False when there is no MacData, so
ExtractAuthSafeContent(aPW) returns nil, as for a wrong password: no
password authenticates such a file. ExtractAuthSafeContent without a
password reads it, unauthenticated, as before. tPFX.CopyTo, and
through it ImportFromPFX of the TLS servers, raises eDSIPkcs12 saying
that the PFX has no integrity MAC, so no password authenticates it.
tCertificateReloader refuses it as content, "PFX has no integrity
MAC": its own check for that compared the MacData with nil, which an
absent one never is, and it read on into the same assertion.
- A MAC digest the table does not list raises eDSIPkcs12Algorithm naming
its identifier.
- A PBMAC1 MAC as above raises eDSIPkcs12Algorithm naming its key
derivation, PRF, MAC scheme, key length or iteration count, with the
bound; with stPkcs5 not linked it raises eDSIPkcs12MissingKDF, as
writing one does.
- MakeCipher raises eDSIPkcs12Algorithm naming the algorithm's
identifier, out of ExtractAllSafeContents and DecryptPrivateKeyInfo.
- tPKCS12KDF raises eDSIPkcs12Algorithm for an iteration count or an
output length below 1 and for a hash it does not take, naming it, and
eDSIPkcs12Password for no password at all.
- An encrypted safe has decrypted when it gives one SEQUENCE of definite
length and nothing after it, which is what the safes are read as.
ExtractAllSafeContents reads every safe or none, and names the one it
could not read and how many there are: eDSIPkcs12Password for an
encrypted safe that did not decrypt with the password given, or for
which no password was given; eDSIPkcs12 for a data safe with no
octets; eDSIPkcs12Algorithm for a safe of another content type.
ExtractSafeContents returns nil for an encrypted safe that did not
decrypt, as it did for one that decrypted to nothing.
BEHAVIOUR CHANGE: ExtractAuthSafeContent(aPW), ExtractAllSafeContents and
DecryptPrivateKeyInfo, and what is built on them - tPFX.CopyTo, and
through it ImportFromPFX of the TLS servers; ImportFromPFXFile of
TstCertificateManager; tCertificateReloader - raise in these cases where
they went on with part of the file, returned nil or returned False. In
particular:
- For a PFX with no MAC, ExtractAuthSafeContent(aPW) returns nil, and
tPFX.CopyTo and ImportFromPFX raise eDSIPkcs12, where both raised
EAssertionFailed.
- ExtractAllSafeContents(nil) on a PFX with an encrypted safe raises
eDSIPkcs12Password, where it returned the bags of the other safes. To
read the safes that are not encrypted, call
ExtractSafeContents(aIndex,nil) for each: it returns nil for an
encrypted one, as before.
- A PFX whose one fault is a data safe with no octets, which opened
before, is refused.
- A key bag under another password than the rest still makes
DecryptPrivateKeyInfo return nil; what tPFX.CopyTo then does is entry
26.
NOT CHANGED: a PFX whose MAC and safes the library reads. A SafeContents
in BER with an indefinite length was not read before either, since the
safes are joined and read as DER; an encrypted one is now refused as
one that did not decrypt.
TESTED in PkcsFileReadTest with OpenSSL 3.5's files: a PFX with no MAC,
under the right password, a wrong one and none; one with a RIPEMD-160
MAC; one whose certificate safe is under pbeWithSHA1AndDES-CBC; one
whose certificate safe is under pbeWithSHAAnd128BitRC4, under its
password and under a wrong one, which the fixture script makes again
until neither key the library derives from the wrong password decrypts
it to one SEQUENCE; the PFX with no MAC with a data safe of no octets
added by the script; a key under pbeWithSHA1AndDES-CBC read as a PKCS#12
key bag; a PKCS#12 PBE key with its iteration count set to 0 by the
script, beside the same key with count 1, which decrypts; RIPEMD-160
offered to tPKCS12KDF; PBMAC1 MacData the test builds with an iteration
count of 0 and with a key length of 2^30; and CopyTo of the PFX with no
MAC under its password, which raises eDSIPkcs12 naming the missing MAC.
Not tested: what tCertificateReloader does with a PFX with no MAC.
24. FIXED - a PKCS#10 request with an attribute the library does not list was
an access violation
StreamSec.DSI.Pkcs10 (the attributes of CertificationRequestInfo,
tCRIAttributeType), stASN1Base (tASN1SetOfTypeIdentifier).
The attributes of a request are typed by their identifier, and the table
lists challengePassword, extensionRequest, regToken and
statementOfPossession. Windows certreq and IIS add others, among them
the OS version (1.3.6.1.4.1.311.13.2.3), the client information
(1.3.6.1.4.1.311.21.20) and the CSP (1.3.6.1.4.1.311.13.2.2).
THE STEP THAT FAILED is reading such an attribute's value. No entry
matched, the value stayed without a type, and its type was then read
from before the first entry of the table: memory that is not a class.
Reading the value - ExpandFull, or the value itself - was an access
violation (on Win64 a read of address FFFFFFFFFFFFFFFF), and so was
TstRequestCertificateGenerator.Execute for such a request, which
expands it first. Re-encoding the request and checking its signature
copy the octets as read and did not reach the value.
NOW. The table ends with an entry for every identifier it does not name,
as the tables of certificate extensions and name attributes do. Such a
value is read as the ASN.1 value it holds and written back as it was,
so the request re-encodes to its own octets and its signature verifies.
Its Choice is ctUndefined, so OnCheckRequestAttribute of
TstRequestCertificateGenerator receives it with aAttrKind = ctUndefined
and its identifier in aAttrId, as documented. tASN1SetOfTypeIdentifier,
which only this table uses, selects that entry for an identifier it does
not list and leaves the identifier as read; for a table with no such
entry it raises eASN1Error "Unidentified type", as tASN1TypeIdentifier
does.
TESTED in PkcsFileReadTest: a P-256 request OpenSSL 3.5 wrote with the
OS version attribute and a challengePassword loads and expands, has both
attributes, the challengePassword's text and the other's one value,
whose Choice is ctUndefined and whose octets read as written; it
re-encodes to the file's octets, and verifies. Against the units before
this change the expansion raises.
25. FIXED - a PBES2 key or PFX whose PBKDF2 iteration count is 0 ran about
4.3 billion HMACs before it answered
stPkcs5 (tPBKDF2), StreamSec.DSI.Pkcs8 (tPBES2Params.MakeCipher), and
through them tEncryptedPrivateKeyInfo and the PBES2 safes and key bags
of a PFX.
PBES2 with PBKDF2 is what OpenSSL 3 writes by default for an encrypted
key and for the safes and key bags of a PFX; the iteration count is
read from the file.
THE STEP THAT FAILED is the PBKDF2 loop. tPBKDF2.F counts the iterations
down in a Cardinal: after the first, a count of 0 went round to
2^32 - 1, and the loop ran about 4.3 billion HMACs, hours of one core,
before a key came back; a negative count ran as many as its value read
as unsigned. tPBES2Params.MakeCipher passed the file's count on
unchecked, so DecryptPrivateKeyInfo, ExtractAllSafeContents,
tPFX.CopyTo and the imports built on them did not return for such a
file - a PFX with a MAC only under its right password, since a wrong
one fails the MAC first. The PKCS#12 key derivation (entry 23) and
PBMAC1 already refuse such a count; PBKDF1 runs a count of 0 as 1.
NOW:
- tPBES2Params.MakeCipher raises eDSIPkcs8Algorithm for a PBKDF2
iteration count below 1, naming it, before any key is derived.
- tPBKDF2.DeriveKey, and tPBKDF2_HMAC through it, raises eKDFError for
an iteration count below 1, whoever calls it.
NOT CHANGED: the library sets no upper bound on the count. A caller that
reads files it does not trust bounds the count before it decrypts.
TESTED in PkcsFileReadTest: OpenSSL 3.5's aes-256-cbc key with its
PBKDF2 iteration count set to 0 by the fixture script raises
eDSIPkcs8Algorithm naming the count; so does the PFX with no MAC with
the count of its encrypted safe set to 0, out of ExtractAllSafeContents;
tPBKDF2_HMAC asked for a count of 0 raises eKDFError. Each runs on a
thread of its own with a deadline of 30 seconds, so that the test built
from the units before this change reports the three as failed and goes
on.
26. FIXED, BEHAVIOUR CHANGE - tPFX.CopyTo, and through it ImportFromPFX of the
TLS servers and a certificate reload, read through a nil key when a key
bag did not decrypt
StreamSec.DSI.Pkcs12 (tPFX.CopyTo), StreamSec.Mobile.CertificateReload
(tCertificateReloader).
THE STEP THAT FAILED is the use of the key a shrouded key bag decrypts
to. DecryptPrivateKeyInfo returns nil for a bag that does not decrypt
with the password given, and CopyTo used the result without looking:
EAccessViolation. "openssl pkcs12 -export -twopass -certpbe NONE" writes
such a file - the MAC under one password, the key under another, the
certificates in the clear - and under the MAC's password it got as far
as the key. A tCertificateReloader worker counts an access violation as
fatal, so a reload of such a file ended the process.
NOW:
- CopyTo decrypts every shrouded key bag before it offers anything to
the destination, and raises eDSIPkcs12Password naming the bag for one
that does not decrypt, leaving the destination as it was.
- tCertificateReloader counts eDSIPkcs12, with its descendants, and
eDSIPkcs8Algorithm as rejected content, as it counts an ASN.1 error: a
file refused that way is not read again, nor its keys derived, until
it changes.
BEHAVIOUR CHANGE: a key bag that does not decrypt, or whose algorithm is
refused (entries 21, 23 and 25), stops CopyTo before the first key is
stored, where the keys of the bags before it were stored first.
TESTED in PkcsFileReadTest: a PFX OpenSSL 3.5 wrote with its key under
a second password and its certificates in the clear, its MAC computed
again under the first password by the fixture script: CopyTo with the
first raises eDSIPkcs12Password naming the bag and offers the
destination nothing. That PFX holds one key bag, so the order - every
bag decrypted before the first key is stored - is not tested with two.
Not tested: what tCertificateReloader does with these refusals.
--------------------------------------------------------------------------------
TLS 1.3 CLIENT HANDSHAKE
================================================================================
27. FIXED - a TLS 1.3 client could fail with bad_record_mac after a
HelloRetryRequest carrying a cookie
StreamSec.Mobile.Tls (TLS_DecodeServerHello) and
StreamSec.Mobile.TlsLayer (TTLS_HandshakeProtocol).
THE STEP THAT FAILED was the second ClientHello. The client sent the
requested key share but omitted the cookie. SunJSSE could then continue
without recovering the first ClientHello and retry in its transcript.
The two peers derived different handshake traffic keys, and StreamSec
could not authenticate the first protected server record.
NOW the client echoes the cookie byte for byte in the second ClientHello
on the same connection. A cookie-only retry keeps the original key
share. The existing single-use policy for cached session tickets is
preserved.
TESTED on Delphi XE8 Win32 and Delphi 13 Win64 with TsmHTTPSClient,
Indy 10 with the StreamSec TLS IOHandler, and RealThinClient with
rtcSTMTPlugin. The RTC SDK StreamSec Fork 9.61 release archive passed
on both platforms. Stock RTC SDK 9.51 also passed on XE8 Win32.
The tests used Tomcat 10.1.62 with SunJSSE on Eclipse Temurin 21.0.7+6
and default groups on both sides. Tomcat requested X25519 and sent
a cookie. The second ClientHello echoed it byte for byte, and the
clients received HTTP 200 over TLS 1.3 with certificate and hostname
verification enabled.
--------------------------------------------------------------------------------
INDY TLS CLIENT CONNECTIONS
================================================================================
28. FIXED - outbound Indy TLS connections could close the same socket twice
or stall before sending a ClientHello under concurrent load
Demos/Delphi XE3 through Delphi 13, smTLSId10D<nn>IOHandler.pas, and
StreamSec.Mobile.TlsInternalServer and StreamSec.Mobile.StreamSecII.
The outbound TLS wrapper now uses Indy's existing Binding. Indy owns
the socket handle and performs its normal connection cleanup. Each
connection retains its own TLS content layer from handshake through
teardown and generates ClientHello directly from that layer. Build the
demo adapter and the StreamSec library
from the same revision set.
TESTED with Delphi 13 on Win32, Win64 and Linux64. TLS 1.2 and TLS 1.3
each passed two sequential connects and four concurrent Indy clients
sharing one TLS engine, including encrypted exchanges and disconnects.
All nine existing server cases passed on each platform. The 14
distinct older adapter variants compiled with their native compilers
on Win32 and Win64. The nine server cases also passed on Delphi XE3
Win32 and Delphi 12 Win64.
--------------------------------------------------------------------------------
TLS SESSION REGISTRATION
================================================================================
29. FIXED, BEHAVIOUR CHANGE - concurrent connections using the legacy
UserData API could miss a registered TLS session
TsmStreamSecII, TCustomTLS_ContentLayer and TAbstractTLSSocket.
The legacy API configures a content layer before adding it to the live
registry. It checks the key and inserts the layer in order under the
same TLS lock. Insertion and lookup compare the full pointer value.
Assigning UserData on a registered layer updates the registry under
that lock. Socket startup reports a missing session immediately, and
TLSConnectAsServer can send HelloRequest from a fresh server layer.
OnTLSAddContentLayer now runs before the managed layer is visible to
keyed lookup. Configure the layer passed to the event.
TESTED in TlsSessionRegistryTest on Delphi 13 Win32, Win64 and Linux64.
The 24 checks per platform cover mixed nil and non-nil keys, full-width
keys, rekeying, extraction, release, callback failures, and server-role
startup. Four concurrent legacy connections per TLS version complete
encrypted exchanges and release their sessions on shared engines.
--------------------------------------------------------------------------------
MAIL: THE IMAP CLIENT'S DEFAULT PORT
================================================================================
30. FIXED, BEHAVIOUR CHANGE - an IMAP client created in code started on port
143 with implicit TLS on, a pair no server answers
StreamSec.Mail.IMAPClient (TsmIMAPClient, TsmAdvancedIMAPClient).
THE STEP THAT FAILED was the first connection of a client whose Port
and ImplicitTLS had both been left alone. ImplicitTLS is True by
default, so the client opened port 143 and sent a ClientHello, while
the server on that port was waiting to send its cleartext greeting. The
handshake could not complete. The POP3 client never had the mismatch:
it starts on 995.
A new IMAP client now starts on port 993, the port that goes with
implicit TLS.
BEHAVIOUR CHANGE: code that creates an IMAP client and relied on Port
being 143 must now set it. That was only ever useful together with
ImplicitTLS := False, for STARTTLS, so set both. A client that sets
Port itself is not affected, and neither is one on a form: a form
stores the port it was saved with.
TESTED in MailAuthLockTest on Delphi 13 Win32 and Win64: a new IMAP
client has implicit TLS on and port 993, a new POP3 client implicit TLS
on and port 995. The check for 993 failed before the change.
Which releases: 4.1.2.355 to 4.1.5.363 start the IMAP client on 143.
--------------------------------------------------------------------------------
MAIL: A NAME OUTSIDE ASCII IN AN ADDRESS FIELD
================================================================================
33. FIXED, BEHAVIOUR CHANGE - a display name outside ASCII assigned to From,
Sender, ReplyTo, Recipients, Cc or Bcc of TsmEmail took the address
with it into an encoded word, so the message had no usable address
StreamSec.Mail.Message (TsmEmail).
THE STEP THAT FAILED was the assignment. A value with any character
outside printable ASCII was RFC 2047 encoded as a whole, the angle
address included. The header field then held one encoded word and no
address: FromAddress and SenderAddress returned the encoded word,
GetEnvelopeAddresses put it in the envelope, so the SMTP client gave
it to the server as a recipient, and a receiving mail program could
not reply. Building the value with MailComposeAddress first was the
only way around it.
Each display name is now encoded by itself and each address is written
as it stands, which is what RFC 2047 sec.5 allows in an address field.
A value of printable ASCII is stored as written, as before, with its
groups, comments and quoting. In a value that needs encoding a comment
and a group name are dropped.
BEHAVIOUR CHANGE: an address that itself holds a character outside
printable ASCII raises eMailMessageError at the assignment. Such a
value was encoded as a whole before, which gave a field nothing could
use. Write an internationalised domain in its A-label form.
TESTED in MailMessageTest with Delphi 13 on Win32 and Win64, which runs
in the battery from this entry on: a name outside ASCII in From, in a
list and in a quoted name with a comma; the stored field; the envelope;
save and load; a printable ASCII group stored as written; an address
outside ASCII refused. 8 of its 9 new checks failed before the change.
Which releases: 4.1.2.355 to 4.1.5.363.
--------------------------------------------------------------------------------
TLS CLIENT: THE CONNECT TIMEOUT
================================================================================
34. FIXED, BEHAVIOUR CHANGE - ConnectTimeout did not limit the TCP connect
of a client that had no deadline set
StreamSec.Mobile.TLSClient (TsmTLSClient, TsmAdvancedTLSClient) and the
clients built on it: TsmHTTPSClient, TsmRESTClient, TsmSMTPClient,
TsmPOP3Client and TsmIMAPClient with their Advanced forms.
THE STEP THAT FAILED was the connect to a host that does not answer.
ConnectTimeout was passed to the socket only when DeadlineTick was set.
Without a deadline, which is how a client is created, the connect had
no limit of its own and ended when the platform gave up - after 21 s on
Windows, whatever ConnectTimeout said. The property governed only the
waits of the TLS handshake that follows.
ConnectTimeout now limits the connect in every case, and DeadlineTick
can only shorten it. A connect that is not answered in that time raises
EstSocketError.
BEHAVIOUR CHANGE: with the default ConnectTimeout of 15000 ms, a
connect nothing answers fails after 15 s where it failed after the
platform's limit before. A client that sets a smaller value now gets
it. ConnectTimeout = 0 with no deadline leaves the connect to the
platform, as before. Name resolution is outside the limit, as before.
MEASURED before the change with Delphi 13 on Win32 and Win64: a
connect to an address in TEST-NET-1 (RFC 5737 sec.3) with
ConnectTimeout 1500 ms and no deadline ended after 21 s.
SmtpSourceBindTest holds that check.
Which releases: 4.1.2.355 to 4.1.5.363.
--------------------------------------------------------------------------------
HTTP SERVERS: THE SENDER OF AN EVENT ROUTE
================================================================================
35. FIXED, BEHAVIOUR CHANGE - an event registered with AddEvent was called
with Sender = nil
StreamSec.Mobile.HTTPS (TsmHTTPSv1dot1, TsmHTTPSv2),
StreamSec.Mobile.HTTPSv3 (TsmHTTPSv3) and StreamSec.Http.Server.
AddEvent of the three HTTP components registered the event on the
router, which knows no component, so the event was called with nil as
Sender. OnRequest of the same components passes the component. A
handler that used Sender, for example to tell which component a
request came in on, met nil.
AddEvent now registers a route that names the component, and the event
is called with that component as Sender. A router can outlive the
component that added a route to it - it may be shared with another
component or held by the application - so a component takes itself out
of its routes when it is freed, and their events are then called with
Sender = nil.
BEHAVIOUR CHANGE: Sender is the component where it was nil. A route
added through iHttpRouter.AddEvent, on the router itself, still has
Sender = nil: the router has no component to name. The interface
iHttpRouter is unchanged.
NEW: iHttpEventRoute and NewHttpEventRoute in StreamSec.Http.Server,
the route the components add, for a host that builds routes of its own.
Which releases: 4.1.2.355 to 4.1.5.363.
--------------------------------------------------------------------------------
REST SERVER: WHEN OnRequestError RUNS
================================================================================
36. FIXED (documentation only) - two comments said the client had already
been answered when OnRequestError runs
StreamSec.Http.RestServer (TsmRESTServer, tRestErrorEvent).
When a route handler raises, the REST server calls OnRequestError and
answers the client with a 500 problem that has a generic detail. The
comments on tRestErrorEvent and on RequestError said that the answer
was already on the wire when the event runs. It is not: the event runs
first, and the answer is sent when the event's handler returns.
Nothing in the code changes. If your OnRequestError does slow work on
the understanding that the client is no longer waiting, move that work
off the event: the client waits for it.
Which releases: 4.1.2.355 to 4.1.5.363 carry the wrong statement.
--------------------------------------------------------------------------------
ACME CLIENT: THE EXTERNAL ACCOUNT KEY
================================================================================
37. FIXED - the decoded MAC key of an external account binding stayed in
freed memory after the account was registered
StreamSec.Mobile.Acme (TsmAcmeClient).
To register an account with a CA that requires external account
binding, the client decodes ExternalAccountMacKey and computes an HMAC
with it. The decoded bytes were not cleared afterwards. They are wiped
as soon as the HMAC has been computed, also when building the binding
fails.
This does not change how the key is held between calls:
ExternalAccountMacKey is a string property, and its value stays in the
component, and in the form file if it was set at design time.
Which releases: 4.1.1.354 to 4.1.5.363.
--------------------------------------------------------------------------------
HTTP SERVERS: ROUTES ON A SERVER THAT IS SERVING
================================================================================
38. FIXED, BEHAVIOUR CHANGE - a route could not safely be added or removed
while a server was active: HTTP/1.1 and HTTP/2 did not guard it, and
HTTP/3 refused it
StreamSec.Http.Server (NewHttpRouter), StreamSec.Mobile.HTTPS
(TsmHTTPSv1dot1, TsmHTTPSv2) and StreamSec.Mobile.HTTPSv3 (TsmHTTPSv3).
The route table had no lock, and HTTP.txt said so: register every route
before the server is activated. A route added, replaced or removed
afterwards raced with the requests resolving on other threads, and could
end in a wrong answer or an access violation. TsmHTTPSv3 raised
eQuicAsyncServer from its route methods while its server was active,
which did not cover a router shared with the HTTP/1.1 and HTTP/2
components or one changed through its interface.
The router can now be changed while it is serving. A route or a prefix
mount can be added, replaced or removed at any time and from any thread.
A change is seen by the requests that resolve after it; a request that
has resolved keeps its handler. AddFiles changes the table once, so a
request sees the whole map or none of it.
BEHAVIOUR CHANGE: AddHandler, AddEvent, AddFile and AddFiles of
TsmHTTPSv3 no longer raise while Server is active. Router,
SessionProvider and the limits of TsmHTTPSv3 still do. The three
components create their router when they are created, where they
created it on first use; code that reads Router gets the same router as
before.
This holds for the router the library builds. A router of your own that
implements iHttpRouter has to provide it itself. For REST routes see
entry 39.
Which releases: 4.1.2.355 to 4.1.5.363, and for TsmHTTPSv3 4.1.5.362 and
4.1.5.363.
--------------------------------------------------------------------------------
REST SERVER: ROUTES ON A SERVER THAT IS SERVING
================================================================================
39. FIXED - a REST route could not safely be registered, replaced or cleared
while the server was active
StreamSec.Http.RestServer (TsmRESTServer, tRestDispatcher).
The REST server keeps its own route table, and it had no lock: the
documentation said to register every route before the server is
activated. A route registered afterwards raced with the requests being
routed on other threads, and a route that was replaced or cleared was
freed while a request that had found it was still using it.
Routes can now be registered and replaced with AddRoute and
AddRouteEvent, and all of them cleared, at any time and from any
thread. A change is seen by the requests that are routed after it; a
request that is being served finishes on the route it found, and that
route's handler stays alive until then.
Nothing changes for a server whose routes are registered before it is
activated.
Which releases: 4.1.2.355 to 4.1.5.363.
--------------------------------------------------------------------------------
MAIL: THE ALPN IDENTIFIER OF A REGISTERED SERVER
================================================================================
40. FIXED, BEHAVIOUR CHANGE - TsmIMAPServer accepted a new AlpnToken after it
had been registered with an async TLS server, which changed the key of
its registration while connections were being routed
StreamSec.Mail.IMAPServer (TsmIMAPServer), StreamSec.Mail.POP3Server
(TsmPOP3Server).
THE STEP THAT FAILED was an assignment to AlpnToken after Server. Once
Server is assigned, the async TLS server finds the component by its
ALPN identifier and reads that identifier for every connection, on its
reactor threads. The IMAP component stored a new value all the same:
the key of its registration changed while those threads were reading
it, and from then on a client that offered 'imap' was not routed to
the component. Nothing was reported. The POP3 and the SMTP component
already refused the assignment.
The IMAP component now refuses it in the same way.
BEHAVIOUR CHANGE: assigning a new value to AlpnToken of a TsmIMAPServer
raises eMailRetrievalError once Server has been assigned. Set AlpnToken
first. A value stored in a form is not affected, because a form is read
before the component registers; code that runs after the form is
loaded, in FormCreate for one, and changes AlpnToken of a component
whose Server is set on the form now raises.
ALSO FIXED, at design time: once Server had been assigned, the Object
Inspector could no longer change AlpnToken of a TsmPOP3Server, because
the component refused in the designer too. Nothing reads the identifier
there, so both components accept a change at design time.
The comments on the two properties now say that an empty AlpnToken,
the default, stands for 'imap' and 'pop3', and what is raised.
TESTED in MailAlpnTokenTest with Delphi 13 on Win32, Win64 and Linux64,
for the IMAP, the POP3 and the SMTP component: an identifier set before
Server is the one the async server finds the component under, a new one
after Server is refused and changes nothing, and at design time the
property stays editable. Before the change the IMAP checks of the
refusal and the POP3 checks at design time failed.
Which releases: 4.1.2.355 to 4.1.5.363.
--------------------------------------------------------------------------------
KEY COMPONENTS: ENABLED WITHOUT AN OWNER
================================================================================
41. FIXED, BEHAVIOUR CHANGE - a key component created without an Owner read
Enabled as False, whatever key it held
StreamSec.DSI.ArithComp (TstRSAPublicKey, TstRSAKey, TstDSSPublicKey,
TstDSSKey, TstECDSAPublicKey, TstECDSAKey, TstEdDSAPublicKey,
TstEdDSAKey, TstMLDSAPublicKey, TstMLDSAKey, TstMLKEMPublicKey,
TstMLKEMKey, TstSLHDSAPublicKey, TstSLHDSAKey,
TstCompositeMLKEMPublicKey, TstCompositeMLKEMKey,
TstCompositeMLDSAPublicKey, TstCompositeMLDSAKey), stSecComp
(TstCustomMPKey).
Enabled reads True when the flag for the current state is set and the
component holds a key. It consulted the key only when the component
had an Owner, so a key component created in code with Create(nil) read
Enabled as False after it had generated a key or read its key file. An
application that read Enabled to see whether a key file had opened got
False with the right password as with a wrong one. Using the key was
not affected.
ONLY CODE THAT CREATES KEY COMPONENTS AT RUN TIME IS CONCERNED. The
components are meant to be placed on a form or a data module in the
designer, where they always have an Owner; used that way, Enabled was
never wrong, and nothing changes.
The key components now derive from a new common base, TstCustomDSIKey,
which reads Enabled from the key with or without an Owner, and
TstCustomMPKey.GetEnabled is virtual. The key managers, key stores, key
indexes and key filters of StreamSec.DSI.KeyManager, the SSH public-key
list and the other TstCustomMPKey descendants read Enabled as before.
BEHAVIOUR CHANGE: Enabled of a key component created without an Owner
reads True when the component holds a key.
TESTED in KeyEnabledTest with Delphi 13 on Win32 and Win64: ownerless
ECDSA, RSA and Ed25519 keys read Enabled True once generated, as owned
ones do; an ownerless component reading a key file reads True with the
right password and False with a wrong one; all eighteen key components
derive from TstCustomDSIKey, and the key-manager classes and the SSH
key list do not. On the unchanged library, an ownerless ECDSA key read
Enabled False with its key loaded. The harnesses of the key manager,
the key stores and filters, PFX import, revocation lists, CMS,
certificate reload, SSH host keys and SFTP pass unchanged on Win32,
Win64 and, where they run there, Linux64.
Which releases: every release of StreamSec Tools 4, up to 4.1.5.363.
--------------------------------------------------------------------------------
COMPOSITE ML-KEM: P-256 DECAPSULATION TIMING
================================================================================
42. FIXED, BEHAVIOUR CHANGE - composite ML-KEM with P-256 used variable-time
P-256 scalar multiplication during decapsulation
StreamSec.DSI.CompositeKEM, StreamSec.DSI.PKTypes.
The built-in iDSICK.Decaps now uses the fixed-time EC operation for the
P-256 shared secret and for the first derivation of the private key's
public point. The optional iDSICKP256Timing interface permits an
explicit per-call cptVariableTime choice. Other composite profiles
keep their existing arithmetic.
BEHAVIOUR CHANGE: P-256 decapsulation defaults to fixed-time scalar
multiplication. Its ciphertext component must contain exactly one
65-octet uncompressed P-256 point; a noncanonical length is refused.
The timing choice applies to the P-256 scalar operations, not to the
complete decapsulation or its error path.
TESTED in CompositeKemTest with Delphi 13 on Win32, Win64 and Linux64:
the P-256 KAT passes with both timing choices, and both reject an
overlong P-256 point. The targeted battery passed 767 checks with no
failures across the three platforms.
Which releases: 4.1.0.348 through 4.1.5.363.
--------------------------------------------------------------------------------
THE EMBEDDED CCADB ROOT SET
================================================================================
43. BEHAVIOUR CHANGE - the embedded root set no longer contains the six roots
that the Mozilla root program no longer lists for websites
StreamSec.Mobile.CCADBRoots, surfaced by TsmCCADBTrustAnchors
(StreamSec.Mobile.CCADB).
The unit embeds the Mozilla root program's CCADB export, filtered to the
websites trust bit. On 2026-11-28 that export listed 112 roots, where the
set embedded since 2026-10-25 has 118, and it added none. The six it no
longer lists are removed:
CN=Buypass Class 2 Root CA,O=Buypass AS-983163327,C=NO
CN=Buypass Class 3 Root CA,O=Buypass AS-983163327,C=NO
CN=DigiCert Trusted Root G4,OU=www.digicert.com,O=DigiCert Inc,C=US
CN=QuoVadis Root CA 1 G3,O=QuoVadis Limited,C=BM
CN=QuoVadis Root CA 3 G3,O=QuoVadis Limited,C=BM
CN=Certigna Root CA,OU=0002 48146308100036,O=Dhimyotis,C=FR
An application that trusts through TsmCCADBTrustAnchors therefore no
longer accepts a peer whose certificate chain ends at one of these roots;
every other root is unchanged. Established and Verified both read
2026-11-28 and RootCount reads 112. On that day each of the 112 was checked
again to be self-signed, to carry basicConstraints CA:TRUE and to be
unexpired. An application that still has to reach such a peer can add the
root as a trust anchor of its own.
--------------------------------------------------------------------------------
THE HELP FILE: HOW-TO PAGES
================================================================================
44. NEW - the help file has a How to section: task pages whose code is
compiled and run in the test battery
StreamSecTools.chm.
Nineteen pages, each one task from start to finish: choosing a component
tier; which servers a client trusts, serving HTTPS from a PFX file,
requiring client certificates and replacing a server's certificate
without a restart; downloading a page and posting JSON over HTTPS;
reading a certificate, checking a chain and its revocation, creating a
key and a certificate signing request, the encoding of a key file's
password, getting a certificate from Let's Encrypt and keeping it
renewed; SFTP; sending e-mail over TLS; random bytes and keys, SHA-256
and HMAC, AES-GCM and storing a password. The component and unit pages
link to the tasks that use them, and the feature notes are shown as
formatted pages.
TESTED: the code on every page comes from sample units that the test
battery compiles and runs, together in TaskSamplesTest and each on its
own in thirteen IsoTask programs, so that a unit a sample does not name
cannot be supplied by another, with Delphi 13 on Win32 and Win64.