How export my ipfs key to file (and using it similar gpg). I need exporting key in openssl/gpg format.
Asked
Active
Viewed 259 times
1 Answers
0
You can export keys from go-ipfs using ipfs key export
as long as the daemon isn't running. I'm not sure what you mean by you need to export the key in text mode, but the keys are libp2p keys whose format is described here.
You can of course encode the key in any representation you want (e.g. base16, base32, etc.). On the other hand, if you want to transform the libp2p keys into some other format then you can do so by writing some conversion program to convert the key. A libp2p key unmarshalling function in Go is here.
An example of running export in PowerShell is below:
C:\Users\adin> ipfs key gen example
k51qzi5uqu5dlxhpvewosfhwueh87q9c0rttznvu0k8fhui8mvjd0qmpt2n9b0
C:\Users\adin> ipfs key list
self
example
C:\Users\adin> ipfs key export example -o="myoutput.key"
C:\Users\adin> [Convert]::ToBase64String([IO.File]::ReadAllBytes("myoutput.key"))
CAESQCncEZprjyHaWjMkduj9qcma/Hk7Rjb2sqObS06Rwv+g5pgBN5fZ0DdRMmVLs49OJP0hM/NfkPa2kdOK64u0dNw=

Adin Schmahmann
- 263
- 1
- 7
-
how export key? ipfs.sh key export self ipfs: Reading from /dev/stdin; send Ctrl-d to stop. And second in what format is key? .pem ? Can i use it in gpg, openssl etc? When I generate key I get hash, how generate this? – ojej Feb 18 '21 at 07:49
-
Please write a example export and how lookslike the output – ojej Feb 18 '21 at 07:52
-
`ipfs key export {keyName} -o=outputFile`, not you CANNOT do this for the `self` key. If you want to backup the nodes libp2p key you can just copy it from the config file (e.g. `~/.ipfs/config`). – Adin Schmahmann Feb 18 '21 at 20:08
-
not working, simply i wrote and sill need stdin and nothing happened – ojej Feb 19 '21 at 16:59
-
I added a powershell core 7.1.2 example to the answer above. Could you post exactly what you're running? It seems like you're just not sending a full command. – Adin Schmahmann Feb 21 '21 at 01:04