# Question: Does a context named "default" have a specific behaviour in a local identity context managed by dfx identity?

**URL:** <https://forum.dfinity.org/t/question-does-a-context-named-default-have-a-specific-behaviour-in-a-local-identity-context-managed-by-dfx-identity/32131>\
**Category:** Developers\
**Created:** [June 19, 2024, 2:19am UTC](https://forum.dfinity.org/t/question-does-a-context-named-default-have-a-specific-behaviour-in-a-local-identity-context-managed-by-dfx-identity/32131 "2024-06-19T02:19:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![megared](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/megared/32/11028_2.png) [@megared](https://forum.dfinity.org/u/megared)\
**Post date:** [June 19, 2024, 2:19am UTC](https://forum.dfinity.org/t/question-does-a-context-named-default-have-a-specific-behaviour-in-a-local-identity-context-managed-by-dfx-identity/32131/1 "2024-06-19T02:19:05Z")

</div>

The understanding is that in a context created with storage-mode set to default, identity.json is placed as a file and the json is looked at to check that the keyring has a pem, e.g. dfx deploy. If the principal needs to act as a sender, such as in a dfx deploy, it should be recovered from the pem in the keyring and used according to the above flow.

However, in the “default” context, this identity.json is not present. Is there some special specification?  
Few descriptions of default context were found.

> **[dfx identity | Internet Computer](https://internetcomputer.org/docs/current/developer-docs/developer-tools/cli-tools/cli-reference/dfx-identity/#creating-a-default-identity)**
>
> Use the dfx identity command with subcommands and flags to manage the identities used to execute commands and communicate with the IC or the local canister execution environment. Creating multiple user identities enables you to test user-based access...

> [@Where is pem file for non-default identity?](https://forum.dfinity.org/t/where-is-pem-file-for-non-default-identity/22127):
>
> i use non-default identity for my project. i able to find pem file for default identity under /Users/dctech/.config/dfx/identity/default/identity.pem but no pem file for any non-default identity e.g. i created one identity dctech there are only identity.json & wallets.json two files under /Users/dctech/.config/dfx/identity/dctech the identity.json file looks like { “hsm”: null, “encryption”: null, “keyring\_identity\_suffix”: “dctech” } is identity.pem file shared across all identiti…

```bash
ls -1 ~/.config/dfx/identity/(context-name) 
identity.json
wallets.json

ls -1 ~/.config/dfx/identity/default 
identity.pem

```

I am in the process of building a tool that does canister create and canister install without using dfx. So I need to understand the specific behaviour of this default context and other special contexts.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [June 19, 2024, 8:52am UTC](https://forum.dfinity.org/t/question-does-a-context-named-default-have-a-specific-behaviour-in-a-local-identity-context-managed-by-dfx-identity/32131/2 "2024-06-19T08:52:18Z")

</div>

`dfx` has three storage modes for private keys.

- `plaintext`: used for the `default` identity and if `--storage-mode plaintext` is specified. This puts an `identity.pem` file in the identity folder that contains the private key directly
- `keyring`: used by default if keyring/keychain is accessible to dfx or if `--storage-mode keyring` is specified. This is the case that you already described
- `password-protected`: used by default if keyring/keychain are not accessible or if `--storage-mode password-protected` is specified. It puts a `.pem.encrypted` file next to `identity.json`, which contains the nonce that is required (besides the password of course) to decrypt the private key

Does your tool want to use the same identities as dfx? Otherwise I wouldn’t bother with all this…
