<p><code>ckey</code> is an encrypted private key. <code>mkey</code> is an encryption key for <code>ckey</code>s that is encrypted using your passphrase.</p>
<p>This <a href="https://bitcoin.stackexchange.com/a/111318/48884">answer</a> describes the format of <code>mkey</code> records.</p>
<p><code>ckey</code> have a key of the string <code>ckey</code> followed by the public key. The value contains the encrypted private key followed by the checksum which is the SHA256 of the encrypted private key. The encrypted private key is 32 bytes. It is AES-256-CBC encrypted, with an IV of the first 16 bytes of the SHA256 of the public key.</p>

CC BY-SA 4.0
2022-08-27T10:29:36.897Z
Thanks you I understand it a bit more now. Please tell me is there a way to found my private key using this knowledge?
Alban Fredon
CC BY-SA 4.0
2022-08-27T15:56:57.410Z
If have a `ckey` record, the `mkey` for that `ckey`, and the passphrase for the `mkey`, then yes you can get your private key by doing the decryption.
Ava Chow
CC BY-SA 4.0
2023-01-23T01:31:39.083Z
That's an amazing answer! What is the last sentence about "IV"? Can you extend this sentence?
pbies
CC BY-SA 4.0
2023-01-23T03:40:28.710Z
@pbies There isn't much to expand.. IV stands for Initialization Vector, it's one of the parameters to AES for encrypting or decrypting something.
Ava Chow
CC BY-SA 4.0
2022-08-26T19:41:42.527Z
2022-08-26T19:41:42.527Z
Ava Chow
<p>What is the correlation between <code>ckey</code>, <code>mkey</code> and a private key in bitcoin?
How can I retrieve my lost private key from <code>ckey</code> and <code>mkey</code>?</p>

<private-key><recover-private-key>
How do ckey, mkey and the private key fit together in Bitcoin?
Alban Fredon
# How do ckey, mkey and the private key fit together in Bitcoin?

(Asked by: username_0 on 2022-08-26)

What is the correlation between `ckey`, `mkey` and a private key in bitcoin?
How can I retrieve my lost private key from `ckey` and `mkey`?

**Tags:** private-key, recover-private-key


---

## 1 answers

### Answer by username_1 on 2022-08-26. Score: 2

`ckey` is an encrypted private key. `mkey` is an encryption key for `ckey`s that is encrypted using your passphrase.

This [answer](https://bitcoin.stackexchange.com/a/111318/48884) describes the format of `mkey` records.

`ckey` have a key of the string `ckey` followed by the public key. The value contains the encrypted private key followed by the checksum which is the SHA256 of the encrypted private key. The encrypted private key is 32 bytes. It is AES-256-CBC encrypted, with an IV of the first 16 bytes of the SHA256 of the public key.

> **Comments:**
> **username_0**: Thanks you I understand it a bit more now. Please tell me is there a way to found my private key using this knowledge?  
> **username_1**: If have a `ckey` record, the `mkey` for that `ckey`, and the passphrase for the `mkey`, then yes you can get your private key by doing the decryption.  
> **username_2**: That's an amazing answer! What is the last sentence about "IV"? Can you extend this sentence?  
> **username_1**: @username_2 There isn't much to expand.. IV stands for Initialization Vector, it's one of the parameters to AES for encrypting or decrypting something.  

---

