Where is local principal secret information stored


I’m upgrading my OS and I want to make sure I have backups of the principal cryptographic secrets that I’ve generated by using dfx. I’m looking through my home directory, and I’m not exactly sure where this information is stored.

Can anyone point me to the locations where this information is stored on my machine? I’m currently using Ubuntu 16 (upgrading to 18 and then maybe to 20)

If you have a non HSM identity, the private keys are in ~/.config/dfx/identity/

Perfect thanks! I found it.

can we use hms identities with dfx?

Yes you can, to create one you can use dfx identity new with the following options

        --hsm-key-id <hsm-key-id>                      A sequence of pairs of hex digits
        --hsm-pkcs11-lib-path <hsm-pkcs11-lib-path>
            The file path to the opensc-pkcs11 library e.g. "/usr/local/lib/opensc-pkcs11.so"