Skip to content

ANKASecure Streaming Re-encryption Micro-Benchmark

Overview

This document describes the methodology and scope of the SecureCore Streaming Re-encryption Micro-Benchmark, a performance test suite designed to evaluate the cryptographic efficiency of the AnkaSecure platform for large file re-encryption (key rotation) using streaming APIs.

The benchmark systematically measures streaming re-encryption (decrypt-then-encrypt) performance for symmetric and asymmetric algorithms—both classical and post-quantum (PQC)—across very large payload sizes. This operation is critical for key rotation scenarios where encrypted files must be migrated to new keys without loading entire files into memory.

Scope of the heap deltas

Every memory figure on this page is a heap measurement and says nothing about disk. The disk-free property — no uploaded part written to a temporary file — is measured separately (512 MiB through -Xmx256m, zero temporary files observed in flight); see Memory & Performance*.


Objectives

The goals of this benchmark are to:

  • Validate the memory efficiency of SecureCore's streaming re-encryption operations for large files
  • Measure performance of atomic key rotation at scale
  • Demonstrate constant memory footprint during key rotation
  • Provide evidence of enterprise-grade key lifecycle management capabilities

Scope

  • Operations:

    • Streaming decrypt with old key (from multipart input)
    • Streaming encrypt with new key (to multipart output)
    • Zero-knowledge operation: Plaintext never exposed to caller
  • Algorithms Tested: All profiles that implement both encrypt and decrypt, including:

    • Symmetric AEAD modes (classical): AES-GCM-{128,192,256}, AES-CCM-{128,192,256}, ChaCha20-Poly1305, Camellia-GCM-{128,192,256}, SEED-GCM-128, SM4-{GCM,CCM}-128, ARIA-{GCM,CCM}-{128,192,256}
    • Asymmetric – Classical: RSA-{2048,3072,4096,6144,8192}, EC (P-256, P-384, P-521), OKP (X25519, X448)
    • Asymmetric – Post-Quantum KEMs: ML-KEM-{512,768,1024}, FRODO-{640,976,1344}, HQC-{128,192,256}, BIKE-{128,192,256}, SABER, NTRU, NTRUPRIME, Classic McEliece
  • Payload Sizes: Very large payloads optimized for streaming:

    • 5 MiB (5,242,880 bytes)
    • 10 MiB (10,485,760 bytes)
    • 50 MiB (52,428,800 bytes)
    • 100 MiB (104,857,600 bytes)
  • Iteration Strategy:

    • Warm-up iterations: 5 (configurable via sc.perf.warmup)
    • Measurement iterations: 10 (configurable via sc.perf.measurements)
  • Expected Measurements: 200 (50 algorithms × 4 large payload sizes)


Algorithm Taxonomy

Symmetric (classical AEAD encryption modes):

  • AES-GCM-128/192/256
  • AES-CCM-128/192/256
  • ARIA-GCM-128/192/256
  • ARIA-CCM-128/192/256
  • ChaCha20-Poly1305
  • Camellia-GCM-128/192/256
  • SEED-GCM-128
  • SM4-GCM-128, SM4-CCM-128

Asymmetric – Classical:

  • RSA-2048, RSA-3072, RSA-4096, RSA-6144, RSA-8192
  • EC: P-256, P-384, P-521
  • OKP: X25519, X448

Asymmetric – Post-Quantum KEMs:

  • ML-KEM-512, ML-KEM-768, ML-KEM-1024
  • FRODO-976, FRODO-1344
  • HQC-128, HQC-192, HQC-256
  • BIKE-128, BIKE-192, BIKE-256
  • SABER: LIGHTSABER-128, SABER-192, FIRESABER-256
  • NTRU-701, NTRU-1373
  • NTRUPRIME-761, NTRUPRIME-857
  • Classic McEliece variants

How It Works

🔁 Iteration Process

  1. Key Generation: Two keys (oldKid, newKid) generated for the same algorithm
  2. Warm-up Loop: Multiple streaming re-encryption operations stabilize JIT
  3. Measurement Loop: Metrics collected per iteration:
    • Wall-clock time for re-encryption (milliseconds)
    • Thread-level CPU time for re-encryption (milliseconds)
    • Heap memory delta during re-encryption (KiB)
  4. Validation: Decrypted result verified against original input

🌊 Streaming Re-encryption Process

Re-encryption (atomic streaming decrypt + encrypt):

  1. Create encrypted stream with oldKid (streaming encryption)
  2. Parse JWE header and ciphertext
  3. Re-encrypt operation (atomic, zero-knowledge):
    • Decrypt stream with oldKid (chunked processing)
    • Encrypt stream with newKid (chunked processing)
    • Plaintext never buffered or exposed
  4. Return new JWE multipart output

