← Back to Blog

Testing Post-Quantum Cryptography with Docker

Published: July 12, 2025
Tags: docker, quantum-computing, tls

Introduction

With the rise of quantum computing, current TLS implementations using Elliptic Curve Cryptography (ECC) face future risks. Post-Quantum Cryptography (PQC) offers resistance against quantum attacks, but introduces operational overhead during deployment. AWS has published a migration plan, and this article explores startup, connectivity, and latency aspects of PQC implementation.

This article references and utilizes the open-source projects oqs-provider and oqs-demos available on GitHub.

System Specifications

MacBook Air M2 arm64

Background Knowledge

Where PQC is Used in TLS

Post-Quantum Cryptography integration in TLS handshake:

TLS Handshake with PQC:

Client → Server: ClientHello ("Can you use PQC algorithms?")
Client ← Server: ServerHello ("Yes, let's use Kyber for key exchange")
Client → Server: PQC Key Exchange (quantum-resistant algorithms)
Client ← Server: Certificate (signed with PQC digital signature)
Client ↔ Server: Secure communication established with quantum-resistant keys

Key PQC Algorithm Categories

Docker Setup

Environment Preparation

# Clone the OQS demo repository
git clone https://github.com/open-quantum-safe/oqs-demos.git
cd oqs-demos

# Build PQC-enabled OpenSSL container
docker build -t oqs-openssl -f openssl/Dockerfile .

Basic PQC Server Configuration

# Start PQC-enabled HTTPS server
docker run -it --rm --name oqs-server \
  -p 4433:4433 \
  oqs-openssl \
  openssl s_server \
  -cert /opt/oqs-provider/certs/server.crt \
  -key /opt/oqs-provider/certs/server.key \
  -port 4433 \
  -groups kyber512 \
  -verify_return_error

Performance Testing

Connection Latency Comparison

# Traditional ECDSA connection test
time openssl s_client -connect server:443 -cipher ECDHE-ECDSA-AES256-GCM-SHA384

# PQC Kyber connection test  
time openssl s_client -connect server:4433 -groups kyber512

Handshake Size Analysis

Comparing message sizes in TLS handshake:

Algorithm Public Key Size Signature Size Handshake Overhead
ECDSA P-256 64 bytes 72 bytes Baseline
Kyber512 800 bytes 768 bytes +10-12x
Dilithium2 1,312 bytes 2,420 bytes +15-20x

Practical Testing Results

Startup Performance

Connection Establishment

Runtime Characteristics

# Monitor resource usage during PQC operations
docker stats oqs-server

# Measure handshake performance
curl -w "@curl-format.txt" -o /dev/null -s "https://localhost:4433/"

Migration Considerations

Immediate Challenges

Performance Optimization Strategies

Real-World Deployment

Docker Compose Example

version: '3.8'
services:
  pqc-web-server:
    build: 
      context: .
      dockerfile: Dockerfile.pqc
    ports:
      - "443:4433"
    environment:
      - PQC_ALGORITHM=kyber512
      - SIGNATURE_ALGORITHM=dilithium2
    volumes:
      - ./certs:/opt/certs
    command: >
      openssl s_server 
      -cert /opt/certs/server-pqc.crt 
      -key /opt/certs/server-pqc.key 
      -port 4433 
      -groups kyber512
      -sigalgs dilithium2

Conclusion

Testing Post-Quantum Cryptography with Docker reveals both the promise and challenges of quantum-resistant security. While PQC algorithms provide necessary protection against future quantum threats, they introduce significant operational overhead in terms of bandwidth, latency, and computational requirements.

Key findings from this exploration:

Organizations should begin testing and planning for PQC migration now, as quantum computing capabilities continue to advance. The transition will require careful balance between security requirements and performance constraints.