4.1.4. Setting up the helpers#

Each helper is installed, configured and started on its own, before KyCH is pointed at it. Its manual page describes every option; this chapter says how the pieces fit together. Every package ships its service disabled, since none has anything useful to do before it is configured, and repeats its steps in /usr/share/doc/PACKAGE/README.Debian.

4.1.4.1. kych-trust#

kych-trust takes the trust decisions for all of KyCH’s EU PID helpers, so that they agree by construction (Trust explains why):

  • it fetches every list the [trust-*] sections name, verifies it against the scheme operator’s certificate (LOTE_SIGNER), refuses an expired list or one older than the list in use (rollback), and keeps every accepted version as a snapshot in its own PostgreSQL database; a failed refresh keeps the last good snapshot;

  • it answers the EUDI reference verifier’s Trust Validator protocol (POST /trust), which the verifier is pointed at with VERIFIER_TRUSTVALIDATOR_SERVICEURL, and kych-oid4vp asks the same;

  • it exports the trust anchors of a class (GET /anchors/PID) for the walt.id verifier;

  • every answer names the snapshot it was taken on, which KyCH copies into the evidence.

[root@server]# apt install ./kych-trust_*.deb
[root@server]# kych-trust-dbconfig

Put the [trust-*] sections into /etc/kych-trust/trust.conf (the lists are public; mode 0644) and the scheme operators’ certificates into /etc/kych-trust/signers/, and pull the file into both configurations, kych-trust’s and KyCH’s, with @inline@ /etc/kych-trust/trust.conf.

kych-trust listens on /run/kych-trust/kych-trust.sock by default. The EUDI verifier cannot reach a Unix domain socket, so where it is used, kych-trust listens on loopback TCP instead; the interface has no authentication and must not be reachable from anywhere else:

/etc/kych-trust/kych-trust.conf#
[kych-trust]
SERVE = tcp
BIND_TO = 127.0.0.1
PORT = 18090

@inline@ /etc/kych-trust/trust.conf

KyCH’s shipped KYCH_TRUST_URL and the verifier’s shipped VERIFIER_TRUSTVALIDATOR_SERVICEURL point at that port.

[root@server]# systemctl enable --now kych-trust
[root@server]# sudo -u kych-trust kych-trust -c /etc/kych-trust/kych-trust.conf --refresh-once
[root@server]# curl -s http://127.0.0.1:18090/status

/status shows every list, its snapshot and the last error. What kych-trust checks, and what it deliberately does not, is in kych-trust(1); its options in kych-trust.conf(5).

4.1.4.2. swiyu-verifier#

The Swiss e-ID is verified by the Swiss Confederation’s SWIYU Generic Verifier, packaged as swiyu-verifier; its setup, including the onboarding to the swiyu trust infrastructure, has a manual of its own, Swiyu Verifier Operator Manual. KyCH’s defaults already define the vocabulary swiyu and a helper [helper-swiyu] for a verifier on http://127.0.0.1:8080; what they cannot know is which issuers to trust:

/etc/kych/kych.conf#
[trust-swiyu]
ACCEPTED_ISSUER_DIDS = {did:tdw:...}

The verifier calls KyCH’s /notification when a verification changes state, so it must be configured with KyCH’s URL. It cannot be asked for optional claims or for one of several credentials.

4.1.4.3. The EUDI verifier#

The European Commission’s reference verifier, packaged as eudi-verifier from the eudi-verifier/upstream submodule with KyCH’s patches, serves eupid and eupid-mdoc. eudi-verifier(1) describes it in full.

[root@server]# apt install ./kych_*.deb ./kych-trust_*.deb ./eudi-verifier_*.deb

Trust. The verifier trusts every issuer unless its Trust Validator says otherwise, so it must ask kych-trust, over loopback TCP (above). Our patch makes it check the status lists through kych-trust as well (context PIDStatus): upstream accepted a list signed by anyone. KyCH asks kych-trust too, to put the trust anchor and the list snapshot into the evidence.

