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

Current Status

Migration Strategy

Phase 1: Assessment (Now - Q2 2025)

  1. Inventory RSA Usage
    • Identify all systems using RSA
    • Document key sizes and use cases
    • Prioritize critical systems
  2. Risk Analysis
    • Assess data sensitivity
    • Determine retention periods
    • Evaluate quantum threat impact

Phase 2: Hybrid Implementation (Q2 2025 - Q4 2027)

  1. 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 };
    }
    
  2. Parallel Operations
    • Run RSA and PQC in parallel
    • Verify compatibility
    • Monitor performance

Phase 3: PQC Primary (Q1 2028 - Q4 2029)

  1. Switch to PQC-First
    • Make PQC the primary algorithm
    • Keep RSA as fallback only
    • Begin deprecation notices
  2. Update Protocols
    • Modify TLS configurations
    • Update certificate chains
    • Implement PQC key management

Phase 4: RSA Sunset (2030)

  1. 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

Don’ts

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

3. Load Testing

Common Pitfalls and Solutions

Pitfall 1: Key Size Shock

Problem: PQC keys are much larger than RSA keys Solution:

Pitfall 2: Performance Assumptions

Problem: Assuming RSA performance characteristics Solution:

Pitfall 3: Protocol Compatibility

Problem: Existing protocols may not support PQC Solution:

Compliance and Standards

Regulatory Requirements

Certification Paths

  1. Maintain RSA certifications during transition
  2. Obtain PQC certifications in parallel
  3. Phase out RSA certifications by 2030

Support and Resources

Documentation

Tools

Timeline

Conclusion

The addition of RSA-2048 to MetaMUI Crypto Primitives is explicitly for transitional use. Organizations should:

  1. Start migration immediately - Don’t wait for quantum computers
  2. Use hybrid cryptography - Ensure compatibility during transition
  3. Plan for PQC characteristics - Larger keys, different performance
  4. Set hard deadline - Complete migration by 2030

Remember: RSA-2048 is a bridge, not a destination. The future is post-quantum.