Unable to "dfx identity import" after "dfx identity new"

Q: Is this an error or a bad usage? Thanks.

$ dfx --version
dfx 0.7.0

# create a new identity named “test”

$ dfx identity new test
Creating identity: “test”.
Created identity: “test”.

# attempt to create a new identity named “test2” from the “test” identity pem file

$ dfx identity import test2 ~/.config/dfx/identity/test/identity.pem
Creating identity: “test2”.
Cannot decode PEM file at ‘/home/jron/.config/dfx/identity/test/identity.pem’.
$

The example you describe isn’t quite the intended use case (maybe it should be supported).
The main use case scenario for the dfx identity import command is the capability to import a PEM file that you generated from somewhere else (for example, an identity.pem file generated by the keysmith tool) to create an identity recognized by dfx rather than the ability to import a PEM file from one dfx identity to use with another dfx identity.

HTH
I think the import command might support a different encoding scheme than what the dfx identity new command generates.

2 Likes

Thanks. Yes, it would be nice if supported.