Zum Hauptinhalt springen

PKI-Konfiguration

PKI-Endpoints definieren die Zertifizierungsstellen, die IDIAL zur Ausstellung von Zertifikaten für verwaltete OPC UA Geräte verwendet. Jedem Inventareintrag wird ein PKI-Endpoint zugewiesen, der bestimmt, welche CA das Zertifikat ausstellt und welche Trust List auf dem Gerät eingerichtet wird.

IDIAL unterstützt vier PKI-Typen:

Typ-IDNameBeschreibung
0NoneKein PKI konfiguriert.
1InternalIDIAL verwendet seine eigene interne CA.
2ESTEnrollment over Secure Transport (RFC 7030).
3CMPCertificate Management Protocol (RFC 4210).

GET /pki

Gibt die unterstützten PKI-Protokolltypen zurück.

Authentifizierung: X-API-Key erforderlich

Anfrage

curl -X GET http://localhost:5000/pki \
-H "X-API-Key: your-api-key"

Antwort 200

[
{"pki_type_id": 0, "pki_type": "none"},
{"pki_type_id": 1, "pki_type": "internal"},
{"pki_type_id": 2, "pki_type": "est"},
{"pki_type_id": 3, "pki_type": "cmp"}
]

GET /pki/inventory

Gibt alle konfigurierten PKI-Inventareinträge zurück.

Authentifizierung: X-API-Key erforderlich

Anfrage

curl -X GET http://localhost:5000/pki/inventory \
-H "X-API-Key: your-api-key"

Antwort 200

[
{
"pki_id": 1,
"name": "Production EST",
"pki_type_id": 2,
"pki_connection": "est.example.com:8443",
"username": "estuser",
"password_encrypted": 1,
"additional_path_segment": "/profile1",
"est_client_certificate_sha1": "A1:B2:C3:D4:E5:F6:...",
"est_cdp_urls": ["http://crl.example.com/crl.crl"],
"tls_cdp_urls": [],
"tls_ca": ["MIIBxDCC..."],
"tls_crls_info": [
{
"crl_number": 42,
"crl_last_update": "2026-04-01T00:00:00",
"crl_next_update": "2026-05-01T00:00:00"
}
],
"creator_id": null
}
]

Antwortfelder

FeldTypBeschreibung
pki_idintegerEindeutiger PKI-Eintrags-Bezeichner.
namestring | nullAnzeigename des PKI-Eintrags.
pki_type_idintegerPKI-Typ (0=none, 1=internal, 2=EST, 3=CMP).
pki_connectionstringVerbindungsstring (host:port).
usernamestring | nullBenutzername für die PKI-Authentifizierung.
password_encryptedintegerGibt an, ob das Passwort verschlüsselt (1) oder unverschlüsselt (0) gespeichert ist.
additional_path_segmentstring | nullZusätzliches URL-Pfadsegment für EST-Endpoints.
est_client_certificate_sha1string | nullSHA-1-Fingerabdruck des EST-Client-Zertifikats.
est_cdp_urlsstring[]CRL Distribution Point URLs für das EST-CA-Zertifikat.
tls_cdp_urlsstring[]CRL Distribution Point URLs für das TLS-CA-Zertifikat.
tls_castring[]TLS-CA-Zertifikat(e) zur Verifizierung des PKI-Servers.
tls_crls_infoobject[]CRL-Metadaten für jede konfigurierte TLS-CRL.
creator_idstring | nullBezeichner des Erstellers (System oder Benutzer).

GET /pki/inventory/{pki_id}

Gibt einen einzelnen PKI-Inventareintrag anhand der ID zurück.

Authentifizierung: X-API-Key erforderlich

Anfrage

curl -X GET http://localhost:5000/pki/inventory/1 \
-H "X-API-Key: your-api-key"

Antwort 200

Einzelner PKI-Eintrag. Format entspricht GET /pki/inventory.

Antwort 404

{"error": "string"}

GET /pki/inventory/creator/{creator_id}

Gibt alle PKI-Inventareinträge für eine bestimmte Creator-ID zurück.

Authentifizierung: X-API-Key erforderlich

Anfrage

curl -X GET http://localhost:5000/pki/inventory/creator/system \
-H "X-API-Key: your-api-key"

Antwort 200

Array von PKI-Einträgen. Format entspricht GET /pki/inventory.


POST /pki/inventory

Legt einen neuen PKI-Inventareintrag an.

