# Security of private keys

For every time, you create or import a new wallet, you need to decide which level of security is appropriate for you. The level of security is understood as way of saving private keys in "C:\Low Caps Hub Terminal". You have two options:

* Protecting your assets via .dat file
* Risking loss and keeping PK in simple .txt file

Each option has its own advantages and disadvantages. Let's consider them:

<figure><img src="/files/CP2njJBnN6GXMMvWbWRW" alt=""><figcaption></figcaption></figure>

\
\&#xNAN;**.dat files**

In case of .dat files there is only one disadvantage - a small inconvenience, which requiers unlocking your wallet for every time, you open the Terminal.

{% hint style="danger" %}
Not disadvantage but specific of encryption - if you loss your key, there won't be possibility to break algorithm used by us. Keep it in safe pleace, threat it equal to your seeds!
{% endhint %}

```python
def create_wallet():
    keypair = Keypair.generate()
    private_key = keypair.secret_key
    public_key = keypair.public_key
    private_key_base58 = base58.b58encode(private_key).decode('utf-8')
    directory = create_wallet_directory()
    formatted_filename = format_wallet_filename(public_key)
    filename = os.path.join(directory, f"{formatted_filename}.txt")
    wallet_data = f"Public Key: {public_key}\nPrivate Key (Base58): {private_key_base58}\n"
    return public_key, private_key_base58, wallet_data, filename
```

\
\&#xNAN;**.txt files**

Keeping private keys without protection is a very dangerous attitude. However, we aren't going to limit our users, if someone decide to be exposed, we respect that whereas, we would like to underline a few of most common meances:

* Malicious software.\
  \
  There are tons of undesirable "adds" which are downloading by you unintentionally. When your computer is infected by sophisticated software, their main point is usually to steal as much of sensitive data as possible.\
  \
  If its target is crypto, the malicius programs, usually looking forward the most common standard - PK saved in BIP-39 (well-known 12 or 24 words). However, we can't exclude that some of them searching less common forms, like using by us Base58.

Besides, you can't ignore regular threats, like unauthorized access.\ <br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://low-caps-hub.gitbook.io/lowcapshubterminal/encryption-section/security-of-private-keys.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