🧠 Memory Efficiency

Constant memory footprint: Heap delta remains bounded regardless of payload size:

  • Typical heap delta: <100 MiB for most algorithms
  • No full-payload buffering (chunked processing)
  • Suitable for arbitrarily large files (GB-scale)

Metrics Reported

Metric Description Units
KTY Key type (oct, EC, OKP, RSA, etc.) String
ALG Algorithm name String
BYTES Payload size in bytes Integer
REENC Median wall-clock time for re-encryption Milliseconds
CPU-R Median thread CPU time for re-encryption Milliseconds
MEM-R Median heap delta for re-encryption Kibibytes

Execution Notes

  • Streaming APIs process data in chunks (constant memory footprint)
  • Re-encryption is atomic and zero-knowledge (plaintext never exposed)
  • Test is implemented using JUnit 5 with @ParameterizedTest
  • All runs are sequential (@Execution(SAME_THREAD))
  • Thread CPU-time measurement is required; test skipped if unavailable
  • Expected CSV file: benchmark_stream_reenc_YYYYMMDD_HHMMSS.csv

Benchmark Results

Execution Time Notice

This benchmark has not been executed yet due to its extensive runtime requirements.

Estimated execution time: ~50-80 hours with default settings (5 warm-up + 10 measurement iterations)

Reason for delay:

  • 50 algorithms × 4 large payload sizes (5-100 MiB) × 15 iterations = 3,000 re-encryption operations
  • Each operation processes up to 100 MiB of data twice (decrypt + encrypt)
  • Total data processed: ~600 GB (3,000 operations × ~200 MiB average total I/O)
  • Sequential execution required for accurate measurements

Status: Pending execution in dedicated benchmark run

Alternative: For immediate re-encryption performance data, see:


Expected Performance Characteristics

Based on extrapolation from compact re-encryption and streaming signature benchmarks:

🎯 Projected Performance

Small streaming payloads (5-10 MiB):

  • Symmetric AEAD (AES-GCM, ChaCha20): 100-400ms re-encryption
  • Classical asymmetric (X25519, P-256): 200-600ms re-encryption
  • PQC KEMs (ML-KEM-768): 300-800ms re-encryption

Large streaming payloads (50-100 MiB):

  • Symmetric AEAD: 1000-4000ms re-encryption
  • Classical asymmetric: 2000-6000ms re-encryption
  • PQC KEMs: 3000-8000ms re-encryption

📊 Memory Efficiency

Expected heap deltas (constant regardless of payload size):

  • Symmetric algorithms: <20 MiB heap delta
  • Classical asymmetric: <60 MiB heap delta
  • PQC algorithms: <120 MiB heap delta

Critical advantage: Re-encryption time scales linearly with payload size, but memory footprint remains constant.


Use Cases

This benchmark validates performance for critical enterprise scenarios:

🔐 Key Rotation

  • Migrating encrypted data archives to new keys
  • Compliance-driven key rotation (NIST SP 800-57 key lifecycle)
  • Post-breach key rotation without data exposure

📦 Large File Processing

  • Encrypted backup rotation
  • Cloud storage key migration
  • Encrypted database export re-keying

🏢 Enterprise Scale

  • Batch processing of encrypted files (TB-scale datasets)
  • Zero-downtime key rotation for active storage
  • Compliance auditing (plaintext never exposed during rotation)

Test Execution

Running the Benchmark

Default settings (⚠️ ~50-80 hours runtime):

cd ankasecure-core-api
mvn test -Dtest=SCPerformanceEnhancedStreamingReencryptionTest

Reduced iterations for validation (~15-25 hours runtime):

mvn test -Dtest=SCPerformanceEnhancedStreamingReencryptionTest \
  -Dsc.perf.warmup=2 \
  -Dsc.perf.measurements=3

Single algorithm test (for spot-checking):

mvn test -Dtest=SCPerformanceEnhancedStreamingReencryptionTest \
  -Dsc.perf.warmup=1 \
  -Dsc.perf.measurements=2


Implementation Details

Test class: SCPerformanceEnhancedStreamingReencryptionTest.java

Location: ankasecure-core-api/src/test/java/co/ankatech/ankasecure/core/controller/

Key APIs used:

  • SecureCoreController.encryptStreamJwe() - Streaming JWE encryption
  • SecureCoreController.decryptDetachedJweStream() - Streaming JWE decryption
  • SecureCoreController.reencryptJwe() - Non-streaming re-encryption (may buffer internally)

Changelog

Date Change Author
2026-01-18 Created streaming re-encryption performance benchmark documentation ANKASecure Performance Team
2026-01-18 Benchmark execution pending due to runtime constraints (~50-80 hours) ANKASecure Performance Team
* restricted content — see higher-tier documentation