Authentifizierung: X-API-Key erforderlich

Anfrage

curl -X POST http://localhost:5000/pki/inventory \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"pki_type": 2,
"pki_connection": "est.example.com:8443",
"name": "Production EST",
"username": "estuser",
"password": "secret",
"additional_path_segment": "/profile1"
}'

Anfragefelder

FeldTypPflichtBeschreibung
pki_typeinteger (0–3)JaPKI-Typ-ID.
pki_connectionstringJaVerbindungsstring (host:port).
namestringNeinAnzeigename.
usernamestringNeinAuthentifizierungsbenutzername.
passwordstringNeinAuthentifizierungspasswort.
password_encryptedinteger (0/1)NeinGibt an, ob das übermittelte Passwort bereits verschlüsselt ist.
additional_path_segmentstringNeinZusätzliches EST-URL-Pfadsegment (z. B. "/profile1").
est_client_pkcs12_base64string (≥ 160 Zeichen)NeinBase64-kodiertes PKCS#12 für die EST-Client-Zertifikatsauthentifizierung (nur schreiben).
est_client_pkcs12_passwordstring (≤ 1024 Zeichen)NeinPasswort für das EST-Client-PKCS#12 (nur schreiben).
est_cdp_urlsstring[]NeinCRL Distribution Point URLs für das EST-CA-Zertifikat.
tls_cdp_urlsstring[]NeinCRL Distribution Point URLs für das TLS-CA-Zertifikat.
tls_castring[]NeinTLS-CA-Zertifikate zur Verifizierung des PKI-Servers.
tls_crlsstring[]NeinTLS-CRL-Dateien.
creator_idanyNeinErsteller-Bezeichner.

Antwort 200

Angelegter PKI-Eintrag. Format entspricht GET /pki/inventory.


PATCH /pki/inventory/{pki_id}

Aktualisiert einen vorhandenen PKI-Inventareintrag. Nur übermittelte Felder werden aktualisiert.

Authentifizierung: X-API-Key erforderlich

Anfrage

curl -X PATCH http://localhost:5000/pki/inventory/1 \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{"name": "Updated EST", "additional_path_segment": "/new-profile"}'

Anfragefelder

Identisch mit POST /pki/inventory. Alle Felder sind optional.

Antwort 200

Aktualisierter PKI-Eintrag. Format entspricht GET /pki/inventory.

Antwort 404

{"error": "string"}

DELETE /pki/inventory/{pki_id}

Löscht einen PKI-Inventareintrag.

Authentifizierung: X-API-Key erforderlich

Anfrage

curl -X DELETE http://localhost:5000/pki/inventory/1 \
-H "X-API-Key: your-api-key"

Antwort 200

Gelöschter PKI-Eintrag. Format entspricht GET /pki/inventory.

Antwort 404

{"error": "string"}

GET /pki/exec/validate/{pki_id}

Verbindet sich mit dem EST-Server des angegebenen PKI-Eintrags und ruft dessen CA-Zertifikate ab. Speichert das Ergebnis lokal und gibt die CA-Zertifikats-Fingerabdrücke zurück. Der PKI-Eintrag muss vom Typ 2 (EST) sein.

Authentifizierung: X-API-Key erforderlich

Anfrage

curl -X GET http://localhost:5000/pki/exec/validate/1 \
-H "X-API-Key: your-api-key"

Antwort 200

{
"pki_id": 1,
"host": "est.example.com",
"port": 8443,
"ca_fingerprints": [
"A1:B2:C3:D4:E5:F6:78:90:12:34:56:78:90:AB:CD:EF:12:34:56:78"
]
}

Antwortfelder

FeldTypBeschreibung
pki_idintegerID des validierten PKI-Eintrags.
hoststringHostname des EST-Servers.
portintegerPort des EST-Servers.
ca_fingerprintsstring[]SHA-1-Fingerabdrücke der abgerufenen CA-Zertifikate.

Antwort 400

Wird zurückgegeben, wenn der PKI-Eintrag nicht vom Typ EST ist oder keine Verbindung konfiguriert hat.


GET /pki/exec/validate-strict/{pki_id}

Führt eine strenge EST-CA-Zertifikatsvalidierung durch, einschließlich TLS-Kettenverifizierung gegen die konfigurierte tls_ca. Erfordert, dass der PKI-Eintrag TLS-CA-Zertifikate konfiguriert hat.

Authentifizierung: X-API-Key erforderlich

