Class UpdateVerifier
java.lang.Object
com.iizix.server.tools.UpdateVerifier
Verifies an update package - the signed
iiziServer-distribution-V.B.jar - right before the updater writes anything (CC-SERVER-RESTART-UPDATE-V5, survey section 6, the owner's ruling of 2026-10-11 18:41 point 5):- every entry is signed, and by ONE chain (an entry altered after the signing fails to read, an entry added after it has no signer);
- the leaf's public key equals one of the AT MOST TWO keys the running build pins (old and current, current and new, or only current): a package signed by a key the build does not know is refused, and the administrator must download a newer build of the server, which knows the new certificate - no override;
- the chain validates (PKIX) to the trust store - the JDK's
cacerts- at the date of the signature's timestamp (TSA), so that a package signed while the certificate was valid still verifies after its expiry; - the package's build is newer than the installed one (a downgrade only with the explicit offline flag);
- the expected top-level directories are there and exactly one
lib/com.iizix.standardserver-*.jar; - no entry with
.., an absolute path or a drive letter (zip slip); - the package's flavour, read from its server jar (
DistributionFlavour: customer, mindus or mls), is the installation's - a customer package never updates a Mindus installation, nor the reverse (CC-FIX-DIST-NO-ICU, the owner's ruling DN-1 of 2026-10-23); - the installation's disk has room for the stage and the rollback copy.
-allowUnsigned (the server's -allowUnsignedUpdate true, refused in a production run mode).Nothing here depends on another IIZI class: the updater runs from its own jar.
- Author:
- Christopher Mindus
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordWhat the verification found.Field Summary
FieldsConstructor Summary
ConstructorsConstructorDescriptionUpdateVerifier(Collection<PublicKey> pinned, Collection<TrustAnchor> anchors, String currentBuild, boolean allowDowngrade, boolean allowUnsigned) Constructor without a flavour check (the tests of the other checks).UpdateVerifier(Collection<PublicKey> pinned, Collection<TrustAnchor> anchors, String currentBuild, String installedFlavour, boolean allowDowngrade, boolean allowUnsigned) Constructor.Method Summary
Modifier and TypeMethodDescriptionstatic intcompareBuilds(String a, String b) Compares two builds: the last numeric component is the build number, the ones before are the version.static StringinstalledBuild(File install) Finds the build of an installation: the version string of its single server jar.static Set<TrustAnchor> Loads the trust anchors of the JDK this JVM runs on:<java.home>/lib/security/cacerts.pinnedKeys(String pem) Reads the public keys of the certificates of a PEM text (the pinned signers of a build).static Set<TrustAnchor> trustAnchors(File file, char[] password) Loads the trust anchors of a key store (every certificate entry).static StringunsafeEntry(String name) Checks an entry name for zip slip:..as a segment, an absolute path, a drive letter, a backslash.Verifies a package.
Field Details
TOP_LEVEL
The top-level directories a package carries (build-iiziServer-distribution.ps1).SERVER_JAR
The server jar inside a package or an installation:lib/com.iizix.standardserver-5.0.0.20657.jar.
Constructor Details
UpdateVerifier
public UpdateVerifier(Collection<PublicKey> pinned, Collection<TrustAnchor> anchors, String currentBuild, boolean allowDowngrade, boolean allowUnsigned) Constructor without a flavour check (the tests of the other checks).- Parameters:
pinned- The public keys the running build pins, at most two; empty for an unsigned build.anchors- The trust anchors (the JDK's cacerts for a real server).currentBuild- The installed build, null when unknown (then no version check).allowDowngrade- true to accept an older or the same build.allowUnsigned- true to accept a package that is not signed.- Throws:
IllegalArgumentException- For more than two pinned keys.
UpdateVerifier
public UpdateVerifier(Collection<PublicKey> pinned, Collection<TrustAnchor> anchors, String currentBuild, String installedFlavour, boolean allowDowngrade, boolean allowUnsigned) Constructor.- Parameters:
pinned- The public keys the running build pins, at most two; empty for an unsigned build.anchors- The trust anchors (the JDK's cacerts for a real server).currentBuild- The installed build, null when unknown (then no version check).installedFlavour- The installation's flavour (DistributionFlavour.ofInstallation(File)): a package of another flavour is refused; null for no flavour check.allowDowngrade- true to accept an older or the same build.allowUnsigned- true to accept a package that is not signed.- Throws:
IllegalArgumentException- For more than two pinned keys.
Method Details
jdkTrustAnchors
Loads the trust anchors of the JDK this JVM runs on:<java.home>/lib/security/cacerts.- Returns:
- The anchors.
- Throws:
IOException- If the store cannot be read.
trustAnchors
Loads the trust anchors of a key store (every certificate entry).- Parameters:
file- The key store file (JKS or PKCS12).password- Its password.- Returns:
- The anchors.
- Throws:
IOException- If the store cannot be read.
pinnedKeys
Reads the public keys of the certificates of a PEM text (the pinned signers of a build).- Parameters:
pem- The text: one or two-----BEGIN CERTIFICATE-----blocks.- Returns:
- The keys, in order.
- Throws:
IOException- If a certificate cannot be parsed.
installedBuild
compareBuilds
unsafeEntry
verify
Verifies a package.- Parameters:
pkg- The package file.install- The installation directory, for the free-space check; null to skip it.- Returns:
- The result:
okor the reason of the refusal.