Mic92 / ssh-to-age

Convert SSH Ed25519 keys to age keys. This is useful for usage in sops-nix and sops
MIT License
98 stars 5 forks source link

Error Reading id_ed25519 Private Key #50

Closed andar1an closed 9 months ago

andar1an commented 9 months ago

running nix run nixpkgs#ssh-to-age -- -private-key -i ~/.ssh/id_ed25519 -o ~/.config/sops/key.txt

when key begins with:

-----BEGIN PRIVATE KEY----- 

will result in error: got ed25519.PrivateKey key type but: only ed25519 keys are supported

andar1an commented 9 months ago

Was my mistake, bad 1password command substitution.

however, this will fail: nix run nixpkgs#ssh-to-age -- -private-key -i $(op read "op://Vault/Secret/private key?ssh-format=openssh") -o ~/.config/sops/key.txt

Can get around with:

# read ssh key from 1password into file
echo "$(op read "op://Vault/Secret/private key?ssh-format=openssh")" > ~/.ssh/id_ed25519

# convert ssh key to age
nix run nixpkgs#ssh-to-age -- -private-key -i ~/.ssh/id_ed25519 -o ~/.config/sops/key.txt