Keys and certificates. The verifier signs its requests with the relying party’s access certificate (Authorisations, certificates and whom to ask; for tests, the simulated one of testing/trust). It goes into /etc/eudi-verifier/secrets/access-certificate.p12 (alias access_certificate), its passwords into /etc/eudi-verifier/secrets/keystore.env. With the client id prefix x509_hash (HAIP) the client id is the certificate’s hash; the start script computes it at every start. Every transaction also needs a registration certificate for its intended use: KyCH sends the profile’s (REGISTRATION_CERTIFICATE in [profile-kyc]), or names one the verifier has configured (INTENDED_USE_ID in [helper-eudi-ref], with the certificate in /etc/eudi-verifier/secrets/intended-uses.env).

The public URL and nginx. VERIFIER_PUBLICURL in /etc/eudi-verifier/local.env is the public base. The verifier listens on /run/eudi-verifier/http.sock; wallets reach its /wallet/ paths, and only those, through the reverse proxy; its management API (/ui/, /utilities/) authenticates nobody and is reached by KyCH alone, over the socket. /usr/share/eudi-verifier/nginx/eudi-verifier.conf does this.

KyCH. The shipped defaults define [helper-eudi-ref] on that socket and point both EU PID vocabularies at it; kych.conf adds the trust list, the registration certificate and the public URL:

/etc/kych/kych.conf#
[kych-oauth2-gateway]
VOCABULARIES = {eupid, eupid-mdoc}
BASE_URL = https://kych.example.com/

@inline@ /etc/kych-trust/trust.conf

[vocabulary-eupid]
TRUST = pid-providers

[vocabulary-eupid-mdoc]
TRUST = pid-providers

[profile-kyc]
REGISTRATION_CERTIFICATE = /etc/kych/registration/kyc.jwt

KyCH refuses to start if an EU PID vocabulary is not trusted through a list kych-trust serves. The verifier has no webhook, so KyCH asks it whenever the browser polls /status; it fails the session when the verifier refused what the wallet posted, when the transaction expired there (VERIFIER_MAXAGE, 15 minutes as KyCH’s own sessions), or when the verifier was restarted and does not know it any more – it keeps its transactions in memory only.

[root@server]# systemctl enable --now eudi-verifier
[root@server]# curl --unix-socket /run/eudi-verifier/http.sock http://localhost/actuator/health

4.1.4.4. The walt.id verifier#

walt.id’s verifier service (verifier-api2 of the walt.id Community Stack), packaged as waltid-verifier from the waltid-verifier/upstream submodule with KyCH’s patches, is interchangeable with the EUDI verifier: the same vocabularies, the same DCQL queries, the same trust. waltid-verifier(1) describes it in full.

[root@server]# apt install ./kych_*.deb ./kych-trust_*.deb ./waltid-verifier_*.deb

Keys and certificates. The service signs its request objects with the relying party’s access certificate too, but takes it as HOCON: the client id, the private key as a JWK and the certificate chain go into /etc/waltid-verifier/secrets/request-signing.conf (0640 root:waltid-verifier). For tests, the simulated trust infrastructure writes exactly that file (testing/trust: conf/waltid-verifier-service.conf).

The public URL and nginx. urlPrefix in /etc/waltid-verifier/local.conf is the public URL of its /verification-session paths. The service listens on /run/waltid-verifier/http.sock; wallets need only GET/POST /verification-session/ID/request and POST /verification-session/ID/response, and only those may be published – everything else on the socket creates sessions, reads their results or deletes them, and authenticates nobody. The example site /usr/share/waltid-verifier/nginx/waltid-verifier.conf does this.

Trust. walt.id checks a credential’s signature, not who made it, unless the session says whom to trust; KyCH always sends a trust policy, chosen by TRUST in [helper-waltid]:

  • kych-trust (the default): the anchors of kych-trust’s current snapshot (x509-trust), and for the signer of a status list those of the revocation context. The decisions are the EUDI verifier’s by construction, and the evidence names kych-trust’s anchor and snapshot.

  • self: the list itself (etsi-trust-list) with its signer certificate, which walt.id fetches and checks on its own – for a host without kych-trust. The evidence then holds walt.id’s own match on the list, without anchor or snapshot, and walt.id has no rollback protection in this mode: it keeps nothing between sessions, so a superseded but validly signed list is accepted. Prefer kych-trust wherever kych-trust can run.

