====== Classic -> Hybrid Migration ======
**Complexity:** Medium \\
**Duration:** 6-12 months (complete) \\
**Risk:** Low-Medium
Gradual migration from classic PKI (RSA/ECDSA) to hybrid mode (Classic + ML-DSA).
----
===== Overview =====
flowchart TB
subgraph PHASE1["Phase 1: Preparation"]
P1A[Inventory]
P1B[Test environment]
P1C[Tooling update]
end
subgraph PHASE2["Phase 2: Infrastructure"]
P2A[Root CA Hybrid]
P2B[Intermediate CAs]
P2C[CRL/OCSP update]
end
subgraph PHASE3["Phase 3: Rollout"]
P3A[Server certificates]
P3B[Client certificates]
P3C[Code signing]
end
subgraph PHASE4["Phase 4: Validation"]
P4A[Monitoring]
P4B[Audit]
P4C[Documentation]
end
P1A --> P1B --> P1C --> P2A
P2A --> P2B --> P2C --> P3A
P3A --> P3B --> P3C --> P4A
P4A --> P4B --> P4C
style P2A fill:#fff3e0
style P3A fill:#e8f5e9
----
===== Phase 1: Preparation (1-2 months) =====
==== 1.1 Perform Inventory ====
#!/bin/bash
# inventory-certs.sh - Certificate inventory
echo "=== Certificate Inventory $(date) ===" > inventory.csv
echo "Path,Subject,Algorithm,KeySize,Expiry,Days" >> inventory.csv
# Local certificates
for cert in /etc/ssl/certs/*.pem /etc/pki/tls/certs/*.pem; do
[ -f "$cert" ] || continue
subject=$(openssl x509 -in "$cert" -subject -noout 2>/dev/null | sed 's/subject=//')
algo=$(openssl x509 -in "$cert" -text -noout 2>/dev/null | grep "Public Key Algorithm" | awk '{print $4}')
keysize=$(openssl x509 -in "$cert" -text -noout 2>/dev/null | grep "Public-Key:" | grep -oP '\d+')
expiry=$(openssl x509 -in "$cert" -enddate -noout 2>/dev/null | cut -d= -f2)
days=$(( ($(date -d "$expiry" +%s) - $(date +%s)) / 86400 ))
echo "\"$cert\",\"$subject\",\"$algo\",\"$keysize\",\"$expiry\",\"$days\"" >> inventory.csv
done
# Remote endpoints
ENDPOINTS=(
"api.example.com:443"
"web.example.com:443"
"mail.example.com:465"
)
for endpoint in "${ENDPOINTS[@]}"; do
host=${endpoint%:*}
port=${endpoint#*:}
cert_info=$(echo | openssl s_client -connect "$endpoint" -servername "$host" 2>/dev/null | openssl x509 -text -noout 2>/dev/null)
# ... evaluate analogously
done
echo "Inventory completed: inventory.csv"
-> Details: [[.:inventur|Certificate Inventory]]
==== 1.2 Set Up Test Environment ====
# Docker-based test PKI
docker run -d --name test-ca \
-v /test-pki:/pki \
-e OPENSSL_CONF=/pki/openssl.cnf \
alpine/openssl
# OpenSSL 3.6 for PQ
docker exec test-ca openssl version
# OpenSSL 3.6.0 ...
# Test: Create hybrid certificate
docker exec test-ca openssl genpkey -algorithm ML-DSA-65 -out /pki/test-mldsa.key
==== 1.3 Tooling Update ====
| Tool | Min. Version | PQ Support |
|------|--------------|------------|
| OpenSSL | 3.6.0 | ML-DSA, ML-KEM |
| .NET | 9.0+ | Via WvdS.System.Security.Cryptography |
| Java | 21+ | Via BouncyCastle 1.78 |
| curl | 8.5+ | Hybrid TLS |
----
===== Phase 2: Infrastructure (2-3 months) =====
==== 2.1 Migrate Root CA to Hybrid ====
**Root CA migration is the most critical step.** Plan carefully and test extensively.
**Option A: New Hybrid Root CA (recommended)**
// Create new hybrid Root CA
using var ecdsa = ECDsa.Create(ECCurve.NamedCurves.nistP384);
var request = new CertificateRequest(
"CN=My Organization Root CA - Hybrid, O=My Organization",
ecdsa,
HashAlgorithmName.SHA384);
// CA Extensions
request.CertificateExtensions.Add(
new X509BasicConstraintsExtension(true, true, 2, true));
request.CertificateExtensions.Add(
new X509KeyUsageExtension(
X509KeyUsageFlags.KeyCertSign | X509KeyUsageFlags.CrlSign,
true));
// Hybrid self-signed (ECDSA + ML-DSA)
var hybridRoot = request.CreateSelfSigned(
DateTimeOffset.UtcNow,
DateTimeOffset.UtcNow.AddYears(25),
CryptoMode.Hybrid);
// Export
File.WriteAllBytes("hybrid-root-ca.pfx",
hybridRoot.Export(X509ContentType.Pfx, "secure-password"));
**Option B: Cross-Certification (Transition)**
// Old Root CA cross-certifies new hybrid CA
using var oldRoot = new X509Certificate2("old-root.pfx", "password");
using var newHybridRoot = new X509Certificate2("hybrid-root.pfx", "password");
// Create cross certificate
var crossCertRequest = new CertificateRequest(
newHybridRoot.SubjectName,
newHybridRoot.GetECDsaPublicKey()!,
HashAlgorithmName.SHA384);
// Signed by old root
var crossCert = crossCertRequest.Create(
oldRoot,
newHybridRoot.NotBefore,
newHybridRoot.NotAfter,
newHybridRoot.SerialNumberBytes.ToArray());
==== 2.2 Migrate Intermediate CAs ====
# New hybrid intermediate CA
# 1. Generate key
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-384 -out intermediate.key
# 2. Create CSR
openssl req -new -key intermediate.key \
-out intermediate.csr \
-subj "/CN=My Organization Intermediate CA - Hybrid/O=My Organization"
# 3. Sign with hybrid root (with WvdS)
// Sign intermediate with hybrid root
using var hybridRoot = new X509Certificate2("hybrid-root.pfx", "password");
var intermediateCsr = CertificateRequest.LoadSigningRequest(
File.ReadAllBytes("intermediate.csr"),
HashAlgorithmName.SHA384);
// Add CA extensions
intermediateCsr.CertificateExtensions.Add(
new X509BasicConstraintsExtension(true, true, 1, true));
var intermediate = intermediateCsr.Create(
hybridRoot,
DateTimeOffset.UtcNow,
DateTimeOffset.UtcNow.AddYears(10),
Guid.NewGuid().ToByteArray(),
CryptoMode.Hybrid);
==== 2.3 CRL/OCSP Update ====
// Create hybrid-signed CRL
var crlBuilder = new CertificateRevocationListBuilder();
// Transfer old CRL entries
foreach (var entry in existingCrlEntries)
{
crlBuilder.AddEntry(entry.SerialNumber, entry.RevocationDate, entry.Reason);
}
// Sign with hybrid CA
byte[] newCrl = crlBuilder.Build(
hybridIntermediate,
newCrlNumber,
DateTimeOffset.UtcNow.AddDays(7),
HashAlgorithmName.SHA384,
CryptoMode.Hybrid);
----
===== Phase 3: Rollout (3-6 months) =====
==== 3.1 Server Certificates ====
**Priority Matrix:**
| Server Type | Priority | Reason |
|-------------|----------|--------|
| External-facing API | High | Highest risk |
| Internal microservices | Medium | Lateral movement |
| Development | Low | Test environment |
# Batch renewal with hybrid
for server in $(cat servers.txt); do
# Create CSR
ssh "$server" "openssl req -new -key /etc/ssl/private/server.key \
-out /tmp/renew.csr -subj \"/CN=$server\""
# Fetch CSR
scp "$server:/tmp/renew.csr" "./csrs/$server.csr"
# Issue hybrid certificate (via API or script)
./sign-hybrid.sh "./csrs/$server.csr" "./certs/$server.pem"
# Deploy certificate
scp "./certs/$server.pem" "$server:/etc/ssl/certs/server.pem"
ssh "$server" "systemctl reload nginx"
done
==== 3.2 Client Certificates ====
// Issue client certificate with hybrid
var clientCsr = CertificateRequest.LoadSigningRequest(csrBytes, HashAlgorithmName.SHA384);
clientCsr.CertificateExtensions.Add(
new X509EnhancedKeyUsageExtension(
new OidCollection { new Oid("1.3.6.1.5.5.7.3.2") }, // Client Auth
false));
var clientCert = clientCsr.Create(
intermediate,
DateTimeOffset.UtcNow,
DateTimeOffset.UtcNow.AddYears(1),
Guid.NewGuid().ToByteArray(),
CryptoMode.Hybrid);
==== 3.3 Code Signing Certificates ====
-> See [[..:automatisierung:cicd-code-signing|CI/CD Code Signing]] for pipeline integration
----
===== Phase 4: Validation (1-2 months) =====
==== 4.1 Enable Monitoring ====
# Prometheus alert for hybrid status
- alert: NonHybridCertificateInProduction
expr: x509_cert_algorithm{env="production"} !~ ".*ML-DSA.*|.*Hybrid.*"
for: 24h
labels:
severity: warning
annotations:
summary: "Non-hybrid certificate in production: {{ $labels.filepath }}"
==== 4.2 Checklist ====
| # | Checkpoint | Status |
|---|------------|--------|
| 1 | All CA certificates on hybrid | |
| 2 | All server certificates renewed | |
| 3 | CRL/OCSP signed with hybrid | |
| 4 | Trust stores updated | |
| 5 | Monitoring shows no classic-only | |
| 6 | Rollback tested | |
| 7 | Documentation updated | |
----
===== Rollback Plan =====
**On problems:**
# 1. Switch back to classic CA
export CA_CERT=/etc/pki/CA/classic-intermediate.pem
export CA_KEY=/etc/pki/CA/classic-intermediate.key
# 2. Reissue certificates with classic CA
./issue-classic.sh
# 3. Revoke hybrid CA certificates (if needed)
./revoke-hybrid-certs.sh
-> Details: [[.:rollback-strategie|Rollback Strategy]]
----
===== Related Documentation =====
* [[.:parallel-betrieb|Parallel Operation]] - Alternative strategy
* [[.:inventur|Inventory]] - Detailed inventory
* [[en:int:pqcrypt:konzepte:start|Crypto Modes]] - Hybrid explained
----
<< [[.:start|<- Migration]] | [[.:parallel-betrieb|-> Parallel Operation]] >>
----
//Wolfgang van der Stille @ EMSR DATA d.o.o. - Post-Quantum Cryptography Professional//
{{tag>migration hybrid classic upgrade operator}}