DevFlow logoDevFlow
ERR_OSSL_EVP_BAD_DECRYPTVerified Production Fix

error:1e08010c:decoder routines::unsupported / bad decrypt

Resolve OpenSSL 3.0 bad decrypt and unsupported cipher errors in Node.js 18, 20, and 22. Learn how to migrate legacy MD5/DES keys or enable legacy crypto providers.

Root Cause Mechanical Summary

OpenSSL 3.0 deprecated legacy cryptographic algorithms like RC4, DES, and MD5-based key derivation by default. When an application attempts to parse a legacy encrypted key without modern AES-256-GCM encryption, it fails with bad decrypt.

Node.js 17+ compiles against OpenSSL 3.0. Keys generated with `openssl enc -des3` or PKCS#12 keystores using RC2-40-CBC throw decoder unsupported unless the legacy provider is explicitly registered.

Vulnerable / Problematic Syntax
Before
# Legacy command failing in Node.js 18+
node server.js
# Error: error:0308010C:digital envelope routines::unsupported
Production-Safe Remediation
After
# Re-encrypt private key with modern PBKDF2 + AES-256
openssl rsa -in legacy.key -out modern.key -aes256

# Temporary emergency escape hatch (not recommended for production):
NODE_OPTIONS="--openssl-legacy-provider" node server.js

Resolution Note: Re-encrypt private keys using AES-256 or set --openssl-legacy-provider as an immediate hotfix.

Step-by-Step Triage Checklist

  • Inspect your private key format: `openssl rsa -in key.pem -check`.

  • Check Node.js version (`node -v`) — versions 18+ use OpenSSL 3.0.

  • Convert old PKCS#12 bundles using modern encryption flags.

Modern AES-256 Key Encryption Validator

scripts/check-ssl-keys.sh

Prevent recurrence by enforcing this verification check in staging or pre-commit hooks:

#!/usr/bin/env bash
for key in certs/*.key; do
  if grep -q "DEK-Info: DES" "$key"; then
    echo "CRITICAL: $key uses deprecated DES encryption. Re-encrypt with AES-256."
    exit 1
  fi
done

Quick CLI Fix / Diagnosis

openssl pkcs8 -topk8 -v2 aes-256-cbc -in old-key.pem -out modern-key.pem

Frequently Asked Questions

Is `--openssl-legacy-provider` safe in production?
It should only be used as a temporary workaround. Deprecated ciphers lack resistance to modern collision and brute-force attacks.
Was this guide / tool helpful to you?