The webhook. walt.id can tell KyCH when a session has an outcome, but cannot call KyCH’s Unix socket: the example site has a loopback server, 127.0.0.1:18444, that passes POST /notification to KyCH. Allow it in /etc/waltid-verifier/network-fetch-guard.conf (trustedHostSuffixes = ["localhost"]) and name it in kych.conf. Note that this lets walt.id fetch any URL naming localhost, a presented credential’s status URI included; the example’s loopback server answers only POST /notification.

/etc/kych/kych.conf#
[helper-waltid]
NOTIFY_URL = http://localhost:18444/notification

Without NOTIFY_URL KyCH asks walt.id whenever the browser polls /status, as it does the EUDI verifier; with it, every ten seconds as a fallback, for the sessions walt.id lets expire or loses in a restart, of which no webhook tells. walt.id keeps its sessions in memory: a restart fails the sessions in flight.

[root@server]# systemctl enable --now waltid-verifier
[root@server]# curl --unix-socket /run/waltid-verifier/http.sock http://localhost/livez

4.1.4.5. KyCH’s own verifier: kych-oid4vp#

kych-oid4vp, KyCH’s own OpenID4VP 1.0 verifier, is interchangeable with the other two – the same vocabularies, the same DCQL queries, the same trust – but built for KyCH: it speaks the KyCH-native helper API, authenticates KyCH by a secret, keeps its sessions in its own PostgreSQL database, takes every trust decision through kych-trust (issuers and the signers of status lists), fails a session at once for a response it cannot use (undecryptable, in the clear, too large), and hands back its evidence in KyCH’s own shape. kych-oid4vp(1) and kych-oid4vp.conf(5) describe it in full.

[root@server]# apt install ./kych_*.deb ./kych-trust_*.deb ./kych-oid4vp_*.deb
[root@server]# kych-oid4vp-dbconfig

Two sockets. Its management API is /run/kych-oid4vp/api.sock (group kych-oid4vp, which the package adds the user kych to); the wallet-facing GET/POST request/TOKEN and POST response/TOKEN are on /run/kych-oid4vp-wallet.sock (group www-data, created by the unit kych-oid4vp.socket), which the reverse proxy publishes under its BASE_URL – the example site /usr/share/kych-oid4vp/nginx/kych-oid4vp.conf puts it at /kych-oid4vp/.