Anfrage

curl -X GET http://localhost:5000/pki/exec/validate-strict/1 \
-H "X-API-Key: your-api-key"

Antwort 200

Format entspricht GET /pki/exec/validate/{pki_id}.

Antwort 400

Wird zurückgegeben, wenn der PKI-Eintrag nicht vom Typ EST ist, keine Verbindung konfiguriert hat oder keine TLS-CA konfiguriert ist.


GET /pki/ca/{pki_id}

Lädt das CA-Zertifikat für den angegebenen PKI-Eintrag herunter. Unterstützt interne (Typ 1) und EST (Typ 2) PKI-Einträge.

Authentifizierung: Nicht erforderlich

Anfrage

# Als PEM herunterladen (Standard)
curl -X GET http://localhost:5000/pki/ca/1

# Als DER herunterladen
curl -X GET "http://localhost:5000/pki/ca/1?format=der"

Antwort 200

Binäre CA-Zertifikatsdatei. Fügen Sie ?format=pem oder ?format=der an, um das Downloadformat festzulegen.

FormatMIME-TypDateiname
PEMapplication/x-pem-fileca.pem / ca-{pki_id}.pem
DERapplication/pkix-certca.der / ca-{pki_id}.der

Antwort 404

Wird zurückgegeben, wenn kein CA-Zertifikat verfügbar ist. Für den EST-Typ zuerst GET /pki/exec/validate/{pki_id} ausführen.


GET /pki/crl/{pki_id}

Lädt die CRL für den angegebenen PKI-Eintrag herunter. IDIAL ermittelt die CRL Distribution Point URL aus dem gespeicherten CA-Zertifikat oder den konfigurierten est_cdp_urls und ruft die CRL live ab.

Authentifizierung: Nicht erforderlich

Anfrage

# Als PEM herunterladen (Standard)
curl -X GET http://localhost:5000/pki/crl/1

# Als DER herunterladen
curl -X GET "http://localhost:5000/pki/crl/1?format=der"

Antwort 200

Binäre CRL-Datei.

FormatMIME-TypDateiname
PEMapplication/x-pem-filecrl-{pki_id}.pem
DERapplication/pkix-crlcrl-{pki_id}.der

Antwort 404

Wird zurückgegeben, wenn keine CRL Distribution Point URLs verfügbar sind.

Antwort 502

Wird zurückgegeben, wenn die CRL von keiner CDP-URL heruntergeladen werden konnte.


GET /pki/crt/{pki_id}

Lädt das für den angegebenen PKI-Eintrag gespeicherte EST-Client-Zertifikat herunter. Dies ist das Zertifikat, das IDIAL bei der Authentifizierung gegenüber dem EST-Server verwendet.

Authentifizierung: X-API-Key erforderlich

Anfrage

curl -X GET http://localhost:5000/pki/crt/1 \
-H "X-API-Key: your-api-key"

Antwort 200

Binäre EST-Client-Zertifikatsdatei.

FormatMIME-TypDateiname
PEMapplication/x-pem-filecrt-{pki_id}.pem
DERapplication/pkix-certcrt-{pki_id}.der

Antwort 404

{"error": "No EST client certificate stored for PKI entry {pki_id}"}

POST /pki/sign-client-csr

Signiert einen Client-CSR mit der internen IDIAL-CA und gibt das ausgestellte Zertifikat zurück.

Authentifizierung: X-API-Key erforderlich

Anfrage

curl -X POST http://localhost:5000/pki/sign-client-csr \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{"csr_pem": "-----BEGIN CERTIFICATE REQUEST-----\n...\n-----END CERTIFICATE REQUEST-----"}'

Anfragefelder

FeldTypPflichtBeschreibung
csr_pemstringJaPEM-kodierter Certificate Signing Request.

Antwort 200

{
"certificate_pem": "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"
}

POST /pki/sign-server-csr

Signiert einen Server-CSR mit der internen IDIAL-CA und gibt das ausgestellte Zertifikat zurück.

Authentifizierung: X-API-Key erforderlich

Anfrage

curl -X POST http://localhost:5000/pki/sign-server-csr \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{"csr_pem": "-----BEGIN CERTIFICATE REQUEST-----\n...\n-----END CERTIFICATE REQUEST-----"}'

Anfragefelder

Identisch mit POST /pki/sign-client-csr.

Antwort 200

Format entspricht POST /pki/sign-client-csr.