~~NOTOC~~
====== 9. Authentifizierung ======
**Szenarien:** 3 \\
**FFI-Funktionen:** ~20 \\
**Status:** ⏳ Geplant
Diese Kategorie umfasst alle Szenarien zur zertifikatsbasierten Authentifizierung. mTLS Client-Auth, Smart Card Login und SSO-Integration.
----
===== Szenarien =====
^ ID ^ Szenario ^ Beschreibung ^ Komplexität ^ Status ^
| [[.:mtls_client_auth|9.1]] | mTLS Client-Auth | Client-Zertifikat für API-Zugriff | ⭐⭐⭐ | ⏳ |
| [[.:smartcard_login|9.2]] | Smart Card Login | PIV/PKCS#11 basierte Anmeldung | ⭐⭐⭐⭐ | ⏳ |
| [[.:sso_integration|9.3]] | SSO-Integration | SAML/OIDC mit Zertifikaten | ⭐⭐⭐⭐ | ⏳ |
----
===== Authentifizierungs-Architektur =====
flowchart TB
subgraph CLIENT["🖥️ Client"]
CERT[Client-Zertifikat]
KEY[Private Key]
end
subgraph AUTH["🔐 Authentifizierung"]
TLS[TLS Handshake]
VERIFY[Zertifikat prüfen]
AUTHZ[Autorisierung]
end
subgraph ACCESS["✅ Zugriff"]
API[API/Service]
USER[User Context]
end
CLIENT --> TLS
TLS --> VERIFY
VERIFY --> AUTHZ
AUTHZ --> ACCESS
style VERIFY fill:#e3f2fd
style AUTHZ fill:#e8f5e9
----
===== Authentifizierungsmethoden =====
^ Methode ^ Beschreibung ^ Einsatz ^
| **mTLS** | Mutual TLS mit Client-Zertifikat | API-Zugriff, Service-to-Service |
| **Smart Card** | PIV/PKCS#11 Karte | Arbeitsplatz-Login |
| **FIDO2/WebAuthn** | Hardware-Token | Web-Anwendungen |
| **Certificate-based SSO** | SAML/OIDC mit X.509 | Enterprise SSO |
----
===== mTLS Flow =====
sequenceDiagram
participant C as Client
participant S as Server
C->>S: ClientHello
S->>C: ServerHello + ServerCert
S->>C: CertificateRequest
C->>S: ClientCert + CertificateVerify
Note over S: Zertifikat validieren
S->>S: Chain + Revocation prüfen
S->>C: Finished
C->>S: API Request (authentifiziert)
----
===== Branchenspezifische Anforderungen =====
^ Branche ^ Methode ^ Besonderheiten ^
| **Healthcare** | Smart Card (eHBA) | gematik-Konnektoranbindung |
| **Energie/SCADA** | mTLS | Geräteidentität, IEC 62351 |
| **Automotive** | Zertifikat (V2X) | Pseudonymzertifikate |
| **Industrie 4.0** | mTLS + OPC UA | Maschinen-Identität |
----
===== Code-Schnellstart =====
==== mTLS Client-Authentifizierung ====
using WvdS.Security.Cryptography.X509Certificates.Extensions.PQ;
// Client-Zertifikat und Schlüssel laden
var clientCert = ctx.LoadCertificate("client.crt.pem");
var clientKey = ctx.LoadPrivateKey("client.key.pem", password);
// HttpClient mit mTLS konfigurieren
var handler = new HttpClientHandler();
handler.ClientCertificates.Add(
ctx.CreateX509Certificate2(clientCert, clientKey)
);
var httpClient = new HttpClient(handler);
// API-Aufruf mit Client-Zertifikat
var response = await httpClient.GetAsync("https://api.example.com/secure/data");
==== Server-seitige Validierung ====
// In ASP.NET Core Startup
services.AddAuthentication(CertificateAuthenticationDefaults.AuthenticationScheme)
.AddCertificate(options =>
{
options.AllowedCertificateTypes = CertificateTypes.All;
options.RevocationMode = X509RevocationMode.Online;
options.Events = new CertificateAuthenticationEvents
{
OnCertificateValidated = context =>
{
// Zusätzliche PQ-Validierung
var cert = context.ClientCertificate;
var isValid = ctx.ValidateCertificate(cert, trustStore);
if (isValid)
{
// Claims aus Zertifikat extrahieren
var claims = new[] {
new Claim(ClaimTypes.Name, cert.Subject),
new Claim("cert_thumbprint", cert.Thumbprint)
};
context.Principal = new ClaimsPrincipal(
new ClaimsIdentity(claims, context.Scheme.Name)
);
context.Success();
}
return Task.CompletedTask;
}
};
});
----
===== Verwandte Kategorien =====
^ Kategorie ^ Beziehung ^
| [[.:zertifikate:start|3. Zertifikate ausstellen]] | Client-Zertifikate erstellen |
| [[.:tls:start|10. TLS/mTLS]] | TLS-Konfiguration |
| [[.:validierung:start|5. Validierung]] | Zertifikat-Validierung |
----
<< [[de:int:pqcrypt:szenarien:signaturen:start|← 8. Digitale Signaturen]] | [[de:int:pqcrypt:szenarien:start|↑ Szenarien]] | [[.:tls:start|10. TLS/mTLS →]] >>
----
//Wolfgang van der Stille @ EMSR DATA d.o.o. - Post-Quantum Cryptography Professional//
{{tag>kategorie authentifizierung mtls smartcard sso}}