Keys, trust, the secret. SIGNING_KEY and SIGNING_CERTIFICATE in /etc/kych-oid4vp/kych-oid4vp.conf are the access certificate’s key (P-256, PKCS#8 PEM) and chain, CLIENT_ID_PREFIX says whether the client id is its hash (HAIP) or its DNS name, KYCH_TRUST_URL (or KYCH_TRUST_UNIXPATH, or KYCH_TRUST_DATABASE for kych-trust’s database) where trust is decided, BASE_URL where nginx publishes the wallet paths. Without kych-trust the service refuses to start: it would trust every issuer. The package generates the API secret on its first install, in /etc/kych-oid4vp/secrets/api.secret.conf (root:kych-oid4vp 0640), under both programs’ section names, so that KyCH – in group kych-oid4vp – pulls in the very same file:

/etc/kych/kych.conf#
@inline-secret@ helper-kych-oid4vp /etc/kych-oid4vp/secrets/api.secret.conf

[helper-kych-oid4vp]
NOTIFY_URL = http://localhost:18444/notification

[vocabulary-eupid]
HELPER = kych-oid4vp

[vocabulary-eupid-mdoc]
HELPER = kych-oid4vp

The notification. kych-oid4vp posts {"session_id": ...} to NOTIFY_URL when a session ends; the loopback server passes it to KyCH’s socket. Without NOTIFY_URL KyCH polls; with it, it still asks every ten seconds in case a notification was lost.

Its data. kych-oid4vp stores the disclosed claims and the evidence only until KyCH has fetched them and its PURGE_GRACE (10 minutes) has passed, or the session expired; a session’s response decryption key goes when it ends; the rows themselves after RETENTION (24 h). Unlike the upstream helpers, kych-oid4vp keeps its sessions across a restart.

[root@server]# systemctl enable --now kych-oid4vp.socket kych-oid4vp
[root@server]# curl --unix-socket /run/kych-oid4vp/api.sock http://localhost/config

4.1.4.6. npa: the German identity card#

The vocabulary npa is the German identity card’s online function (the eID card for EU citizens and the electronic residence permit work the same way): the person holds the card to a reader or a phone with AusweisApp, enters the PIN, and an eID server reads the data from the card over a channel only it and the card can open. Its attributes have the names of the eID server interface of BSI TR-03130 – FamilyNames, GivenNames, DateOfBirth, PlaceOfBirth, Nationality, PlaceOfResidence, RestrictedID – and it reaches LoA high. The card never transmits a document number; RestrictedID, the card’s identifier for this one service provider, is what § 8 (2) GwG has recorded instead.

Two eID servers serve it, interchangeably; both need the same Berechtigung and BerCA contract (Authorisations, certificates and whom to ask).

4.1.4.6.1. The Governikus middleware and kych-eumw-bridge#

The eID server is the Governikus eIDAS Middleware (package governikus-eumw, EUPL-1.2), and between KyCH and it sits kych-eumw-bridge: a KyCH-native helper towards KyCH, the middleware’s eIDAS connector towards it. KyCH sends the browser to the bridge, the bridge to the middleware with a signed SAML request, the middleware starts AusweisApp, runs the identification, and posts the encrypted, signed answer back through the browser; the bridge checks it, tells KyCH and sends the browser to /return. All SAML cryptography is the bridge’s and the middleware’s, so KyCH stays without any.

[root@server]# apt install ./kych_*.deb ./governikus-eumw_*.deb ./kych-eumw-bridge_*.deb

The middleware is configured in its admin interface (on 127.0.0.1:8096, reached by an SSH tunnel; governikus-eumw(1) and the package’s README.Debian list the steps): its SAML signature key and the BerCA TLS client key, the BerCA’s URLs and certificates, the master list and block list trust anchors, its server URL – the public origin, which must match the TLS certificate and the subject URL of the authorisation certificate –, the bridge as its connector (https://eid.example.com/npa/metadata), and an eID service provider named kych with the initial certificate request. Its configuration lives in its database and can be exported and imported as one XML file. The bridge needs its public URL, the middleware’s request URL and the middleware’s SAML signature certificate (kych-eumw-bridge(1)), and BRIDGE_SAML_PERMITTED_ATTRIBUTES equal to the attribute set of the Berechtigung, so that it refuses at once a session that asks for more (the middleware would otherwise fail while the person waits). nginx publishes /eidas-middleware/ and /npa/ and nothing else (/usr/share/governikus-eumw/nginx/governikus-eumw.conf). KyCH:

/etc/kych/kych.conf#
[kych-oauth2-gateway]
VOCABULARIES = {eupid, eupid-mdoc, npa}

@inline-secret@ helper-eumw /etc/kych-eumw-bridge/secrets/api.secret.conf

The shipped defaults route [vocabulary-npa] to [helper-eumw] on /run/kych-eumw-bridge/api.sock; the package adds kych to the group that may read the secret.

What arrives. The middleware passes on what an eIDAS node can carry, which the bridge maps back to TR-03130 shapes: the date of birth as {"DateString", "DateValue"}, the place of birth as free text (a structured place’s city), the address as a structured place, the nationality as an ISO 3166-1 alpha-2 code, the pseudonym as {"ID"}. Document type, issuing state and expiry date cannot be had this way. The profile kyc asks for everything it needs as required, except the address: a card whose holder has no residence in Germany says “no place”, and KyCH then reports PlaceOfResidence in missing.

4.1.4.6.2. kych-eid#

KyCH’s own eID server, kych-eid (Rust), serves the same vocabulary through the same KyCH-native helper API without a middleware and without SAML: it speaks to AusweisApp itself (the tcToken and the PAOS dialogue of BSI TR-03124-1 [TR03124] and TR-03112-7 [TR03112]), performs Terminal and Chip Authentication with the card (TR-03110 [TR03110]), checks the card’s document signer against the master and defect lists and the card against the block list, and reads the data groups (TR-03127 [TR03127]) the authorisation certificate allows. Because nothing is squeezed through an eIDAS node, it delivers all of TR-03130’s data but the verifications: document type, issuing state and expiry date, a structured place of birth, free-text and “no place” residences, the nationality as the card has it (D, FRA; the exchange’s converter maps both). Its companion kych-eid-berca keeps the authorisation certificate and the lists up to date from the BerCA (TR-03129).

[root@server]# apt install ./kych_*.deb ./kych-eid_*.deb
[root@server]# kych-eid-dbconfig
[root@server]# su -s /bin/sh kych-eid -c 'kych-eid-berca -c /etc/kych-eid/kych-eid.conf init'
[root@server]# systemctl enable --now kych-eid-berca.timer kych-eid.socket kych-eid.service

/etc/kych-eid/kych-eid.conf names the public URL (BASE_URL, on the origin the certificate description names, with the TLS certificate whose hash it lists) and the BerCA (URL, HOLDER); the trust anchors of the contract go into /etc/kych-eid/trust/ and the BerCA TLS client key into /etc/kych-eid/secrets/ (kych-eid.conf(5)). init generates the terminal key in /var/lib/kych-eid, requests the first authorisation certificate and fetches its description, the sector key and the three lists; the timer renews the certificate 48 hours before it expires and fetches the lists every two hours. kych-eid refuses new sessions while its terminal certificate is out of date or its block list is older than MAX_BLOCK_LIST_AGE (48 hours). The package generated the API secret and a key and self-signed certificate the results are signed with; replace the latter with one of your own PKI if the signed results are to be verified against it.

nginx publishes /kych-eid/{start,tctoken,paos,refresh}/ and nothing else (/usr/share/kych-eid/nginx/kych-eid.conf), from one TLS endpoint, since AusweisApp resumes the tcToken’s TLS session for PAOS. Switching npa to it, for new sessions:

/etc/kych/kych.conf#
@inline-secret@ helper-kych-eid /etc/kych-eid/secrets/api.secret.conf

[helper-kych-eid]
NOTIFY_URL = http://localhost:18444/notification

[vocabulary-npa]
HELPER = kych-eid

Its evidence is its own signed result – a CMS signature of kych-eid’s result signing key over the attributes and every check it made – with the same caveat as the middleware’s: the statement of a server the operator runs, not a proof from the card (kych-eid(1)). Both eID servers pass the same 14 end-to-end cases (testing/npa/RESULTS-differential.md).

4.1.4.6.3. Testing without cards and without a BerCA#

testing/npa/ in the source tree builds a complete test environment: its own test PKI (CVCA, DV, CSCA, list signers), a mock BerCA that answers BSI TR-03129 requests, AusweisApp’s headless SDK with its simulator card (patched to trust that test CVCA), and an end-to-end driver through KyCH’s OAuth 2.0 flow, with cancelled, wrong-PIN, expired, revoked and tampered cases, for either eID server (npa-e2e.py --helper eumw|kych-eid, use-eid-server.sh).

4.1.4.7. eidas: other member states’ eIDs#

The vocabulary eidas is another EU member state’s notified electronic identification – an Austrian ID Austria, a Belgian eID card, an Italian SPID account – used through the eIDAS network: the person’s own country runs a proxy service, which identifies them with that country’s means and sends the result, signed and encrypted, to the connector of the country where the service is (the interoperability framework of CIR (EU) 2015/1501 [CIR2015-1501]). Its attributes have the names of the eIDAS SAML Attribute Profile, http://eidas.europa.eu/attributes/naturalperson/...: CurrentFamilyName, CurrentGivenName, DateOfBirth, PersonIdentifier (the minimum data set) and Nationality, PlaceOfBirth, CurrentAddress and the rest. In Germany a private service provider runs its own connector (Authorisations, certificates and whom to ask).

The route. The connector is the European Commission’s eIDAS-Node Connector (package eidas-node-connector, release 3.1.0, EUPL-1.2), in a Tomcat of its own on a Unix socket. Its service-provider side is member-state-specific by design, and kych-eumw-bridge is that part: a KyCH-native helper towards KyCH (kind eidas-saml), the Connector’s specific connector towards it. Every XML signature and decryption is the Connector’s: neither KyCH nor the bridge does any.

[root@server]# apt install ./kych_*.deb ./kych-eumw-bridge_*.deb ./eidas-node-connector_*.deb
[root@server]# eidas-node-connector-setup --public-url https://eid.example.com/ \
    --country DE --response-receiver https://eid.example.com/eidas/response \
    --service AT=https://eidas.example.at/EidasNode/ServiceMetadata \
    --trust /root/at-metadata-signer.pem \
    --metadata-signer-keystore /root/metadata-signer.p12 --metadata-signer-password ... \
    --contact-email support@example.com \
    --bridge-env /root/bridge-eidas.env --bridge-requester-id https://kych.example.com/
[root@server]# cat /root/bridge-eidas.env >> /etc/kych-eumw-bridge/local.env
[root@server]# echo BRIDGE_EIDAS_BASE_URL=https://eid.example.com/eidas/ >> /etc/kych-eumw-bridge/local.env
[root@server]# systemctl enable --now eidas-node-connector
[root@server]# systemctl restart kych-eumw-bridge

One --service per member state whose eIDs are accepted, with the signer certificate of its metadata in --trust (eidas-node-connector-setup(1)). --contact-email puts the institution’s address on the Connector’s error pages, which is where a person ends up when a node finds an error itself. nginx publishes /EidasNodeConnector/ and /eidas/ and nothing else (/usr/share/eidas-node-connector/nginx/eidas-node-connector.conf). The Connector’s Hazelcast caches have no authentication: Connector and bridge belong on a host without untrusted local users. KyCH:

/etc/kych/kych.conf#
[kych-oauth2-gateway]
VOCABULARIES = {eupid, eupid-mdoc, npa, eidas}

@inline-secret@ helper-eumw /etc/kych-eumw-bridge/secrets/api.secret.conf

The shipped defaults route [vocabulary-eidas] to [helper-eumw] as well: one bridge serves npa, eidas or both, and offers in its /config the routes that are configured.

Level of assurance. The bridge asks for high by default and refuses anything lower: § 12 (1) sentence 1 no. 4 GwG accepts for identification only an eID scheme notified under Art. 8 (2) (c) eIDAS, the level high. Schemes notified at substantial (several are) therefore do not work for the kyc profile; BRIDGE_EIDAS_LEVEL_OF_ASSURANCE changes it for other purposes.

The data-set limits. Only the minimum data set is guaranteed (Features and limitations). The profile kyc asks for place of birth, nationality and address as optional, so that an eIDAS identification succeeds with the minimum data set and /info lists the rest in missing. The exchange’s AML program must complete them: with taler-exchange-helper-measure-identification-check and the default required attributes, a result without NATIONALITY, PLACE_OF_BIRTH or the address does not lift the rule but triggers the measure’s fallback_measure – in the example configuration the identification with documents through Beekeeper, which collects the nationality. Names may arrive twice, the second in Latin transliteration; KyCH keeps the one in Latin script.

What the evidence proves. The proxy service signs its SAML response, and the evidence holds that response as it arrived and the decrypted assertion, with the proxy service’s certificate the Connector checked them against. The response’s signature covers the assertion encrypted to the Connector – showing its content to an auditor later needs the Connector’s decryption key – and where a state also signs the assertion itself, the attributes can be checked against that state’s node directly. The Connector of the release hands its specific part none of this; the package’s build carries KyCH’s patch for it, and the bridge refuses an identification without it.

Testing without a member state. testing/eidas/ in the source tree builds a local eIDAS network on one host: the packaged Connector as DE and the release’s proxy service, demo Specific Proxy Service and demo IdP as another state CA, each with its own keys and metadata signer, and an end-to-end driver through KyCH’s OAuth 2.0 flow, the exchange and Beekeeper, with cancelled, refused, too-low, tampered, replayed and untrusted-metadata cases.