Skip to content

Added x509 examples - #33

Draft
hokorn wants to merge 4 commits into
mainfrom
feat/x509-util-library
Draft

Added x509 examples#33
hokorn wants to merge 4 commits into
mainfrom
feat/x509-util-library

Conversation

@hokorn

@hokorn hokorn commented Aug 13, 2026

Copy link
Copy Markdown

No description provided.

Harald Okorn and others added 2 commits August 13, 2026 11:31
Companion to the trust-store and onboarding fixes on the
waltid-identity feat/x509-util-library branch (PR #1901).

- ConfigureTrustStoreExample.kt: add a demonstration that passing a
  trust store as the second argument to X509CertificateUtil.Default's
  validate calls fully replaces its configured trust store rather than
  merging with it - it's not necessary to build a whole new util via
  setTrust() just to scope trust for a single call.
- SignCertificateExample.kt: clarify the same point with a comment at
  its own validateCertificateChain() call, which uses this pattern.
- New IsoMdlOnboardingExample.kt: builds a profile-compliant IACA root
  and Document Signer certificate via the ISO profile helpers, then
  demonstrates why a caller-supplied root must be validated against
  IsoIaCaRootX509CertificateProfile before being trusted as a signing
  anchor - mirrors OnboardingService.onboardDocumentSigner(), showing
  a non-compliant self-signed "root" correctly rejected with specific
  profile violations (missing KeyUsage, missing IssuerAlternativeName,
  wrong pathLenConstraint) rather than silently accepted.

Built and ran all three examples against a local waltid-x509
1.0.0-SNAPSHOT publish containing the fixes.
@philpotisk

Copy link
Copy Markdown
Contributor

Pushed 840a56e - built and ran all three examples against a local waltid-x509:1.0.0-SNAPSHOT publish containing the trust-store and IACA-onboarding fixes from walt-id/waltid-identity#1901.

Context: while reviewing that PR I found X509CertificateChainValidator was silently merging any caller-supplied trust store with the util's own configured one (JVM cacerts on X509CertificateUtil.Default), so passing your own anchors via the two-arg validateCertificateChain() overload didn't actually scope trust the way it looked like it should. SignCertificateExample.kt here demonstrated exactly that pattern as "how to validate a chain against your own root" - it's now correct after the fix (the second argument fully replaces rather than merges), but I added comments to both existing examples clarifying the scoping semantics so it's not just accidentally correct-looking.

Also added IsoMdlOnboardingExample.kt, which builds an IACA root + Document Signer via the ISO profile helpers and then demonstrates the other fix: a caller-supplied "root" now gets validated against IsoIaCaRootX509CertificateProfile before being trusted as a signing anchor, so a non-compliant self-signed cert gets rejected with specific violations rather than silently accepted.

The x509/ examples (SignCertificateExample, ConfigureTrustStoreExample,
IsoMdlOnboardingExample) weren't referenced anywhere in the README -
added them to the project structure tree, a new Available Examples
table, run commands, and Key Features.
@philpotisk

Copy link
Copy Markdown
Contributor

Pushed c1accc9 - the README didn't reference the x509 examples anywhere (project structure, available examples table, run commands, key features). Added them throughout, matching the existing sections' format. Also did a pass on waltid-x509's own README in the identity repo, which was significantly out of date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants