Bad characters when exporting SSH private key via CLI
I'm trying to export an SSH private key from 1password to my file system using
op read op://{vault id}/{item id}/private_key > id_25519
I'm using a Windows 11 machine, but working inside a WSL2 environment. op is /mnt/c/Program Files/1Password CLI/op.exe (so Windows CLI running from Linux).
The issue is that the output of 1password has invalid characters that causes an "error in libcrypto" when using the key.
This can be seen with
op read op://{vault id}/{item id}/private_key | vim -
-----BEGIN OPENSSH PRIVATE KEY-----^M
.....^M
.....^M
.....^M
.....^M
...==^M
-----END OPENSSH PRIVATE KEY-----^M
^@^@^@^@^@
~
~
~
I can understand the ^M part (that is "\r") since op is the Windows version (even if I would rather have only "\n" as line endings in this case), but the ^@ at the end are null bytes that I can't explain.
Currently I'm using as a workaround
op read op://{vault id}/{item id}/private_key | tr -dc '[:alnum:]+/=\n -'
Is there a cleaner way to fix this?
For information, op is version 2.21.0 (up to date).
Thanks
1Password Version: 8.10.18 (beta)
Extension Version: n/a
OS Version: Windows
Browser: n/a
