Skip to content

Bug: upgrade to v3.10.* causes "could not create encrypted SSH identity: RSA key size is too small" error #1843

@Ranger-X

Description

@Ranger-X

I've upgraded sops binary from v3.8.1 to v3.10.2. Without changing any encrypted file, my decrypt attempts started failing due to this one error:

$ SOPS_AGE_KEY_FILE="$HOME/.config/sops/age/my-prod-keys.txt" sops -d my-prod-shared-secrets.yaml

Failed to get the data key required to decrypt the SOPS file.

Group 0: FAILED
  age1gzjg67ckfw0gqa8y60dq9uxcmr2hgjwlzpu55wyu9qjuq4h54yyqw3jf7t: FAILED
    - | failed to load age identities: failed to get SSH identity:
      | could not create encrypted SSH identity: RSA key size is too
      | small

Recovery failed because no master key was able to decrypt the file. In
order for SOPS to recover the file, at least one key has to be successful,
but none were.

After some investigating, I realized that the error was due to my very old SSH-RSA key. But files encrypted using age-keys, not SSH.

It seems that this behavior is caused by this PR, which try to parse SSH key even it is NOT NEEDED for encryption/decryption.

As a workaround I suggest something like:

SOPS_AGE_SSH_PRIVATE_KEY_FILE="$HOME/.ssh/my_ed25519" SOPS_AGE_KEY_FILE="$HOME/.config/sops/age/my-prod-keys.txt" sops -d my-prod-shared-secrets.yaml

Or just create new ~/.ssh/id_ed25519 SSH key (ssh-keygen -t ed25519 -C "your_email@example.com") and you can omit SOPS_AGE_SSH_PRIVATE_KEY_FILE in command above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions