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-ID | Name | Beschreibung |
|---|---|---|
0 | None | Kein PKI konfiguriert. |
1 | Internal | IDIAL verwendet seine eigene interne CA. |
2 | EST | Enrollment over Secure Transport (RFC 7030). |
3 | CMP | Certificate 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
| Feld | Typ | Beschreibung |
|---|---|---|
pki_id | integer | Eindeutiger PKI-Eintrags-Bezeichner. |
name | string | null | Anzeigename des PKI-Eintrags. |
pki_type_id | integer | PKI-Typ (0=none, 1=internal, 2=EST, 3=CMP). |
pki_connection | string | Verbindungsstring (host:port). |
username | string | null | Benutzername für die PKI-Authentifizierung. |
password_encrypted | integer | Gibt an, ob das Passwort verschlüsselt (1) oder unverschlüsselt (0) gespeichert ist. |
additional_path_segment | string | null | Zusätzliches URL-Pfadsegment für EST-Endpoints. |
est_client_certificate_sha1 | string | null | SHA-1-Fingerabdruck des EST-Client-Zertifikats. |
est_cdp_urls | string[] | CRL Distribution Point URLs für das EST-CA-Zertifikat. |
tls_cdp_urls | string[] | CRL Distribution Point URLs für das TLS-CA-Zertifikat. |
tls_ca | string[] | TLS-CA-Zertifikat(e) zur Verifizierung des PKI-Servers. |
tls_crls_info | object[] | CRL-Metadaten für jede konfigurierte TLS-CRL. |
creator_id | string | null | Bezeichner 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
| Feld | Typ | Pflicht | Beschreibung |
|---|---|---|---|
pki_type | integer (0–3) | Ja | PKI-Typ-ID. |
pki_connection | string | Ja | Verbindungsstring (host:port). |
name | string | Nein | Anzeigename. |
username | string | Nein | Authentifizierungsbenutzername. |
password | string | Nein | Authentifizierungspasswort. |
password_encrypted | integer (0/1) | Nein | Gibt an, ob das übermittelte Passwort bereits verschlüsselt ist. |
additional_path_segment | string | Nein | Zusätzliches EST-URL-Pfadsegment (z. B. "/profile1"). |
est_client_pkcs12_base64 | string (≥ 160 Zeichen) | Nein | Base64-kodiertes PKCS#12 für die EST-Client-Zertifikatsauthentifizierung (nur schreiben). |
est_client_pkcs12_password | string (≤ 1024 Zeichen) | Nein | Passwort für das EST-Client-PKCS#12 (nur schreiben). |
est_cdp_urls | string[] | Nein | CRL Distribution Point URLs für das EST-CA-Zertifikat. |
tls_cdp_urls | string[] | Nein | CRL Distribution Point URLs für das TLS-CA-Zertifikat. |
tls_ca | string[] | Nein | TLS-CA-Zertifikate zur Verifizierung des PKI-Servers. |
tls_crls | string[] | Nein | TLS-CRL-Dateien. |
creator_id | any | Nein | Ersteller-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
| Feld | Typ | Beschreibung |
|---|---|---|
pki_id | integer | ID des validierten PKI-Eintrags. |
host | string | Hostname des EST-Servers. |
port | integer | Port des EST-Servers. |
ca_fingerprints | string[] | 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.
| Format | MIME-Typ | Dateiname |
|---|---|---|
| PEM | application/x-pem-file | ca.pem / ca-{pki_id}.pem |
| DER | application/pkix-cert | ca.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.
| Format | MIME-Typ | Dateiname |
|---|---|---|
| PEM | application/x-pem-file | crl-{pki_id}.pem |
| DER | application/pkix-crl | crl-{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.
| Format | MIME-Typ | Dateiname |
|---|---|---|
| PEM | application/x-pem-file | crt-{pki_id}.pem |
| DER | application/pkix-cert | crt-{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
| Feld | Typ | Pflicht | Beschreibung |
|---|---|---|---|
csr_pem | string | Ja | PEM-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.