Feature notes
Release notes 4.1.3.356
================================================================================
CHANGES - StreamSec Tools
(StreamSec Security Library for Embarcadero Delphi)
================================================================================
Newest first. 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.2.355, which was
released on 2026-08-14. What that release itself brought is in
CHANGES_4.1.2.355.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.
--------------------------------------------------------------------------------
2026-08-29 PKCS#11: CA KEYS THAT STAY ON A HARDWARE TOKEN; REVOCATION DATA
SERVED OVER http WITHOUT A SECOND HTTP STACK; STATIC SERVING OVER A
STREAM; A REST CLIENT THAT CAN KEEP ITS TLS ENGINE BETWEEN CALLS;
TYPED EXCEPTIONS THROUGHOUT THE LIBRARY; RFC 3161 TIME STAMPS FROM
AUTHORITIES THAT ARE NOT RSA; AES-GCM AND AES-CCM ALGORITHM
IDENTIFIERS; ONE FEWER BACKGROUND THREAD IN EVERY PROCESS THAT
DOES SYMMETRIC CRYPTO
================================================================================
The state of the library as it now stands, relative to release 4.1.2.355.
1. NEW - HttpSendStream and friends: static serving done properly, over a
stream you already hold
Additions to StreamSec.Http.Server, all standalone exported functions
beside ParseByteRange:
function HttpSendStream(const aRequest: iHttpRequest;
const aResponse: iHttpResponse;
aStream: TStream;
aOwns: Boolean;
const aContentType: string;
const aValidators: tHttpValidators;
const aCacheControl: string = ''): Integer;
function HttpSendFile(const aRequest: iHttpRequest;
const aResponse: iHttpResponse;
const aPhysicalFile: string;
const aCacheControl: string = ''): Integer;
function HttpSendStreamRange(const aResponse: iHttpResponse;
aStream: TStream;
const aRangeHeader: string;
aOwns: Boolean;
const aContentType: string = ''): Integer;
function HttpStreamValidators(aStream: TStream): tHttpValidators;
function HttpFormatDate(aUtc: TDateTime): string;
function HttpTryParseDate(const aText: string;
out aUtc: TDateTime): Boolean;
tHttpValidators = record
ETag: string; on-the-wire form, quotes included; '' none
LastModified: TDateTime; UTC; 0 none
end;
HttpSendStream is the one to call for anything static. It sends ETag and
Last-Modified when known, evaluates the conditional requests they enable in
the order RFC 9110 prescribes - If-None-Match (weak comparison, '*') then
If-Modified-Since, false meaning 304 for GET/HEAD and 412 otherwise; If-
Range gating whether a Range is honoured at all (strong comparison for a
tag, to-the-second equality for a date, and no match or nothing to compare
against means the whole representation as 200) - and then serves the body
with byte ranges: 200, 206 with Content-Range, or 416 with an EMPTY body
and Content-Range: bytes */total, Accept-Ranges: bytes on every outcome. A
304 carries the validators, Accept-Ranges and no body, as the 200 it stands
in for would have. It answers the status it set; aStream is read from
Position 0 and freed on every path when aOwns is True; aContentType is set
on 200 and 206 when not empty - a stream has no extension, so the caller
decides. Only a SINGLE 'bytes' range is honoured; a multi-range request is
answered 200 with everything, deliberately (a 206 carrying only the first
of several requested ranges is the trap - the client cannot tell).
HttpStreamValidators reads size and last-write time off the OPEN HANDLE
behind a THandleStream - TFileStream and both stFileJail stream classes -
and builds a strong ETag from them; never off a path, so a jail-verified
stream keeps its proof. A stream that is not a THandleStream yields empty
validators, and nothing conditional happens without validators.
HttpSendFile is the path form - open, validators off the handle, Content-
Type from the extension, HttpSendStream; 404 for a file that is not there
or will not open, as SendFile. HttpSendStreamRange is the bare range
primitive with none of the above, and iHttpResponse.SendFileRange now
opens its file and delegates to it: one range implementation, and nothing
changes for SendFileRange callers - its behaviour is byte-for-byte what it
was. HttpFormatDate emits IMF-fixdate; HttpTryParseDate accepts the three
HTTP-date forms a recipient must (IMF-fixdate, RFC 850, asctime).
CACHE-CONTROL IS THE CALLER'S POLICY. Both take an optional aCacheControl,
sent verbatim on 200, 206 and 304 (RFC 9111: a 304 carries what the 200
would have) and not sent at all when empty. Four constants name the usual
answers - cHttpCacheRevalidate ('no-cache'), cHttpCacheStatic ('public,
max-age=86400'), cHttpCacheImmutable ('public, max-age=31536000,
immutable' - ONLY for a URL that changes when the content does) and
cHttpCacheNoStore ('no-store'). The validators are what make any of them
cheap: an expired cache revalidates and gets a bodiless 304.
WHY. SendFileRange takes a physical path and opens it, and that is the one
thing a caller serving out of a verified stFileJail handle must not do:
the handle is the containment proof, and re-resolving the name is the
check-then-use the jail was written to remove. Until now the choice was
race-free serving (jail stream + SetContentStream) OR byte ranges (path +
SendFileRange), never both - and neither sent a validator, so nothing
served from a jail could be revalidated by a browser cache or resumed by a
player. Now: open through the jail, hand the stream to HttpSendStream.
Standalone functions rather than new members of iHttpResponse, for the
iHttpPrefixRouter reason: that interface is shipped, and a new method on it
breaks every implementation outside the unit. They use only the interface's
public members, so they work against any iHttpResponse.
Test\http\ByteRangeTest.dpr covers all of it (116 checks: every prior
SendFileRange case unchanged through the delegation, the stream form, the
HTTP-date grammars, Cache-Control on 200/206/304 and absent when not
given, and every conditional path with a control beside it);
the suite is now in Run-HttpTests.ps1. HTTP.txt section 3 describes the
whole surface and its section 14 declarations gained these together with
SendFileRange, which they had been missing.
2. NEW - TsmRESTClient.TLSEngine: keep one TLS engine across calls, and stop
re-fetching revocation data on every one
StreamSec.Http.Rest gains a published property:
property TLSEngine: TsmSimpleTLSInternalServer;
Assign an engine you create and keep, and every call this client makes runs
on it. Leave it nil and nothing changes for existing code.
WHY IT MATTERS MORE THAN IT LOOKS. The engine owns the trust store, and the
trust store is also the cache the revocation check reads before it fetches
anything: a CRL fetched while validating one call is FOUND by the next
instead of being fetched again. Until now this client built an engine for
each exchange and destroyed it afterwards, so every call began with an
empty cache and re-fetched the peer's CRLs. Against a slow or distant
distribution point that is seconds of latency - per call, on the call your
user is waiting for - and it grows with the size of the CRL, not with
anything you control.
Nothing about the CHECKING changes. This is about not repeating work, not
about doing less of it: RevocationChecking keeps its meaning and its
rvcSoft default, and a revoked certificate is still refused. If you have
been tempted to reach for rvcOff because revocation was making calls slow,
this is the fix that does not cost you the check.
WHICH COMPONENT IS USED, now decided rather than fixed:
TLSEngine assigned TsmAdvancedHTTPSClient on your engine. The one
to prefer wherever calls repeat.
no trust of its own TsmAdvancedHTTPSClient with no engine, which
resolves to GlobalServer. Nothing of this
client's is installed on it.
trust but no TLSEngine TsmHTTPSClient, which owns an engine for the
one exchange - the previous behaviour, and
still the default when you install anchors
through OnConfigureTrust without supplying an
engine.
BuildTransport therefore returns TsmCustomHTTPSClient rather than
TsmHTTPSClient. A subclass overriding it needs its signature widened to
match; one that reached for Result.TLSServer should install its anchors
from ConfigureTrust instead, which is where they belonged.
ALSO NEW - HasPrivateTrust: Boolean; virtual. It answers whether this
client has anchors of its own to install, and the base answers it from
OnConfigureTrust/ExtraAnchorFile. A SUBCLASS THAT OVERRIDES ConfigureTrust
WITHOUT USING THE EVENT MUST OVERRIDE THIS TOO, or it is handed no private
engine and its anchors are installed nowhere - there is no way to detect an
overridden virtual from the base.
WITH BOTH TLSEngine AND OnConfigureTrust SET, THE ENGINE PASSED TO THE
HANDLER IS YOURS, NOT A TEMPORARY. Anchors it adds persist and are seen by
anything else sharing that engine, so keep one engine per trust domain: an
engine shared between two destinations makes each one's CA able to vouch
for the other. The handler runs once per engine, not once per call. The
client clears TLSEngine if the engine is destroyed first, and re-arms the
configuration if you assign a different one.
Test\http\RestLoopTest.dpr proves both modes over a real loopback TLS
server on HTTP/1.1 and HTTP/2: with no engine the trust is installed once
per call, with one supplied it is installed exactly once for all of them
and on the supplied engine, re-assignment re-arms it, and an engine freed
under the client clears the reference.
3. TYPED EXCEPTIONS THROUGHOUT THE LIBRARY - every raise now carries a class
that says which subsystem failed, and a message that says what and why
681 places in the library raised the bare RTL Exception class, roughly a
hundred of them with the placeholder text 'Error Message'. A further 46
raises already had a class of their own but the same placeholder text.
Every one of them now raises a named descendant with a message that names
the routine, the value that was rejected and - where the fix is to link a
unit or set a property - what to do about it. For example:
Argon2: parallelism p must be >= 1, got 0
No iDSIEC provider registered: add StreamSec.DSI.ECC to a uses clause
of the application so that it registers itself at unit initialization
tSecretKey.SetKeyAt: writing 32 octet(s) at offset 40 runs past the
end of a 48 octet key
SSASignatureGeneration: no implementation is linked for hash algorithm
haSHA3_256 - add the unit that implements it (stSHA1, stSHA256,
stSHA512, stSHA3, ...) to the application
NOTHING BREAKS. Every new class descends, directly or indirectly, from
Exception, so an existing `except on E: Exception` handler still catches
exactly what it caught before. What is new is that you can now be specific,
and that the message alone is usually enough to fix the problem.
Where a subsystem already had an exception class, that class is what the
raises now use (eCipherError, eHashError, ePaddingError, eKDFError,
eRandom, eDERDataError, eASN1DataError, eKeyFormatError, eSecComp,
EstSocketError, eSSHTransportError, eSSHClientChannelError,
eSFTPClientError, EsnicReentry, EsnicNoConnection, EsnifDescriptor, ...).
Where a subsystem had none, one was added at the root of that subsystem so
that a single handler covers it:
eDSIError StreamSec.DSI.ArithTypes - the whole DSI layer
eMPError stMPArithTypes - the legacy MP layer
ePkix stPkixSigned - legacy PKIX
eDSIPkix StreamSec.DSI.PkixSigned - DSI PKIX
ETLSEngineError StreamSec.Mobile.Tls - the TLS engine
eTLSLayerError StreamSec.TLS.Types - the TLS protocol units
EsnifError StreamSec.Snif.Conversion - the snif layer
EsnipError StreamSec.Snip.AbstractConnection - the snip layer
eDSIException (StreamSec.DSI.Arith) now descends from eDSIError, and
EsnifDescriptor / EsnifClosedConnection from EsnifError, so those trees
join the layer root rather than standing beside it. Their own descendants
are unchanged.
Below each root sit classes for the distinct failure modes, so a caller can
tell a missing unit from a bad argument from a failed integrity check
without parsing text - for instance eDSIProviderNotRegistered,
eDSIUnsupportedHash, eDSIUnsupportedScheme, eDSIBufferTooSmall,
eDSIPkcs8MissingKDF, eDSIPkcs8NoPassword, eDSIPkixPublicKey,
eDSIPkixCRLIssuer, eDrbgSelfTest, eEntropyHealth, eGMSSKeyExpired,
eFileEncAuthentication, eUserPWAuthentication, eSecretKeyError,
eHexConversion, eBase64Error, eBase32Error, EsnipProtocol, EsnipState,
EsnipClosed and ePeerFilter.
Messages are declared as resourcestrings, so they are translatable, and no
message echoes key material: where a value could be a key, the message
reports its length rather than its contents.
BEHAVIOUR CHANGE - six raises that never fired now do. The exception object
was constructed but never raised, so the error was silently ignored and the
code carried on with unusable state:
StreamSec.DSI.Pkcs12.tSafeContents.ImposeMLDSAPrivateKey
StreamSec.DSI.Pkcs12.tSafeContents.ImposeMLKEMPrivateKey
stPkixCert.tSubjectPublicKeyInfo.ImposeDSSPublicKey (two sites)
stSFTPClient.TstSFTPClient.RemoveDir
stSFTPClient.TstSFTPClient.Rename
The two SFTP ones are the ones to look at before upgrading: RemoveDir and
Rename used to return normally when the server refused the request, and now
raise eSFTPClientError as the rest of that class always has.
Also fixed while passing: tEntropy.Accumulate reported the source id where
its message said it printed the entropy estimate.
4. NEW - PKCS#11: a CA private key that stays on the token
Four units and a component:
StreamSec.DSI.Pkcs11 the Cryptoki 2.40 binding
StreamSec.DSI.Pkcs11Token one token - open, log in, find and
create objects, generate key pairs
StreamSec.DSI.Pkcs11ExtKey the key adapters, RSA and EC
StreamSec.DSI.PkixKeyStoragePkcs11 TstKeyStoragePkcs11, on the palette
Name the vendor module and the token, and the KeyManager resolves keys from
the device the way it resolves them from any other storage. The private key
is generated ON the token, is marked non-extractable, and never enters this
process: every signature is computed by the device.
ISSUING NEEDS NO NEW CODE. TstBaseCertificateGenerator already signs through
the private-key interface, so a CA key on a token issues certificates
exactly as one in a PFX does - and so do the CSR, OCSP and CRL generators.
RSA and ECDSA both. PKCS#1 v1.5 and PSS for RSA; P-256, P-384 and P-521 for
EC. Which of them a given device can actually do is READ FROM THE DEVICE
rather than assumed: the token's mechanism list is queried at open, and a
request it cannot serve is refused with a message naming the mechanism
instead of failing somewhere further down. Tokens differ enormously in what
they offer - one that signs SHA-256 may have no SHA-384 at all - so nothing
about the algorithm set is compiled in.
THE CREDENTIAL IS A PASSPHRASE, AND ITS LENGTH IS CHECKED FIRST. A token
declares a permitted length range in BYTES of UTF-8, and a credential
outside that range is rejected before anything is sent to the device, so a
mistyped length cannot consume one of the few tries that stand between the
token and being locked. Supply it through OnGetPassphrase, which keeps it
out of the DFM; the Passphrase property exists for unattended use.
ONE SOURCE, WINDOWS AND POSIX. The module is loaded with LoadLibrary on
Windows and dlopen elsewhere, and the Cryptoki ABI difference between them
- CK_ULONG is four bytes on Windows and eight on 64-bit POSIX, and the
structures are byte-packed on one and naturally aligned on the other - is
handled in the binding. TstKeyStoragePkcs11 therefore appears on the
palette for Win32, Win64, Linux64 and macOS. It is not offered for iOS or
Android, which do not permit loading an arbitrary vendor module.
ALSO NEW, AND USABLE ON ITS OWN - AN EXTERNAL-KEY HOOK FOR EC KEYS.
tExternalIFPrivateKey has let an RSA private key live outside the process
for a long time; there was no equivalent on the discrete-log side, so an
ECDSA key could not. tExternalDLPrivateKey is that equivalent, reached
through a new ExternalKey property on iDLPrivateKey, and it is what lets an
EC CA key sit on a token. Any code of your own that IMPLEMENTS iDLPrivateKey
rather than merely consuming it will need the new member; the interface
carries a new GUID accordingly.
Test\pkcs11 holds the harnesses used to develop this against a SafeNet
eToken 5110+: a mechanism dump, an object inventory, a resolved
hash-by-encoding capability map, a sign-and-verify round trip, a
provisioning tool that mints a root, and an issuance test.
5. FIXED - StreamSec.DSI.Pkcs12 forced every application that used it to be a
GUI application
The unit carried a stray {$APPTYPE GUI} directive, and because $APPTYPE
applies to the whole program wherever it appears, ANY project including
StreamSec.DSI.Pkcs12 anywhere in its uses graph was linked as a GUI
executable. For a console program the effect is that writing to standard
output raises EInOutError 105 - which, being unhandled in a GUI subsystem
process, surfaces as a modal message box on a machine with no one in front
of it. Removed; a console application built from these units is a console
application again.
6. NEW - TsmCCADBTrustAnchors.Verified: how old the embedded root set is, and
how recently anyone checked
The component reported one date, Established, being the day the bundled
CCADB root set was taken from the root program. It now reports two:
class function Established: string; the day the set was taken
class function Verified: string; the day it was last confirmed
still current
with cCCADBEstablished and cCCADBVerified behind them in
StreamSec.Mobile.CCADBRoots.
THEY ANSWER DIFFERENT QUESTIONS AND ONE CANNOT STAND IN FOR THE OTHER. A
root program removes CAs as well as adding them, so a compiled-in set is a
statement about a moment - but a set that has not CHANGED for six months is
not stale, it is stable, and only Verified can tell you which of those you
are looking at. An application that logs both gives an operator the whole
answer: Established says how old this trust is, Verified says how recently
anyone confirmed it is still what Mozilla publishes.
An application logging Established alone keeps working and keeps meaning
what it meant.
7. NEW - organizationIdentifier is a recognised name attribute
id-at-organizationIdentifier (2.5.4.97) is the legal identifier a CA
registers an organization under - a VAT number, an LEI, a national register
entry - and it is routine in EV and QWAC subject names. stPkixName did not
name it, so it decoded through the catch-all: readable only by walking the
RDNs and comparing OIDs by hand.
It is now an attribute like any other:
tAttrValueEnum gains avAtOrganizationIdentifier
iRDNSequence.OrganizationIdentifier read/write, as a string
iAttrValue.AsAtOrganizationIdentifier the encoding-aware view
The enum member is APPENDED. An attribute's ordinal is its ASN.1 CHOICE
index plus one, so inserting it anywhere else would have re-tagged every
attribute after it; appending leaves every existing ordinal where it was.
ALSO: a DN rendered by StreamSec.Mobile.HTTPS - the peer subject and issuer
on tHttpConnectionInfo - now includes it. That renderer skips any attribute
type it cannot name, so until now a subject distinguished only by its
organizationIdentifier rendered identically to one without it.
ONE THING TO KNOW IF YOU WIDENED AN INDEX. TstKeyIndexSubjectClearTextName
builds its lookup string from the attributes in IndexedAttributes, and an
attribute outside the enum could never be in that set. A certificate whose
subject carries organizationIdentifier therefore yields a different string
than it did before - but only if you widened IndexedAttributes beyond its
default of Common Name alone. At the default, nothing changes.
8. NEW - StreamSec.Mobile.PlainTextResources: the complete list of what a
server will serve without TLS
TsmAsyncTLSServer.PlainTextRedirectPort has always opened a second listener
that speaks no TLS, to answer "http://" with a 301. Some things have to be
fetchable that way and cannot be redirected: a CRL or an OCSP response
validated over https would need revocation data in order to fetch
revocation data, which is why RFC 5280 and the CA/B Forum both settle on
plain http for them. A server that redirects those URLs breaks revocation
checking for every client that does not follow redirects.
The new unit answers them, and the shape of the answer is the point:
fRules := tPlainTextRules.Create;
fRules.AddStaticFile('pki.example.net', '/r1.crl', 'pki\r1.crl',
cCrlContentType, 3600);
fRules.AddOcsp ('pki.example.net', '/ocsp/', 3600);
fHttp11.PlainTextResources := fRules;
Anything not claimed by a rule is redirected exactly as before, and leaving
PlainTextResources nil keeps the listener a pure signpost.
IT IS A LIST BECAUSE THE QUESTION IS "WHAT CAN THIS SERVER EMIT WITHOUT
TLS". That is a question a reviewer should be able to answer by reading
rather than by tracing, so the cleartext surface is data in one place, not
branches spread through a request handler. Nothing served here reaches the
HTTP engine, the router, the limits or a session - it is answered on the
same one-shot, no-keep-alive, deadline-bounded path as a redirect.
OCSP RESPONSES ARE SERVED, NEVER PRODUCED. tPlainTextOcspCache holds
responses signed in advance, keyed by the request as it appears in the URL,
and LoadFromDirectory reads a bundle produced elsewhere - on an offline CA,
typically, where the signing key actually lives. A request for a
certificate the cache does not hold is answered with the five unsigned
octets of RFC 6960's `unauthorized`, which is what RFC 5019 s2.2.3 asks for
and also the cheapest answer available: no signature, no base64 decode, no
DER parse. A responder that signs per request lets whoever floods it decide
how much private-key work you do.
REPUBLISHED UNDERNEATH THE SERVER, WHILE IT RUNS. Everything served here
is a file with an expiry - a CRL is reissued, a bundle is regenerated - so
replacing one is routine rather than exceptional, and none of it is held
open between fetches. A served file is opened permitting FILE_SHARE_DELETE
on Windows, so a fetch in progress does not stop the file being replaced.
HOW TO PUBLISH, because on Windows one specific method works and the
obvious one does not. Write the new file beside the old one and rebind the
name with a POSIX-semantics rename:
SetFileInformationByHandle(h, FileRenameInfoEx, ...)
Flags = FILE_RENAME_FLAG_REPLACE_IF_EXISTS or
FILE_RENAME_FLAG_POSIX_SEMANTICS
where h is the NEW file opened for DELETE access. MoveFileEx with
MOVEFILE_REPLACE_EXISTING cannot be used: it fails with
ERROR_ACCESS_DENIED whenever the destination has any handle open on it at
all, whatever share mode that handle was opened with, so it works only
while nobody is fetching. The POSIX rename consults the share mode
instead - which is why the reader here permits FILE_SHARE_DELETE, and why
the two halves are one mechanism rather than two precautions.
With both in place the fetch finishes from the bytes it opened, the next
fetch sees the new file, and neither side waits for the other. Nothing is
written in place, so no client can observe a half-written CRL - which would
parse as a CRL right up until it did not. The in-memory cache keys on the
file's timestamp, so a replacement is picked up without restarting or
notifying anything.
Test\plaintext\PlainTextResTest.dpr holds this down: a reader thread
fetches the file continuously while the test republishes it 400 times, and
asserts that every republish succeeded, that no fetch was refused, and that
no fetch ever saw the two files mixed.
Resource writes are capped separately from the shared connection pool
(MaxResourceSlots, 48 of 64), so a burst of large fetches cannot crowd out
the redirects that share it.
9. NEW - TstOcspServer.ResponderCertificate: sign with a delegated responder
The responder has always signed with the CA's own key. That requires the CA
certificate to permit it, and a CA issued keyCertSign+cRLSign - as a root
normally is - does not: signing an OCSP response is a digitalSignature
operation. Such a CA could not answer for its own certificates at all.
property ResponderCertificate: iCertificate;
property ResponderKey: IInterface;
Assign a certificate issued BY this CA carrying id-kp-OCSPSigning and it
signs instead, travelling with the response so a client can build the path.
Both conditions are verified before every signature, and a delegate failing
either yields internalError rather than a response no client would accept.
ResponderKey takes the private key as an interface, for a key held on a
PKCS#11 token with no CertificateManager behind it. Leave both nil and
nothing changes.
10. FIXED - the ncwEndEntityCA wizard produced a certificate that could not
sign anything
TstBaseCertificateGenerator.CertificateWizard accepts ncwEndEntityCA, the
mode for a CA that may issue end-entity certificates and nothing else, and
ImposeExtnBasicConstraints has always had the branch that gives it CA:TRUE
with pathLenConstraint 0. Selecting the mode never reached that branch:
the property setter seeds the extension set from a case that covered every
other mode and not this one, so basicConstraints, keyUsage and both key
identifiers were all left out.
The result looked like a certificate and was unusable - without CA:TRUE and
keyCertSign, nothing it issued would validate anywhere.
ANY CA CERTIFICATE MINTED WITH ncwEndEntityCA MUST BE RE-ISSUED. The defect
is not visible in the certificate's own validation - it is visible as four
missing extensions, so compare against a certificate viewer rather than
assuming.
11. NEW - id-pkix-ocsp-nocheck is a recognised extension
A delegated OCSP responder carries id-pkix-ocsp-nocheck (RFC 6960
s4.2.2.2.1) to say that its own revocation must not be checked, that being
circular. The extension was not in the table, so setting it left the value
unresolved and encoding failed somewhere unrelated. It is now
evPkixOcspNocheck, with id_pkix_ocsp_nocheck in StreamSec.DSI.Ocsp beside
its siblings.
ALSO: stOIDs gains a certificate-policy arc under the StreamSec branch -
id_pkipolicy, id_cp and id_cp_ownuse - for deployments that assert a policy
of their own rather than an audited scheme's.
12. FIXED - TstTimeStampClient could not verify a time stamp from ANY
authority that does not sign with RSA
VerifyTokenSignature cast the TSA's public key with
lSignPubl := lPK as iSignPublicKeyIF;
iSignPublicKeyIF is the integer-factorisation signing interface - RSA and
nothing else. An ECDSA key supports iSignPublicKeyDL instead, and EdDSA and
ML-DSA support neither. The routine already had branches for both of those,
written deliberately; the cast ran first and raised EIntfCastError before
either could be reached.
It surfaced badly too: the exception escaped RequestTimeStamp with
LastError still empty, so an application saw "Interface not supported" and
nothing about which endpoint or why.
Now obtained with Supports, and nil is a legitimate answer meaning "this
key is not RSA". The one place that requires an RSA key - the RSASSA-PSS
parameters - checks and says so. Most public authorities sign with RSA,
which is why this went unseen; if you have ever had an unexplained
"Interface not supported" from a time stamp, this was it.
13. NEW - TstTimeStampClient.TsaCertificate: verifying tokens that carry no
certificate of their own
property TsaCertificate: iCertificate;
RFC 3161 lets a client clear certReq to ask the TSA not to embed its
certificate chain. Until now this client could not verify the result: it
looked for the signer only among the certificates carried INSIDE the token,
so clearing certReq produced tokens nothing could check, which made the
option useless rather than merely smaller.
TsaCertificate supplies that certificate out of band. It is a FALLBACK, not
an override - a certificate carried inside a token still wins, so setting
this cannot change how any existing token verifies.
Measured against nine public authorities, a token drops from 4.3-7.6 kB to
0.9-1.5 kB. Two caveats, both measured and both in the unit header: some
authorities ignore certReq and embed the chain anyway, and some answer
consecutive requests with DIFFERENT signer certificates - with those, one
pinned certificate verifies some tokens and not others. Test\tsa\TsaProbe
measures all of it against a list of public authorities.
14. NEW - tPkcs11Token.CreateDataObject / FindDataObjects
function CreateDataObject(const aValue: tBytes;
const aDataLabel: string;
aPrivate: Boolean;
out aObject: CK_OBJECT_HANDLE): CK_RV;
function FindDataObjects(const aDataLabel: string): tCK_ObjectHandleArray;
Writes and finds CKO_DATA objects - arbitrary bytes under a label, on the
token. For small state that must live somewhere the holder of a FILE cannot
reach: a counter, a high-water mark, an anchor. Not for bulk data; a
token's flash is finite.
CKO_DATA is OPTIONAL in PKCS#11 and a device may refuse it outright, so
callers are expected to probe and have somewhere else to put it. Object
creation also needs a read/write session, which ReopenReadWrite provides -
the session Open establishes is read-only, and the login does not survive
the reopen.
15. FIXED - AES-GCM and AES-CCM had no algorithm identifier
tRijndael_ECB.OID answered for ECB, CBC, OFB, CFB and wrap only, so an
AEAD cipher returned an empty OID and a caller had nothing to put in an
AlgorithmIdentifier - which is where these two are most wanted, RFC 5084
being what CMS uses for authenticated encryption. GCM and CCM now answer
for all three key sizes.
NIST assigns no CTR identifier in that arc, so CTR still answers empty;
this library's own CTR OIDs are unaffected.
16. IMPROVED - OID names: a registration no longer overrides a built-in one,
and three hashes were reported as the wrong algorithm
BEHAVIOUR CHANGE, display only. GetObjectName resolves an OID from a
hard-coded arc tree, and used to consult the run-time registry FIRST,
returning early on any answer. A RegisterOID call anywhere in the program
therefore overrode the built-in name. That is why the id-kp arc printed two
ways - id_kp_serverAuth with underscores where something had registered it,
id-kp-OCSPSigning with hyphens where nothing had. The built-in tree now
decides first and a registration fills only what it does not know, so
application-registered OIDs still resolve exactly as before.
ALSO FIXED: the hash arc compared dotted text without a boundary check, so
2.16.840.1.101.3.4.2.10, .11 and .12 - SHA3-512, SHAKE128 and SHAKE256 -
all matched id-sha256 (...4.2.1) and were REPORTED AS "id-sha256". Anything
that displayed a hash algorithm name showed the wrong one for those three.
ALSO NAMED, having previously shown as numbers: the twelve SLH-DSA
identifiers (FIPS 205), SHAKE128/256, AES wrap/GCM/CCM/wrap-pad for all
three key sizes, id-kp-OCSPSigning, id-kp-documentSigning,
id-ct-TSTInfo, id-aa-signatureTimeStampToken, and the arcs themselves -
id-pkix, id-at, id-hashAlgs, id-signAlgs, id-kems and the rest - so an
unrecognised OID now reads "{ id-kp 9999 }" rather than
"{ iso(1) identified-organization(3) 6 1 5 5 7 3 9999 }".
stOIDs gains anyExtendedKeyUsage (RFC 5280 s4.2.1.12), which had no name,
and a private extended key purpose arc - id_kp_streamsec and
id_kp_registerSigning - for the certificate that signs a CA's issuance
register. No standard purpose names that job.
17. NEW - TstTimeStampClient is on the component palette
The RFC 3161 time-stamp client was a runtime-only class: usable from
code, but absent from the "StreamSec Tools" page, so it could not be
dropped on a form and its properties could not be set in the Object
Inspector. It now registers alongside TstMPSignedData, TstMPEnvelopedData
and TstMPCMSBroker, with a palette icon at all three sizes.
No source change is needed and nothing about the class itself changed.
Reinstall the design-time package to pick up the new palette entry.
18. REMOVED - the asynchronous CTR keystream generator
Four identifiers are gone from stBlockCipher:
tBlockCipher.KeyStreamGenerator (public property)
iGenerateKeyStream (interface)
tKeyStreamGenerator (class)
gKeyStreamGenerator (unit variable)
Together they implemented an out-of-band keystream cache for CTR mode. The
cipher drives the CTR counter synchronously, one block at a time, and holds
no pre-computed keystream, so nothing drew on that cache: the generator
thread was created at unit initialization and then idled for the life of
the process.
WHAT YOU GAIN. One fewer thread per process. stBlockCipher is linked by
every AES and 3DES class, so any application doing symmetric crypto - which
is to say any TLS or SSH application - was starting that thread. Cipher
behaviour is unchanged; the counter path is untouched, and
tBlockCipher.GenerateKeyStream remains available.
WHAT TO CHECK. Only code naming one of the four identifiers above needs
editing, and only to delete the reference - assigning a KeyStreamGenerator
never affected the data that came out of the cipher.
THE NOKEYSTREAMGENERATOR DEFINE. The generator could be compiled out with
this conditional define, which stBlockCipher had honoured since 4.0. The
define was never set in a shipped package or configuration file, so a stock
build - 4.0 and 4.1 alike - started the thread. It is now inert: it guards
nothing, and it can be dropped from any build configuration carrying it.
stThreadSafeQueue drops out of all fourteen runtime packages. The unit still
ships as source, but it is not compiled into a package any more, so the
third-party code it carries (attributed to Nexus Database Systems) does not
reach an application built against them. The SBOM
(StreamSec_Tools_<version>.cdx.json) records it as excluded on that basis.
================================================================================
End.
================================================================================