RSA to Post-Quantum Cryptography Migration Guide
Executive Summary
RSA-2048 has been added to MetaMUI Crypto Primitives as a transitional algorithm to facilitate migration from classical to post-quantum cryptography. This guide provides a comprehensive migration strategy for organizations currently using RSA.
⚠️ WARNING: RSA is vulnerable to quantum attacks. All RSA implementations should be migrated to post-quantum alternatives by 2030.
Why Migrate from RSA?
Quantum Threat Timeline
- 2025-2030: Early quantum computers pose theoretical threat
- 2030-2035: Practical quantum attacks on RSA-2048 become feasible
- 2035+: RSA considered completely broken
Current Status
- RSA-2048 provides ~112 bits of classical security
- Vulnerable to Shor’s algorithm on quantum computers
- NIST recommends migration to PQC algorithms by 2030
Migration Strategy
Phase 1: Assessment (Now - Q2 2025)
- Inventory RSA Usage
- Identify all systems using RSA
- Document key sizes and use cases
- Prioritize critical systems
- Risk Analysis
- Assess data sensitivity
- Determine retention periods
- Evaluate quantum threat impact
Phase 2: Hybrid Implementation (Q2 2025 - Q4 2027)
- Deploy Hybrid Cryptography
// Hybrid encryption example import { RSA2048 } from '@metamui/rsa2048'; import { MLKEM768 } from '@metamui/ml-kem'; async function hybridEncrypt(data: Uint8Array) { // Use both RSA and ML-KEM const rsaKey = await RSA2048.generateKey(); const mlkemKey = await MLKEM768.generateKey(); // Encrypt with both algorithms const rsaCiphertext = rsaKey.publicKey.encrypt(data); const mlkemCiphertext = mlkemKey.publicKey.encrypt(data); return { rsaCiphertext, mlkemCiphertext }; } - Parallel Operations
- Run RSA and PQC in parallel
- Verify compatibility
- Monitor performance
Phase 3: PQC Primary (Q1 2028 - Q4 2029)
- Switch to PQC-First
- Make PQC the primary algorithm
- Keep RSA as fallback only
- Begin deprecation notices
- Update Protocols
- Modify TLS configurations
- Update certificate chains
- Implement PQC key management
Phase 4: RSA Sunset (2030)
- Complete Migration
- Disable RSA in production
- Archive RSA keys securely
- Full PQC deployment
Algorithm Mapping
RSA Use Cases and PQC Replacements
| RSA Use Case | Recommended PQC | Alternative PQC | Notes |
|---|---|---|---|
| Key Exchange | ML-KEM-768 | Kyber-768, NTRU | NIST FIPS 203 standard |
| Digital Signatures | ML-DSA-65 | Dilithium3, Falcon-512 | NIST FIPS 204 standard |
| Long-term Signatures | SLH-DSA-SHA2-128f | XMSS, LMS | Stateless option |
| Code Signing | Falcon-512 | ML-DSA-44 | Smaller signatures |
| Certificate Auth | ML-DSA-87 | SLH-DSA-SHA2-192f | High security |
Implementation Examples
Go Implementation
package main
import (
"github.com/SovereignWallet-Network/metamui-crypto-go/rsa2048"
"github.com/SovereignWallet-Network/metamui-crypto-go/mlkem"
)
// Hybrid key encapsulation
func HybridKEM(rsaPub *rsa2048.PublicKey, mlkemPub *mlkem.PublicKey) ([]byte, error) {
// Generate shared secret with ML-KEM
mlkemCiphertext, mlkemSecret, err := mlkemPub.Encapsulate()
if err != nil {
return nil, err
}
// Encrypt ML-KEM secret with RSA for compatibility
rsaCiphertext, err := rsaPub.Encrypt(mlkemSecret)
if err != nil {
return nil, err
}
// Combine both ciphertexts
return append(rsaCiphertext, mlkemCiphertext...), nil
}
Python Implementation
from metamui_crypto.rsa2048 import generate_key as rsa_generate
from metamui_crypto.ml_kem import ML_KEM_768
def hybrid_operation():
# Generate keys
rsa_key = rsa_generate()
mlkem_key = ML_KEM_768.generate_keypair()
# Hybrid signing
message = b"Critical message"
rsa_signature = rsa_key.sign(message)
mlkem_signature = mlkem_key.sign(message)
return {
'rsa_sig': rsa_signature,
'pqc_sig': mlkem_signature
}
Rust Implementation
use metamui_rsa2048::{PrivateKey as RsaKey};
use metamui_mlkem::{MLKEM768};
pub struct HybridCrypto {
rsa_key: RsaKey,
mlkem_key: MLKEM768,
}
impl HybridCrypto {
pub fn new() -> Result<Self, Error> {
Ok(Self {
rsa_key: RsaKey::generate()?,
mlkem_key: MLKEM768::generate()?,
})
}
pub fn encrypt(&self, data: &[u8]) -> Result<Vec<u8>, Error> {
// Encrypt with both algorithms
let rsa_ct = self.rsa_key.public_key().encrypt(data)?;
let mlkem_ct = self.mlkem_key.encapsulate()?;
Ok([rsa_ct, mlkem_ct.0].concat())
}
}
Performance Comparison
| Operation | RSA-2048 | ML-KEM-768 | Falcon-512 | Notes |
|---|---|---|---|---|
| Key Generation | ~500ms | ~1ms | ~5ms | PQC much faster |
| Encryption/Encapsulation | ~0.2ms | ~0.05ms | N/A | PQC faster |
| Decryption/Decapsulation | ~8ms | ~0.05ms | N/A | PQC much faster |
| Signing | ~8ms | N/A | ~0.5ms | Falcon faster |
| Verification | ~0.2ms | N/A | ~0.1ms | Similar speed |
| Public Key Size | 256 bytes | 1184 bytes | 897 bytes | RSA smaller |
| Ciphertext Size | 256 bytes | 1088 bytes | N/A | RSA smaller |
| Signature Size | 256 bytes | N/A | 666 bytes | RSA smaller |
Best Practices
Do’s
- ✅ Start migration planning immediately
- ✅ Use hybrid cryptography during transition
- ✅ Test PQC algorithms in staging first
- ✅ Monitor NIST standards updates
- ✅ Implement crypto-agility
- ✅ Document all RSA dependencies
- ✅ Plan for larger key/signature sizes
Don’ts
- ❌ Deploy RSA in new systems
- ❌ Extend RSA usage beyond 2030
- ❌ Ignore quantum threat timeline
- ❌ Mix RSA and PQC in same data stream
- ❌ Skip compatibility testing
- ❌ Forget about legacy system support
Testing Strategy
1. Unit Testing
describe('Hybrid Crypto Migration', () => {
it('should support RSA fallback', async () => {
const data = new Uint8Array(32);
const rsaKey = await generateRSAKey();
const encrypted = rsaKey.encrypt(data);
expect(encrypted).toHaveLength(256);
});
it('should prefer PQC when available', async () => {
const hybrid = new HybridCrypto();
const result = await hybrid.encrypt(data);
expect(result.algorithm).toBe('ML-KEM-768');
});
});
2. Integration Testing
- Test hybrid mode with existing infrastructure
- Verify backward compatibility
- Measure performance impact
- Test failure scenarios
3. Load Testing
- Compare throughput RSA vs PQC
- Test with production-like loads
- Monitor resource usage
- Identify bottlenecks
Common Pitfalls and Solutions
Pitfall 1: Key Size Shock
Problem: PQC keys are much larger than RSA keys Solution:
- Update database schemas early
- Implement key compression where possible
- Use hybrid mode to transition gradually
Pitfall 2: Performance Assumptions
Problem: Assuming RSA performance characteristics Solution:
- Benchmark actual PQC performance
- Optimize critical paths
- Consider algorithm selection per use case
Pitfall 3: Protocol Compatibility
Problem: Existing protocols may not support PQC Solution:
- Use hybrid mode for compatibility
- Implement protocol negotiation
- Plan phased protocol updates
Compliance and Standards
Regulatory Requirements
- NIST: Migrate to PQC by 2030
- NSA: CNSA 2.0 requires PQC by 2030
- EU: GDPR compliance for long-term data
- Industry: PCI-DSS planning PQC requirements
Certification Paths
- Maintain RSA certifications during transition
- Obtain PQC certifications in parallel
- Phase out RSA certifications by 2030
Support and Resources
Documentation
Tools
- Migration assessment scripts
- Hybrid crypto libraries
- Performance benchmarking tools
- Compatibility testing suites
Timeline
- 2025 Q1: RSA-2048 support available
- 2025 Q2: Hybrid mode recommended
- 2028 Q1: Begin RSA deprecation
- 2030 Q1: RSA support ends
Conclusion
The addition of RSA-2048 to MetaMUI Crypto Primitives is explicitly for transitional use. Organizations should:
- Start migration immediately - Don’t wait for quantum computers
- Use hybrid cryptography - Ensure compatibility during transition
- Plan for PQC characteristics - Larger keys, different performance
- Set hard deadline - Complete migration by 2030
Remember: RSA-2048 is a bridge, not a destination. The future is post-quantum.