Better defaults for ipfs key export (PEM, PKCS) #8594
Labels
effort/days
Estimated to take multiple days, but less than a week
exp/intermediate
Prior experience is likely helpful
help wanted
Seeking public contribution on this issue
kind/enhancement
A net-new feature or improvement to an existing feature
topic/security
Topic security
Milestone
Current implementation
Right now, the
ipfs key export -o foo.key
just spits out the key in proprietary Protobuf, without any protection:This is not only a dangerous default, but makes it difficult to interop with the outside world.
People building on IPFS asked for the ability to generate keys outside go-ipfs and/or export them in a form that is useful out of the box, or a safer way to export a key to move it to a different box.
Ref. https://discuss.ipfs.io/t/importing-pem-encoded-private-key/12770/9
Proposed fix
We should fix the default behavior and do what js-ipfs does:
Namely:
Some implementation suggestions:
--format=pem-pkcs8-encrypted
the implicit default--format=pem-pkcs8-cleartext
--format=libp2p-protobuf-cleartext
--format
and return error if input does not match expected formatUpdate: turns out js-ipfs uses PEM only for RSA keys, Ed25519 (current default) use custom format encrypted with aes-gcm (details in #8616 (review)) – I suggested focussing on cleartext (unencrypted) PEM for now, as it the most interoperable with external software.
The text was updated successfully, but these errors were encountered: