Encrypted private keys #252
Replies: 9 comments 3 replies
-
FWIW, I gen my keypairs using ssh-keygen but agreed that enhancing the age-keygen w/ encrypted private keys would be nice as long as not mandated. |
Beta Was this translation helpful? Give feedback.
-
@cyb3rz3us - that's a nice approach, so you get encrypted private keys, however, can you use the ssh-gen private key with age directly? (if so I guess ok once it's an ed25519 key. |
Beta Was this translation helpful? Give feedback.
-
By all means. However, when encrypting using the 'age' keys (i.e. recipients), you will need to include the public key data on the command line. As you can imagine, this can become quite cumbersome especially for keys > 1024. The spec and 'age' help screen both discuss specifying the pub key as a file but it is apparently not yet working; there is a ticket open to get it working. That said, this does work on the decrypt side --- the private key file can be specified using the '-i' switch and if the key is PW protected, then you will be prompted for the password.
Not sure what you mean here? The payload en\decryption key is not generated by the keygen app...that is still done by 'age'. |
Beta Was this translation helpful? Give feedback.
-
I agree. I'm trying hard to ditch gpg for something else. One contender is opmsg, but the lack of protection for private key material puts me off:
I disagree with the above. No one has gained access to my system, but I do run lots of software on my system, and any one of them may try to steal private keys. [When I first looked at age, I had planned to simply use my SSH private key, but sadly it resides on a yubikey, which can't yet be used with age. So a regular encrypted age key might be a good stepping stone until ssh-agent support is integrated. Agent support would be ideal though, as I'd only have to unlock the private key once.] |
Beta Was this translation helpful? Give feedback.
-
Would @FiloSottile take a PR on this? I'm happy to take a stab at it. |
Beta Was this translation helpful? Give feedback.
-
There's one linked above, but it seems to have stalled. |
Beta Was this translation helpful? Give feedback.
-
I, too, like to encrypt my keys most of the time, but I can also see how implementing this here would hurt the simplicity of $ printf 'foo\n' > testdata
$ age-keygen | age -p -o mykey.age
Public key: age1j85xmnxgavcach38x4nnzu2tcmdnj7vqq2d4ffmwjsdh9flcuy9sa8agsm
Enter passphrase (leave empty to autogenerate a secure one): mysecret
Confirm passphrase: mysecret
$ age -o testdata.age -r age1j85xmnxgavcach38x4nnzu2tcmdnj7vqq2d4ffmwjsdh9flcuy9sa8agsm testdata
$ age -d mykey.age | age -d -i - testdata.age
Enter passphrase: mysecret
foo This also has another advantage: It's easy to extract your non-password-protected key. This can be useful if you want to store it with gfshare or similar. After that, forgetting your password will not make your encrypted files useless, but it's still not easy for an attacker to steal your key. |
Beta Was this translation helpful? Give feedback.
-
@codesoap, is there a way to save output on decryption instead of STDOUT? I know one can do: age -d mykey.age | age -d -i - testdata.age > testdata But I wonder if there is a way using the |
Beta Was this translation helpful? Give feedback.
-
Weird. Using age -d mykey.age | age -d -i - -o testdata.2 testdata.age |
Beta Was this translation helpful? Give feedback.
-
What were you trying to do
I was playing with the Age beta, generating keys
What happened
I think that in spite of solid UNIX file permissions, the default behaviour should be to encrypt private keys with a symmetric key derived from a password.
Is there an intention to add this feature to Age? If not how best should users. secure plaintext private key material?
Reading the document on Age I see:
However surely that's a fundamental need, otherwise private key material sits in plaintext.
Beta Was this translation helpful? Give feedback.
All reactions