Windows: SSH keys fail with 'error in libcrypto' due to line endings

Resolved 💬 3 comments Opened Dec 11, 2025 by cmwalton Closed Feb 11, 2026

Problem

On Windows, SSH private keys with CRLF line endings fail to load with the error:

Error loading key "path/to/key": error in libcrypto

This prevents users from using ssh-agent and SSH slash commands that require passphrase-protected keys.

Root Cause

Windows OpenSSH requires SSH private keys to have Unix line endings (LF), but keys created or edited on Windows often have Windows line endings (CRLF).

Solution

The fix is to convert the key file to Unix line endings:

dos2unix "C:\Users\username\.ssh\keyname"

After fixing line endings, the key can be added to ssh-agent:

ssh-add "C:\Users\username\.ssh\keyname"

Suggestion

Claude Code could help Windows users by:

  1. Detecting this specific error message when SSH operations fail
  2. Suggesting the dos2unix fix in the error output
  3. Possibly offering to automatically fix line endings when this error occurs
  4. Adding this to documentation for Windows users setting up SSH keys

This would significantly improve the Windows SSH experience for users with passphrase-protected keys.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