mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 17:56:16 +00:00
181 lines
130 KiB
HTML
181 lines
130 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.14"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>Dash Core: src/wallet/crypter.cpp Source File</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(document).ready(initResizable);
|
|
/* @license-end */</script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectlogo"><img alt="Logo" src="bitcoin_logo_doxygen.png"/></td>
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">Dash Core
|
|
 <span id="projectnumber">0.12.2.1</span>
|
|
</div>
|
|
<div id="projectbrief">P2P Digital Currency</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.14 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */</script>
|
|
<div id="main-nav"></div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(document).ready(function(){initNavTree('crypter_8cpp_source.html','');});
|
|
/* @license-end */
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">crypter.cpp</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a href="crypter_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">// Copyright (c) 2009-2015 The Bitcoin Core developers</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// Distributed under the MIT software license, see the accompanying</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// file COPYING or http://www.opensource.org/licenses/mit-license.php.</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> </div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#include "<a class="code" href="crypter_8h.html">crypter.h</a>"</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> </div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#include "<a class="code" href="script_8h.html">script/script.h</a>"</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include "<a class="code" href="standard_8h.html">script/standard.h</a>"</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include "util.h"</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> </div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include <string></span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#include <vector></span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="preprocessor">#include <boost/foreach.hpp></span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="preprocessor">#include <openssl/aes.h></span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#include <openssl/evp.h></span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="classCCrypter.html#a5368279e4a1549d3c1d15d8aa2179708"> 17</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCrypter.html#a5368279e4a1549d3c1d15d8aa2179708">CCrypter::SetKeyFromPassphrase</a>(<span class="keyword">const</span> <a class="code" href="secure_8h.html#a396ed773a5ac24aec28c8f7dc413c7ac">SecureString</a>& strKeyData, <span class="keyword">const</span> std::vector<unsigned char>& chSalt, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nRounds, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nDerivationMethod)</div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> {</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  <span class="keywordflow">if</span> (nRounds < 1 || chSalt.size() != <a class="code" href="crypter_8h.html#aa42a9547c4738b8f92fd88016c5184a0">WALLET_CRYPTO_SALT_SIZE</a>)</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <span class="keywordtype">int</span> i = 0;</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="keywordflow">if</span> (nDerivationMethod == 0)</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  i = EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha512(), &chSalt[0],</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *)&strKeyData[0], strKeyData.size(), nRounds, <a class="code" href="classCCrypter.html#a11ec47962b8d46116877957726aeb291">chKey</a>, <a class="code" href="classCCrypter.html#a4d7a740fe37b389b9ec8447d193bcfc7">chIV</a>);</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> </div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  <span class="keywordflow">if</span> (i != (<span class="keywordtype">int</span>)<a class="code" href="crypter_8h.html#abf8d5f4eb0b3c828d9fbedb9b2e10b2a">WALLET_CRYPTO_KEY_SIZE</a>)</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  {</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  <a class="code" href="cleanse_8cpp.html#a5a4afb85dd16ecc1f6019c782db78663">memory_cleanse</a>(<a class="code" href="classCCrypter.html#a11ec47962b8d46116877957726aeb291">chKey</a>, <span class="keyword">sizeof</span>(<a class="code" href="classCCrypter.html#a11ec47962b8d46116877957726aeb291">chKey</a>));</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <a class="code" href="cleanse_8cpp.html#a5a4afb85dd16ecc1f6019c782db78663">memory_cleanse</a>(<a class="code" href="classCCrypter.html#a4d7a740fe37b389b9ec8447d193bcfc7">chIV</a>, <span class="keyword">sizeof</span>(<a class="code" href="classCCrypter.html#a4d7a740fe37b389b9ec8447d193bcfc7">chIV</a>));</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  }</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <a class="code" href="classCCrypter.html#a4a1485fd00acb8424cfef256c78ac176">fKeySet</a> = <span class="keyword">true</span>;</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> }</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span> </div><div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="classCCrypter.html#a0d948dd4796e2420e1dd9c1ddbf7974e"> 38</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCrypter.html#a0d948dd4796e2420e1dd9c1ddbf7974e">CCrypter::SetKey</a>(<span class="keyword">const</span> <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a>& chNewKey, <span class="keyword">const</span> std::vector<unsigned char>& chNewIV)</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> {</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <span class="keywordflow">if</span> (chNewKey.size() != <a class="code" href="crypter_8h.html#abf8d5f4eb0b3c828d9fbedb9b2e10b2a">WALLET_CRYPTO_KEY_SIZE</a> || chNewIV.size() != <a class="code" href="crypter_8h.html#abf8d5f4eb0b3c828d9fbedb9b2e10b2a">WALLET_CRYPTO_KEY_SIZE</a>)</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> </div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <a class="code" href="glibc__compat_8cpp.html#a0f46826ab0466591e136db24394923cf">memcpy</a>(&<a class="code" href="classCCrypter.html#a11ec47962b8d46116877957726aeb291">chKey</a>[0], &chNewKey[0], <span class="keyword">sizeof</span> <a class="code" href="classCCrypter.html#a11ec47962b8d46116877957726aeb291">chKey</a>);</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <a class="code" href="glibc__compat_8cpp.html#a0f46826ab0466591e136db24394923cf">memcpy</a>(&<a class="code" href="classCCrypter.html#a4d7a740fe37b389b9ec8447d193bcfc7">chIV</a>[0], &chNewIV[0], <span class="keyword">sizeof</span> <a class="code" href="classCCrypter.html#a4d7a740fe37b389b9ec8447d193bcfc7">chIV</a>);</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> </div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <a class="code" href="classCCrypter.html#a4a1485fd00acb8424cfef256c78ac176">fKeySet</a> = <span class="keyword">true</span>;</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> }</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> </div><div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="classCCrypter.html#a124fcd3021569a660ce2daa3391c8ea4"> 50</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCrypter.html#a124fcd3021569a660ce2daa3391c8ea4">CCrypter::Encrypt</a>(<span class="keyword">const</span> <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a>& vchPlaintext, std::vector<unsigned char> &vchCiphertext)</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> {</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCrypter.html#a4a1485fd00acb8424cfef256c78ac176">fKeySet</a>)</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> </div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <span class="comment">// max ciphertext len for a n bytes of plaintext is</span></div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="comment">// n + AES_BLOCK_SIZE - 1 bytes</span></div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordtype">int</span> nLen = vchPlaintext.size();</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="keywordtype">int</span> nCLen = nLen + AES_BLOCK_SIZE, nFLen = 0;</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  vchCiphertext = std::vector<unsigned char> (nCLen);</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span> </div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  EVP_CIPHER_CTX *<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a> = EVP_CIPHER_CTX_new();</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span> </div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="keywordflow">if</span> (!<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keywordtype">bool</span> fOk = <span class="keyword">true</span>;</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span> </div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  EVP_CIPHER_CTX_init(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>);</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="keywordflow">if</span> (fOk) fOk = EVP_EncryptInit_ex(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, EVP_aes_256_cbc(), NULL, <a class="code" href="classCCrypter.html#a11ec47962b8d46116877957726aeb291">chKey</a>, <a class="code" href="classCCrypter.html#a4d7a740fe37b389b9ec8447d193bcfc7">chIV</a>) != 0;</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="keywordflow">if</span> (fOk) fOk = EVP_EncryptUpdate(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, &vchCiphertext[0], &nCLen, &vchPlaintext[0], nLen) != 0;</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keywordflow">if</span> (fOk) fOk = EVP_EncryptFinal_ex(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, (&vchCiphertext[0]) + nCLen, &nFLen) != 0;</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  EVP_CIPHER_CTX_cleanup(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>);</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span> </div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  EVP_CIPHER_CTX_free(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>);</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span> </div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keywordflow">if</span> (!fOk) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  vchCiphertext.resize(nCLen + nFLen);</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span> }</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span> </div><div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="classCCrypter.html#a4dbabed4975d4435d22c76deac43df7f"> 81</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCrypter.html#a4dbabed4975d4435d22c76deac43df7f">CCrypter::Decrypt</a>(<span class="keyword">const</span> std::vector<unsigned char>& vchCiphertext, <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a>& vchPlaintext)</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span> {</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCrypter.html#a4a1485fd00acb8424cfef256c78ac176">fKeySet</a>)</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span> </div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="comment">// plaintext will always be equal to or lesser than length of ciphertext</span></div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="keywordtype">int</span> nLen = vchCiphertext.size();</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keywordtype">int</span> nPLen = nLen, nFLen = 0;</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span> </div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  vchPlaintext = <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a>(nPLen);</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span> </div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  EVP_CIPHER_CTX *<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a> = EVP_CIPHER_CTX_new();</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> </div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordflow">if</span> (!<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span> </div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="keywordtype">bool</span> fOk = <span class="keyword">true</span>;</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> </div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  EVP_CIPHER_CTX_init(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>);</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="keywordflow">if</span> (fOk) fOk = EVP_DecryptInit_ex(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, EVP_aes_256_cbc(), NULL, <a class="code" href="classCCrypter.html#a11ec47962b8d46116877957726aeb291">chKey</a>, <a class="code" href="classCCrypter.html#a4d7a740fe37b389b9ec8447d193bcfc7">chIV</a>) != 0;</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <span class="keywordflow">if</span> (fOk) fOk = EVP_DecryptUpdate(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, &vchPlaintext[0], &nPLen, &vchCiphertext[0], nLen) != 0;</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="keywordflow">if</span> (fOk) fOk = EVP_DecryptFinal_ex(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, (&vchPlaintext[0]) + nPLen, &nFLen) != 0;</div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  EVP_CIPHER_CTX_cleanup(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>);</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span> </div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  EVP_CIPHER_CTX_free(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>);</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span> </div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordflow">if</span> (!fOk) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> </div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  vchPlaintext.resize(nPLen + nFLen);</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span> }</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span> </div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> </div><div class="line"><a name="l00113"></a><span class="lineno"><a class="line" href="crypter_8cpp.html#ada64a9935b2b07723ad9feb4ce9eccfc"> 113</a></span> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="crypter_8cpp.html#ada64a9935b2b07723ad9feb4ce9eccfc">EncryptSecret</a>(<span class="keyword">const</span> <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a>& vMasterKey, <span class="keyword">const</span> <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a> &vchPlaintext, <span class="keyword">const</span> <a class="code" href="classuint256.html">uint256</a>& nIV, std::vector<unsigned char> &vchCiphertext)</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> {</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <a class="code" href="classCCrypter.html">CCrypter</a> cKeyCrypter;</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  std::vector<unsigned char> chIV(<a class="code" href="crypter_8h.html#abf8d5f4eb0b3c828d9fbedb9b2e10b2a">WALLET_CRYPTO_KEY_SIZE</a>);</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <a class="code" href="glibc__compat_8cpp.html#a0f46826ab0466591e136db24394923cf">memcpy</a>(&chIV[0], &nIV, <a class="code" href="crypter_8h.html#abf8d5f4eb0b3c828d9fbedb9b2e10b2a">WALLET_CRYPTO_KEY_SIZE</a>);</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <span class="keywordflow">if</span>(!cKeyCrypter.<a class="code" href="classCCrypter.html#a0d948dd4796e2420e1dd9c1ddbf7974e">SetKey</a>(vMasterKey, chIV))</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="keywordflow">return</span> cKeyCrypter.<a class="code" href="classCCrypter.html#a124fcd3021569a660ce2daa3391c8ea4">Encrypt</a>(*((<span class="keyword">const</span> <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a>*)&vchPlaintext), vchCiphertext);</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span> }</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span> </div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> </div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="comment">// General secure AES 256 CBC encryption routine</span></div><div class="line"><a name="l00125"></a><span class="lineno"><a class="line" href="crypter_8h.html#a226a32c844661568e96a8e4facdb4804"> 125</a></span> <span class="keywordtype">bool</span> <a class="code" href="crypter_8cpp.html#a226a32c844661568e96a8e4facdb4804">EncryptAES256</a>(<span class="keyword">const</span> <a class="code" href="secure_8h.html#a396ed773a5ac24aec28c8f7dc413c7ac">SecureString</a>& sKey, <span class="keyword">const</span> <a class="code" href="secure_8h.html#a396ed773a5ac24aec28c8f7dc413c7ac">SecureString</a>& sPlaintext, <span class="keyword">const</span> std::string& sIV, std::string& sCiphertext)</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span> {</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="comment">// max ciphertext len for a n bytes of plaintext is</span></div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="comment">// n + AES_BLOCK_SIZE - 1 bytes</span></div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="keywordtype">int</span> nLen = sPlaintext.size();</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="keywordtype">int</span> nCLen = nLen + AES_BLOCK_SIZE;</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  <span class="keywordtype">int</span> nFLen = 0;</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span> </div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="comment">// Verify key sizes</span></div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="keywordflow">if</span>(sKey.size() != 32 || sIV.size() != AES_BLOCK_SIZE) {</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  <a class="code" href="util_8h.html#afc02c0a4258fedfb316be612bb659ba8">LogPrintf</a>(<span class="stringliteral">"crypter EncryptAES256 - Invalid key or block size: Key: %d sIV:%d\n"</span>, sKey.size(), sIV.size());</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  }</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span> </div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="comment">// Prepare output buffer</span></div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  sCiphertext.resize(nCLen);</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span> </div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <span class="comment">// Perform the encryption</span></div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  EVP_CIPHER_CTX *<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a> = EVP_CIPHER_CTX_new();</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span> </div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  <span class="keywordflow">if</span> (!<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span> </div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  <span class="keywordtype">bool</span> fOk = <span class="keyword">true</span>;</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span> </div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  EVP_CIPHER_CTX_init(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>);</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  <span class="keywordflow">if</span> (fOk) fOk = EVP_EncryptInit_ex(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, EVP_aes_256_cbc(), NULL, (<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*) &sKey[0], (<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*) &sIV[0]);</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  <span class="keywordflow">if</span> (fOk) fOk = EVP_EncryptUpdate(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*) &sCiphertext[0], &nCLen, (<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*) &sPlaintext[0], nLen);</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <span class="keywordflow">if</span> (fOk) fOk = EVP_EncryptFinal_ex(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*) (&sCiphertext[0])+nCLen, &nFLen);</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  EVP_CIPHER_CTX_cleanup(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>);</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span> </div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  EVP_CIPHER_CTX_free(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>);</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span> </div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  <span class="keywordflow">if</span> (!fOk) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span> </div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  sCiphertext.resize(nCLen + nFLen);</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span> }</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span> </div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span> </div><div class="line"><a name="l00164"></a><span class="lineno"><a class="line" href="crypter_8cpp.html#aca91610bb6ae114b7d1768ccda008e2a"> 164</a></span> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="crypter_8cpp.html#aca91610bb6ae114b7d1768ccda008e2a">DecryptSecret</a>(<span class="keyword">const</span> <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a>& vMasterKey, <span class="keyword">const</span> std::vector<unsigned char>& vchCiphertext, <span class="keyword">const</span> <a class="code" href="classuint256.html">uint256</a>& nIV, <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a>& vchPlaintext)</div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span> {</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <a class="code" href="classCCrypter.html">CCrypter</a> cKeyCrypter;</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  std::vector<unsigned char> chIV(<a class="code" href="crypter_8h.html#abf8d5f4eb0b3c828d9fbedb9b2e10b2a">WALLET_CRYPTO_KEY_SIZE</a>);</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  <a class="code" href="glibc__compat_8cpp.html#a0f46826ab0466591e136db24394923cf">memcpy</a>(&chIV[0], &nIV, <a class="code" href="crypter_8h.html#abf8d5f4eb0b3c828d9fbedb9b2e10b2a">WALLET_CRYPTO_KEY_SIZE</a>);</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  <span class="keywordflow">if</span>(!cKeyCrypter.<a class="code" href="classCCrypter.html#a0d948dd4796e2420e1dd9c1ddbf7974e">SetKey</a>(vMasterKey, chIV))</div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  <span class="keywordflow">return</span> cKeyCrypter.<a class="code" href="classCCrypter.html#a4dbabed4975d4435d22c76deac43df7f">Decrypt</a>(vchCiphertext, *((<a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a>*)&vchPlaintext));</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span> }</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span> </div><div class="line"><a name="l00174"></a><span class="lineno"><a class="line" href="crypter_8h.html#ae8eca4e4f0534b828d8a2a549536c762"> 174</a></span> <span class="keywordtype">bool</span> <a class="code" href="crypter_8cpp.html#ae8eca4e4f0534b828d8a2a549536c762">DecryptAES256</a>(<span class="keyword">const</span> <a class="code" href="secure_8h.html#a396ed773a5ac24aec28c8f7dc413c7ac">SecureString</a>& sKey, <span class="keyword">const</span> std::string& sCiphertext, <span class="keyword">const</span> std::string& sIV, <a class="code" href="secure_8h.html#a396ed773a5ac24aec28c8f7dc413c7ac">SecureString</a>& sPlaintext)</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span> {</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  <span class="comment">// plaintext will always be equal to or lesser than length of ciphertext</span></div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <span class="keywordtype">int</span> nLen = sCiphertext.size();</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  <span class="keywordtype">int</span> nPLen = nLen, nFLen = 0;</div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span> </div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span>  <span class="comment">// Verify key sizes</span></div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  <span class="keywordflow">if</span>(sKey.size() != 32 || sIV.size() != AES_BLOCK_SIZE) {</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span>  <a class="code" href="util_8h.html#afc02c0a4258fedfb316be612bb659ba8">LogPrintf</a>(<span class="stringliteral">"crypter DecryptAES256 - Invalid key or block size\n"</span>);</div><div class="line"><a name="l00183"></a><span class="lineno"> 183</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span>  }</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span> </div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  sPlaintext.resize(nPLen);</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span> </div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  EVP_CIPHER_CTX *<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a> = EVP_CIPHER_CTX_new();</div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span> </div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span>  <span class="keywordflow">if</span> (!<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span> </div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <span class="keywordtype">bool</span> fOk = <span class="keyword">true</span>;</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> </div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  EVP_CIPHER_CTX_init(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>);</div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="keywordflow">if</span> (fOk) fOk = EVP_DecryptInit_ex(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, EVP_aes_256_cbc(), NULL, (<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*) &sKey[0], (<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*) &sIV[0]);</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  <span class="keywordflow">if</span> (fOk) fOk = EVP_DecryptUpdate(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *) &sPlaintext[0], &nPLen, (<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *) &sCiphertext[0], nLen);</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <span class="keywordflow">if</span> (fOk) fOk = EVP_DecryptFinal_ex(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>, (<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *) (&sPlaintext[0])+nPLen, &nFLen);</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  EVP_CIPHER_CTX_cleanup(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>);</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span> </div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  EVP_CIPHER_CTX_free(<a class="code" href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a>);</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span> </div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  <span class="keywordflow">if</span> (!fOk) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span> </div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span>  sPlaintext.resize(nPLen + nFLen);</div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span> }</div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span> </div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> </div><div class="line"><a name="l00209"></a><span class="lineno"><a class="line" href="crypter_8cpp.html#a706e11496e7a89bd65def6cce072ca77"> 209</a></span> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="crypter_8cpp.html#a706e11496e7a89bd65def6cce072ca77">DecryptKey</a>(<span class="keyword">const</span> <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a>& vMasterKey, <span class="keyword">const</span> std::vector<unsigned char>& vchCryptedSecret, <span class="keyword">const</span> <a class="code" href="classCPubKey.html">CPubKey</a>& vchPubKey, <a class="code" href="classCKey.html">CKey</a>& <a class="code" href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">key</a>)</div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span> {</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a> vchSecret;</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  <span class="keywordflow">if</span>(!<a class="code" href="crypter_8cpp.html#aca91610bb6ae114b7d1768ccda008e2a">DecryptSecret</a>(vMasterKey, vchCryptedSecret, vchPubKey.<a class="code" href="classCPubKey.html#ab1aaa3f6085a3e9bc034d3e1269d870d">GetHash</a>(), vchSecret))</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span> </div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  <span class="keywordflow">if</span> (vchSecret.size() != 32)</div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span> </div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  <a class="code" href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">key</a>.Set(vchSecret.begin(), vchSecret.end(), vchPubKey.<a class="code" href="classCPubKey.html#a25f8b70340ad20ddab0f80ec4cee9396">IsCompressed</a>());</div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  <span class="keywordflow">return</span> <a class="code" href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">key</a>.VerifyPubKey(vchPubKey);</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span> }</div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span> </div><div class="line"><a name="l00222"></a><span class="lineno"><a class="line" href="classCCryptoKeyStore.html#af202f587051735be5a39344d9e333720"> 222</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCryptoKeyStore.html#af202f587051735be5a39344d9e333720">CCryptoKeyStore::SetCrypted</a>()</div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span> {</div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  <a class="code" href="sync_8h.html#a911fe23f057c2fe5aad629162d6c99d0">LOCK</a>(<a class="code" href="classCKeyStore.html#a386524ff4a00959b81c195cb39fe307d">cs_KeyStore</a>);</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  <span class="keywordflow">if</span> (<a class="code" href="classCCryptoKeyStore.html#a78f20a092d0f6e862b15216221d7f38e">fUseCrypto</a>)</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCBasicKeyStore.html#ac520003e5c3d863bf71fde247c6e0672">mapKeys</a>.empty())</div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  <a class="code" href="classCCryptoKeyStore.html#a78f20a092d0f6e862b15216221d7f38e">fUseCrypto</a> = <span class="keyword">true</span>;</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span> }</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span> </div><div class="line"><a name="l00233"></a><span class="lineno"><a class="line" href="classCCryptoKeyStore.html#a1973070a17085d994a194e6dc1b4b293"> 233</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCryptoKeyStore.html#a1973070a17085d994a194e6dc1b4b293">CCryptoKeyStore::Lock</a>(<span class="keywordtype">bool</span> fAllowMixing)</div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span> {</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#af202f587051735be5a39344d9e333720">SetCrypted</a>())</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span> </div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  <span class="keywordflow">if</span>(!fAllowMixing) {</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  <a class="code" href="sync_8h.html#a911fe23f057c2fe5aad629162d6c99d0">LOCK</a>(<a class="code" href="classCKeyStore.html#a386524ff4a00959b81c195cb39fe307d">cs_KeyStore</a>);</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  <a class="code" href="classCCryptoKeyStore.html#ac74e458a90ce17a95e238bad724df3fd">vMasterKey</a>.clear();</div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span>  }</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span> </div><div class="line"><a name="l00243"></a><span class="lineno"> 243</span>  <a class="code" href="classCCryptoKeyStore.html#a2cd80fec8ff9aa4420e98ca3da8e8d75">fOnlyMixingAllowed</a> = fAllowMixing;</div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  <a class="code" href="classCCryptoKeyStore.html#a251b9ed228a19ab39d542985b425fc85">NotifyStatusChanged</a>(<span class="keyword">this</span>);</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span> }</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span> </div><div class="line"><a name="l00248"></a><span class="lineno"><a class="line" href="classCCryptoKeyStore.html#a0717bc91b52f267df77e61870211ca62"> 248</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCryptoKeyStore.html#a0717bc91b52f267df77e61870211ca62">CCryptoKeyStore::Unlock</a>(<span class="keyword">const</span> <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a>& vMasterKeyIn, <span class="keywordtype">bool</span> fForMixingOnly)</div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span> {</div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  {</div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  <a class="code" href="sync_8h.html#a911fe23f057c2fe5aad629162d6c99d0">LOCK</a>(<a class="code" href="classCKeyStore.html#a386524ff4a00959b81c195cb39fe307d">cs_KeyStore</a>);</div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#af202f587051735be5a39344d9e333720">SetCrypted</a>())</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span> </div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  <span class="keywordtype">bool</span> keyPass = <span class="keyword">false</span>;</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  <span class="keywordtype">bool</span> keyFail = <span class="keyword">false</span>;</div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  CryptedKeyMap::const_iterator mi = <a class="code" href="classCCryptoKeyStore.html#ad1fb9b23eee7a352617209ee2e4f3498">mapCryptedKeys</a>.begin();</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  <span class="keywordflow">for</span> (; mi != <a class="code" href="classCCryptoKeyStore.html#ad1fb9b23eee7a352617209ee2e4f3498">mapCryptedKeys</a>.end(); ++mi)</div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  {</div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  <span class="keyword">const</span> <a class="code" href="classCPubKey.html">CPubKey</a> &vchPubKey = (*mi).second.first;</div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  <span class="keyword">const</span> std::vector<unsigned char> &vchCryptedSecret = (*mi).second.second;</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  <a class="code" href="classCKey.html">CKey</a> <a class="code" href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">key</a>;</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  <span class="keywordflow">if</span> (!<a class="code" href="crypter_8cpp.html#a706e11496e7a89bd65def6cce072ca77">DecryptKey</a>(vMasterKeyIn, vchCryptedSecret, vchPubKey, <a class="code" href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">key</a>))</div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  {</div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  keyFail = <span class="keyword">true</span>;</div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  }</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  keyPass = <span class="keyword">true</span>;</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span>  <span class="keywordflow">if</span> (<a class="code" href="classCCryptoKeyStore.html#a46872ff611730d228f7d1a92c1d8526e">fDecryptionThoroughlyChecked</a>)</div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span>  }</div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  <span class="keywordflow">if</span> (keyPass && keyFail)</div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  {</div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  <a class="code" href="util_8h.html#afc02c0a4258fedfb316be612bb659ba8">LogPrintf</a>(<span class="stringliteral">"The wallet is probably corrupted: Some keys decrypt but not all.\n"</span>);</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  assert(<span class="keyword">false</span>);</div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  }</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span>  <span class="keywordflow">if</span> (keyFail || (!keyPass && <a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a72b48b299ab3d24d46e487d4bc1603b2">IsNull</a>()))</div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span> </div><div class="line"><a name="l00280"></a><span class="lineno"> 280</span>  <a class="code" href="classCCryptoKeyStore.html#ac74e458a90ce17a95e238bad724df3fd">vMasterKey</a> = vMasterKeyIn;</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span> </div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  <span class="keywordflow">if</span>(!<a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a72b48b299ab3d24d46e487d4bc1603b2">IsNull</a>()) {</div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  <span class="keywordtype">bool</span> chainPass = <span class="keyword">false</span>;</div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  <span class="comment">// try to decrypt seed and make sure it matches</span></div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  <a class="code" href="classCHDChain.html">CHDChain</a> hdChainTmp;</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span>  <span class="keywordflow">if</span> (<a class="code" href="classCCryptoKeyStore.html#ac468711074b26df2a6c7fbc3a2cde470">DecryptHDChain</a>(hdChainTmp)) {</div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  <span class="comment">// make sure seed matches this chain</span></div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  chainPass = <a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a37c75884a3ef7c7ff435aae648c3c6de">GetID</a>() == hdChainTmp.<a class="code" href="classCHDChain.html#a4593a3c0b9eb1918f0c3820f1a54b5f4">GetSeedHash</a>();</div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  }</div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  <span class="keywordflow">if</span> (!chainPass) {</div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  <a class="code" href="classCCryptoKeyStore.html#ac74e458a90ce17a95e238bad724df3fd">vMasterKey</a>.clear();</div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span>  }</div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span>  }</div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  <a class="code" href="classCCryptoKeyStore.html#a46872ff611730d228f7d1a92c1d8526e">fDecryptionThoroughlyChecked</a> = <span class="keyword">true</span>;</div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  }</div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  <a class="code" href="classCCryptoKeyStore.html#a2cd80fec8ff9aa4420e98ca3da8e8d75">fOnlyMixingAllowed</a> = fForMixingOnly;</div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  <a class="code" href="classCCryptoKeyStore.html#a251b9ed228a19ab39d542985b425fc85">NotifyStatusChanged</a>(<span class="keyword">this</span>);</div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span> }</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span> </div><div class="line"><a name="l00302"></a><span class="lineno"><a class="line" href="classCCryptoKeyStore.html#a340109b8673267676a34664a76ed3274"> 302</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCryptoKeyStore.html#a340109b8673267676a34664a76ed3274">CCryptoKeyStore::AddKeyPubKey</a>(<span class="keyword">const</span> <a class="code" href="classCKey.html">CKey</a>& <a class="code" href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">key</a>, <span class="keyword">const</span> <a class="code" href="classCPubKey.html">CPubKey</a> &pubkey)</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span> {</div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  {</div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  <a class="code" href="sync_8h.html#a911fe23f057c2fe5aad629162d6c99d0">LOCK</a>(<a class="code" href="classCKeyStore.html#a386524ff4a00959b81c195cb39fe307d">cs_KeyStore</a>);</div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#acc8fed44366c98fb481333ca6e867088">IsCrypted</a>())</div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span>  <span class="keywordflow">return</span> <a class="code" href="classCBasicKeyStore.html#acc2e33f319de88e88f86b0dc79bdcb65">CBasicKeyStore::AddKeyPubKey</a>(<a class="code" href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">key</a>, pubkey);</div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span> </div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  <span class="keywordflow">if</span> (<a class="code" href="classCCryptoKeyStore.html#af9a5bd9adc6d09c3eddbf81e71237994">IsLocked</a>(<span class="keyword">true</span>))</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span> </div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span>  std::vector<unsigned char> vchCryptedSecret;</div><div class="line"><a name="l00313"></a><span class="lineno"> 313</span>  <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a> vchSecret(<a class="code" href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">key</a>.begin(), <a class="code" href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">key</a>.end());</div><div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  <span class="keywordflow">if</span> (!<a class="code" href="crypter_8cpp.html#ada64a9935b2b07723ad9feb4ce9eccfc">EncryptSecret</a>(<a class="code" href="classCCryptoKeyStore.html#ac74e458a90ce17a95e238bad724df3fd">vMasterKey</a>, vchSecret, pubkey.<a class="code" href="classCPubKey.html#ab1aaa3f6085a3e9bc034d3e1269d870d">GetHash</a>(), vchCryptedSecret))</div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span> </div><div class="line"><a name="l00317"></a><span class="lineno"> 317</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#a9f4d2df95008205b2b9784c5f0e8e12b">AddCryptedKey</a>(pubkey, vchCryptedSecret))</div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  }</div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span> }</div><div class="line"><a name="l00322"></a><span class="lineno"> 322</span> </div><div class="line"><a name="l00323"></a><span class="lineno"> 323</span> </div><div class="line"><a name="l00324"></a><span class="lineno"><a class="line" href="classCCryptoKeyStore.html#a9f4d2df95008205b2b9784c5f0e8e12b"> 324</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCryptoKeyStore.html#a9f4d2df95008205b2b9784c5f0e8e12b">CCryptoKeyStore::AddCryptedKey</a>(<span class="keyword">const</span> <a class="code" href="classCPubKey.html">CPubKey</a> &vchPubKey, <span class="keyword">const</span> std::vector<unsigned char> &vchCryptedSecret)</div><div class="line"><a name="l00325"></a><span class="lineno"> 325</span> {</div><div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  {</div><div class="line"><a name="l00327"></a><span class="lineno"> 327</span>  <a class="code" href="sync_8h.html#a911fe23f057c2fe5aad629162d6c99d0">LOCK</a>(<a class="code" href="classCKeyStore.html#a386524ff4a00959b81c195cb39fe307d">cs_KeyStore</a>);</div><div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#af202f587051735be5a39344d9e333720">SetCrypted</a>())</div><div class="line"><a name="l00329"></a><span class="lineno"> 329</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span> </div><div class="line"><a name="l00331"></a><span class="lineno"> 331</span>  <a class="code" href="classCCryptoKeyStore.html#ad1fb9b23eee7a352617209ee2e4f3498">mapCryptedKeys</a>[vchPubKey.<a class="code" href="classCPubKey.html#a2675f7e6f72eff68e7a5227289feb021">GetID</a>()] = make_pair(vchPubKey, vchCryptedSecret);</div><div class="line"><a name="l00332"></a><span class="lineno"> 332</span>  }</div><div class="line"><a name="l00333"></a><span class="lineno"> 333</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00334"></a><span class="lineno"> 334</span> }</div><div class="line"><a name="l00335"></a><span class="lineno"> 335</span> </div><div class="line"><a name="l00336"></a><span class="lineno"><a class="line" href="classCCryptoKeyStore.html#af46ec271fffb65a113702ba40a3738c8"> 336</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCryptoKeyStore.html#af46ec271fffb65a113702ba40a3738c8">CCryptoKeyStore::GetKey</a>(<span class="keyword">const</span> <a class="code" href="classCKeyID.html">CKeyID</a> &address, <a class="code" href="classCKey.html">CKey</a>& keyOut)<span class="keyword"> const</span></div><div class="line"><a name="l00337"></a><span class="lineno"> 337</span> <span class="keyword"></span>{</div><div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  {</div><div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  <a class="code" href="sync_8h.html#a911fe23f057c2fe5aad629162d6c99d0">LOCK</a>(<a class="code" href="classCKeyStore.html#a386524ff4a00959b81c195cb39fe307d">cs_KeyStore</a>);</div><div class="line"><a name="l00340"></a><span class="lineno"> 340</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#acc8fed44366c98fb481333ca6e867088">IsCrypted</a>())</div><div class="line"><a name="l00341"></a><span class="lineno"> 341</span>  <span class="keywordflow">return</span> <a class="code" href="classCBasicKeyStore.html#a69328ee642e4234922356f59876e956d">CBasicKeyStore::GetKey</a>(address, keyOut);</div><div class="line"><a name="l00342"></a><span class="lineno"> 342</span> </div><div class="line"><a name="l00343"></a><span class="lineno"> 343</span>  CryptedKeyMap::const_iterator mi = <a class="code" href="classCCryptoKeyStore.html#ad1fb9b23eee7a352617209ee2e4f3498">mapCryptedKeys</a>.find(address);</div><div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  <span class="keywordflow">if</span> (mi != <a class="code" href="classCCryptoKeyStore.html#ad1fb9b23eee7a352617209ee2e4f3498">mapCryptedKeys</a>.end())</div><div class="line"><a name="l00345"></a><span class="lineno"> 345</span>  {</div><div class="line"><a name="l00346"></a><span class="lineno"> 346</span>  <span class="keyword">const</span> <a class="code" href="classCPubKey.html">CPubKey</a> &vchPubKey = (*mi).second.first;</div><div class="line"><a name="l00347"></a><span class="lineno"> 347</span>  <span class="keyword">const</span> std::vector<unsigned char> &vchCryptedSecret = (*mi).second.second;</div><div class="line"><a name="l00348"></a><span class="lineno"> 348</span>  <span class="keywordflow">return</span> <a class="code" href="crypter_8cpp.html#a706e11496e7a89bd65def6cce072ca77">DecryptKey</a>(<a class="code" href="classCCryptoKeyStore.html#ac74e458a90ce17a95e238bad724df3fd">vMasterKey</a>, vchCryptedSecret, vchPubKey, keyOut);</div><div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  }</div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  }</div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00352"></a><span class="lineno"> 352</span> }</div><div class="line"><a name="l00353"></a><span class="lineno"> 353</span> </div><div class="line"><a name="l00354"></a><span class="lineno"><a class="line" href="classCCryptoKeyStore.html#a20b474adfe6900bb36cd4fd6f9c31380"> 354</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCryptoKeyStore.html#a20b474adfe6900bb36cd4fd6f9c31380">CCryptoKeyStore::GetPubKey</a>(<span class="keyword">const</span> <a class="code" href="classCKeyID.html">CKeyID</a> &address, <a class="code" href="classCPubKey.html">CPubKey</a>& vchPubKeyOut)<span class="keyword"> const</span></div><div class="line"><a name="l00355"></a><span class="lineno"> 355</span> <span class="keyword"></span>{</div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  {</div><div class="line"><a name="l00357"></a><span class="lineno"> 357</span>  <a class="code" href="sync_8h.html#a911fe23f057c2fe5aad629162d6c99d0">LOCK</a>(<a class="code" href="classCKeyStore.html#a386524ff4a00959b81c195cb39fe307d">cs_KeyStore</a>);</div><div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#acc8fed44366c98fb481333ca6e867088">IsCrypted</a>())</div><div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  <span class="keywordflow">return</span> <a class="code" href="classCBasicKeyStore.html#ad22c4b52ef77767df36c4ec70cdd7e23">CBasicKeyStore::GetPubKey</a>(address, vchPubKeyOut);</div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span> </div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span>  CryptedKeyMap::const_iterator mi = <a class="code" href="classCCryptoKeyStore.html#ad1fb9b23eee7a352617209ee2e4f3498">mapCryptedKeys</a>.find(address);</div><div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <span class="keywordflow">if</span> (mi != <a class="code" href="classCCryptoKeyStore.html#ad1fb9b23eee7a352617209ee2e4f3498">mapCryptedKeys</a>.end())</div><div class="line"><a name="l00363"></a><span class="lineno"> 363</span>  {</div><div class="line"><a name="l00364"></a><span class="lineno"> 364</span>  vchPubKeyOut = (*mi).second.first;</div><div class="line"><a name="l00365"></a><span class="lineno"> 365</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00366"></a><span class="lineno"> 366</span>  }</div><div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  <span class="comment">// Check for watch-only pubkeys</span></div><div class="line"><a name="l00368"></a><span class="lineno"> 368</span>  <span class="keywordflow">return</span> <a class="code" href="classCBasicKeyStore.html#ad22c4b52ef77767df36c4ec70cdd7e23">CBasicKeyStore::GetPubKey</a>(address, vchPubKeyOut);</div><div class="line"><a name="l00369"></a><span class="lineno"> 369</span>  }</div><div class="line"><a name="l00370"></a><span class="lineno"> 370</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00371"></a><span class="lineno"> 371</span> }</div><div class="line"><a name="l00372"></a><span class="lineno"> 372</span> </div><div class="line"><a name="l00373"></a><span class="lineno"><a class="line" href="classCCryptoKeyStore.html#a8c0f6b63fb04193df16243c4459b7c61"> 373</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCryptoKeyStore.html#a8c0f6b63fb04193df16243c4459b7c61">CCryptoKeyStore::EncryptKeys</a>(<a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a>& vMasterKeyIn)</div><div class="line"><a name="l00374"></a><span class="lineno"> 374</span> {</div><div class="line"><a name="l00375"></a><span class="lineno"> 375</span>  {</div><div class="line"><a name="l00376"></a><span class="lineno"> 376</span>  <a class="code" href="sync_8h.html#a911fe23f057c2fe5aad629162d6c99d0">LOCK</a>(<a class="code" href="classCKeyStore.html#a386524ff4a00959b81c195cb39fe307d">cs_KeyStore</a>);</div><div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#ad1fb9b23eee7a352617209ee2e4f3498">mapCryptedKeys</a>.empty() || <a class="code" href="classCCryptoKeyStore.html#acc8fed44366c98fb481333ca6e867088">IsCrypted</a>())</div><div class="line"><a name="l00378"></a><span class="lineno"> 378</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00379"></a><span class="lineno"> 379</span> </div><div class="line"><a name="l00380"></a><span class="lineno"> 380</span>  <a class="code" href="classCCryptoKeyStore.html#a78f20a092d0f6e862b15216221d7f38e">fUseCrypto</a> = <span class="keyword">true</span>;</div><div class="line"><a name="l00381"></a><span class="lineno"> 381</span>  BOOST_FOREACH(KeyMap::value_type& mKey, <a class="code" href="classCBasicKeyStore.html#ac520003e5c3d863bf71fde247c6e0672">mapKeys</a>)</div><div class="line"><a name="l00382"></a><span class="lineno"> 382</span>  {</div><div class="line"><a name="l00383"></a><span class="lineno"> 383</span>  <span class="keyword">const</span> <a class="code" href="classCKey.html">CKey</a> &<a class="code" href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">key</a> = mKey.second;</div><div class="line"><a name="l00384"></a><span class="lineno"> 384</span>  <a class="code" href="classCPubKey.html">CPubKey</a> vchPubKey = <a class="code" href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">key</a>.GetPubKey();</div><div class="line"><a name="l00385"></a><span class="lineno"> 385</span>  <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a> vchSecret(<a class="code" href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">key</a>.begin(), <a class="code" href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">key</a>.end());</div><div class="line"><a name="l00386"></a><span class="lineno"> 386</span>  std::vector<unsigned char> vchCryptedSecret;</div><div class="line"><a name="l00387"></a><span class="lineno"> 387</span>  <span class="keywordflow">if</span> (!<a class="code" href="crypter_8cpp.html#ada64a9935b2b07723ad9feb4ce9eccfc">EncryptSecret</a>(vMasterKeyIn, vchSecret, vchPubKey.<a class="code" href="classCPubKey.html#ab1aaa3f6085a3e9bc034d3e1269d870d">GetHash</a>(), vchCryptedSecret))</div><div class="line"><a name="l00388"></a><span class="lineno"> 388</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00389"></a><span class="lineno"> 389</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#a9f4d2df95008205b2b9784c5f0e8e12b">AddCryptedKey</a>(vchPubKey, vchCryptedSecret))</div><div class="line"><a name="l00390"></a><span class="lineno"> 390</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00391"></a><span class="lineno"> 391</span>  }</div><div class="line"><a name="l00392"></a><span class="lineno"> 392</span>  <a class="code" href="classCBasicKeyStore.html#ac520003e5c3d863bf71fde247c6e0672">mapKeys</a>.clear();</div><div class="line"><a name="l00393"></a><span class="lineno"> 393</span>  }</div><div class="line"><a name="l00394"></a><span class="lineno"> 394</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00395"></a><span class="lineno"> 395</span> }</div><div class="line"><a name="l00396"></a><span class="lineno"> 396</span> </div><div class="line"><a name="l00397"></a><span class="lineno"><a class="line" href="classCCryptoKeyStore.html#a3f55c097b0bc9e75c309db4bc1d53a67"> 397</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCryptoKeyStore.html#a3f55c097b0bc9e75c309db4bc1d53a67">CCryptoKeyStore::EncryptHDChain</a>(<span class="keyword">const</span> <a class="code" href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a>& vMasterKeyIn)</div><div class="line"><a name="l00398"></a><span class="lineno"> 398</span> {</div><div class="line"><a name="l00399"></a><span class="lineno"> 399</span>  <span class="comment">// should call EncryptKeys first</span></div><div class="line"><a name="l00400"></a><span class="lineno"> 400</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#acc8fed44366c98fb481333ca6e867088">IsCrypted</a>())</div><div class="line"><a name="l00401"></a><span class="lineno"> 401</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00402"></a><span class="lineno"> 402</span> </div><div class="line"><a name="l00403"></a><span class="lineno"> 403</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a72b48b299ab3d24d46e487d4bc1603b2">IsNull</a>())</div><div class="line"><a name="l00404"></a><span class="lineno"> 404</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00405"></a><span class="lineno"> 405</span> </div><div class="line"><a name="l00406"></a><span class="lineno"> 406</span>  <span class="keywordflow">if</span> (<a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#ab84a980e07cc1722a2db8c800b919b67">IsCrypted</a>())</div><div class="line"><a name="l00407"></a><span class="lineno"> 407</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00408"></a><span class="lineno"> 408</span> </div><div class="line"><a name="l00409"></a><span class="lineno"> 409</span>  <span class="comment">// make sure seed matches this chain</span></div><div class="line"><a name="l00410"></a><span class="lineno"> 410</span>  <span class="keywordflow">if</span> (<a class="code" href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">hdChain</a>.<a class="code" href="classCHDChain.html#a37c75884a3ef7c7ff435aae648c3c6de">GetID</a>() != <a class="code" href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">hdChain</a>.<a class="code" href="classCHDChain.html#a4593a3c0b9eb1918f0c3820f1a54b5f4">GetSeedHash</a>())</div><div class="line"><a name="l00411"></a><span class="lineno"> 411</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00412"></a><span class="lineno"> 412</span> </div><div class="line"><a name="l00413"></a><span class="lineno"> 413</span>  std::vector<unsigned char> vchCryptedSeed;</div><div class="line"><a name="l00414"></a><span class="lineno"> 414</span>  <span class="keywordflow">if</span> (!<a class="code" href="crypter_8cpp.html#ada64a9935b2b07723ad9feb4ce9eccfc">EncryptSecret</a>(vMasterKeyIn, <a class="code" href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">hdChain</a>.<a class="code" href="classCHDChain.html#a3606bfc2be2e89278b11440528141978">GetSeed</a>(), <a class="code" href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">hdChain</a>.<a class="code" href="classCHDChain.html#a37c75884a3ef7c7ff435aae648c3c6de">GetID</a>(), vchCryptedSeed))</div><div class="line"><a name="l00415"></a><span class="lineno"> 415</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00416"></a><span class="lineno"> 416</span> </div><div class="line"><a name="l00417"></a><span class="lineno"> 417</span>  <a class="code" href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">hdChain</a>.<a class="code" href="classCHDChain.html#ada5366bcf86ad715b0e0fed80733e35b">Debug</a>(__func__);</div><div class="line"><a name="l00418"></a><span class="lineno"> 418</span>  <a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a> = <a class="code" href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">hdChain</a>;</div><div class="line"><a name="l00419"></a><span class="lineno"> 419</span>  <a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#aa9bf14ae725c2ba4f568c5793e923619">SetCrypted</a>(<span class="keyword">true</span>);</div><div class="line"><a name="l00420"></a><span class="lineno"> 420</span> </div><div class="line"><a name="l00421"></a><span class="lineno"> 421</span>  <a class="code" href="secure_8h.html#a74df98445c5299c9e987447c7b123e55">SecureVector</a> vchSecureCryptedSeed(vchCryptedSeed.begin(), vchCryptedSeed.end());</div><div class="line"><a name="l00422"></a><span class="lineno"> 422</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a5674417d85794b38fd7ee42911dcce77">SetSeed</a>(vchSecureCryptedSeed, <span class="keyword">false</span>))</div><div class="line"><a name="l00423"></a><span class="lineno"> 423</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00424"></a><span class="lineno"> 424</span> </div><div class="line"><a name="l00425"></a><span class="lineno"> 425</span>  <a class="code" href="secure_8h.html#a74df98445c5299c9e987447c7b123e55">SecureVector</a> vchMnemonic;</div><div class="line"><a name="l00426"></a><span class="lineno"> 426</span>  <a class="code" href="secure_8h.html#a74df98445c5299c9e987447c7b123e55">SecureVector</a> vchMnemonicPassphrase;</div><div class="line"><a name="l00427"></a><span class="lineno"> 427</span> </div><div class="line"><a name="l00428"></a><span class="lineno"> 428</span>  <span class="comment">// it's ok to have no mnemonic if wallet was initialized via hdseed</span></div><div class="line"><a name="l00429"></a><span class="lineno"> 429</span>  <span class="keywordflow">if</span> (<a class="code" href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">hdChain</a>.<a class="code" href="classCHDChain.html#a9a31de15dde57d6fa30b9c98baadd118">GetMnemonic</a>(vchMnemonic, vchMnemonicPassphrase)) {</div><div class="line"><a name="l00430"></a><span class="lineno"> 430</span>  std::vector<unsigned char> vchCryptedMnemonic;</div><div class="line"><a name="l00431"></a><span class="lineno"> 431</span>  std::vector<unsigned char> vchCryptedMnemonicPassphrase;</div><div class="line"><a name="l00432"></a><span class="lineno"> 432</span> </div><div class="line"><a name="l00433"></a><span class="lineno"> 433</span>  <span class="keywordflow">if</span> (!vchMnemonic.empty() && !<a class="code" href="crypter_8cpp.html#ada64a9935b2b07723ad9feb4ce9eccfc">EncryptSecret</a>(vMasterKeyIn, vchMnemonic, <a class="code" href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">hdChain</a>.<a class="code" href="classCHDChain.html#a37c75884a3ef7c7ff435aae648c3c6de">GetID</a>(), vchCryptedMnemonic))</div><div class="line"><a name="l00434"></a><span class="lineno"> 434</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00435"></a><span class="lineno"> 435</span>  <span class="keywordflow">if</span> (!vchMnemonicPassphrase.empty() && !<a class="code" href="crypter_8cpp.html#ada64a9935b2b07723ad9feb4ce9eccfc">EncryptSecret</a>(vMasterKeyIn, vchMnemonicPassphrase, <a class="code" href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">hdChain</a>.<a class="code" href="classCHDChain.html#a37c75884a3ef7c7ff435aae648c3c6de">GetID</a>(), vchCryptedMnemonicPassphrase))</div><div class="line"><a name="l00436"></a><span class="lineno"> 436</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00437"></a><span class="lineno"> 437</span> </div><div class="line"><a name="l00438"></a><span class="lineno"> 438</span>  <a class="code" href="secure_8h.html#a74df98445c5299c9e987447c7b123e55">SecureVector</a> vchSecureCryptedMnemonic(vchCryptedMnemonic.begin(), vchCryptedMnemonic.end());</div><div class="line"><a name="l00439"></a><span class="lineno"> 439</span>  <a class="code" href="secure_8h.html#a74df98445c5299c9e987447c7b123e55">SecureVector</a> vchSecureCryptedMnemonicPassphrase(vchCryptedMnemonicPassphrase.begin(), vchCryptedMnemonicPassphrase.end());</div><div class="line"><a name="l00440"></a><span class="lineno"> 440</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a94873f2f4a63b5cdaf4d22f9714f2fe4">SetMnemonic</a>(vchSecureCryptedMnemonic, vchSecureCryptedMnemonicPassphrase, <span class="keyword">false</span>))</div><div class="line"><a name="l00441"></a><span class="lineno"> 441</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00442"></a><span class="lineno"> 442</span>  }</div><div class="line"><a name="l00443"></a><span class="lineno"> 443</span> </div><div class="line"><a name="l00444"></a><span class="lineno"> 444</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">hdChain</a>.<a class="code" href="classCHDChain.html#ab5b4faac580f27c4d6720bcad9067df5">SetNull</a>())</div><div class="line"><a name="l00445"></a><span class="lineno"> 445</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00446"></a><span class="lineno"> 446</span> </div><div class="line"><a name="l00447"></a><span class="lineno"> 447</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00448"></a><span class="lineno"> 448</span> }</div><div class="line"><a name="l00449"></a><span class="lineno"> 449</span> </div><div class="line"><a name="l00450"></a><span class="lineno"><a class="line" href="classCCryptoKeyStore.html#ac468711074b26df2a6c7fbc3a2cde470"> 450</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCryptoKeyStore.html#ac468711074b26df2a6c7fbc3a2cde470">CCryptoKeyStore::DecryptHDChain</a>(<a class="code" href="classCHDChain.html">CHDChain</a>& hdChainRet)<span class="keyword"> const</span></div><div class="line"><a name="l00451"></a><span class="lineno"> 451</span> <span class="keyword"></span>{</div><div class="line"><a name="l00452"></a><span class="lineno"> 452</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#acc8fed44366c98fb481333ca6e867088">IsCrypted</a>())</div><div class="line"><a name="l00453"></a><span class="lineno"> 453</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00454"></a><span class="lineno"> 454</span> </div><div class="line"><a name="l00455"></a><span class="lineno"> 455</span>  <span class="keywordflow">if</span> (<a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a72b48b299ab3d24d46e487d4bc1603b2">IsNull</a>())</div><div class="line"><a name="l00456"></a><span class="lineno"> 456</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00457"></a><span class="lineno"> 457</span> </div><div class="line"><a name="l00458"></a><span class="lineno"> 458</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#ab84a980e07cc1722a2db8c800b919b67">IsCrypted</a>())</div><div class="line"><a name="l00459"></a><span class="lineno"> 459</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00460"></a><span class="lineno"> 460</span> </div><div class="line"><a name="l00461"></a><span class="lineno"> 461</span>  <a class="code" href="secure_8h.html#a74df98445c5299c9e987447c7b123e55">SecureVector</a> vchSecureSeed;</div><div class="line"><a name="l00462"></a><span class="lineno"> 462</span>  <a class="code" href="secure_8h.html#a74df98445c5299c9e987447c7b123e55">SecureVector</a> vchSecureCryptedSeed = <a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a3606bfc2be2e89278b11440528141978">GetSeed</a>();</div><div class="line"><a name="l00463"></a><span class="lineno"> 463</span>  std::vector<unsigned char> vchCryptedSeed(vchSecureCryptedSeed.begin(), vchSecureCryptedSeed.end());</div><div class="line"><a name="l00464"></a><span class="lineno"> 464</span>  <span class="keywordflow">if</span> (!<a class="code" href="crypter_8cpp.html#aca91610bb6ae114b7d1768ccda008e2a">DecryptSecret</a>(<a class="code" href="classCCryptoKeyStore.html#ac74e458a90ce17a95e238bad724df3fd">vMasterKey</a>, vchCryptedSeed, <a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a37c75884a3ef7c7ff435aae648c3c6de">GetID</a>(), vchSecureSeed))</div><div class="line"><a name="l00465"></a><span class="lineno"> 465</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00466"></a><span class="lineno"> 466</span> </div><div class="line"><a name="l00467"></a><span class="lineno"> 467</span>  hdChainRet = <a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>;</div><div class="line"><a name="l00468"></a><span class="lineno"> 468</span>  <span class="keywordflow">if</span> (!hdChainRet.<a class="code" href="classCHDChain.html#a5674417d85794b38fd7ee42911dcce77">SetSeed</a>(vchSecureSeed, <span class="keyword">false</span>))</div><div class="line"><a name="l00469"></a><span class="lineno"> 469</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00470"></a><span class="lineno"> 470</span> </div><div class="line"><a name="l00471"></a><span class="lineno"> 471</span>  <span class="comment">// hash of decrypted seed must match chain id</span></div><div class="line"><a name="l00472"></a><span class="lineno"> 472</span>  <span class="keywordflow">if</span> (hdChainRet.<a class="code" href="classCHDChain.html#a4593a3c0b9eb1918f0c3820f1a54b5f4">GetSeedHash</a>() != <a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a37c75884a3ef7c7ff435aae648c3c6de">GetID</a>())</div><div class="line"><a name="l00473"></a><span class="lineno"> 473</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00474"></a><span class="lineno"> 474</span> </div><div class="line"><a name="l00475"></a><span class="lineno"> 475</span>  <a class="code" href="secure_8h.html#a74df98445c5299c9e987447c7b123e55">SecureVector</a> vchSecureCryptedMnemonic;</div><div class="line"><a name="l00476"></a><span class="lineno"> 476</span>  <a class="code" href="secure_8h.html#a74df98445c5299c9e987447c7b123e55">SecureVector</a> vchSecureCryptedMnemonicPassphrase;</div><div class="line"><a name="l00477"></a><span class="lineno"> 477</span> </div><div class="line"><a name="l00478"></a><span class="lineno"> 478</span>  <span class="comment">// it's ok to have no mnemonic if wallet was initialized via hdseed</span></div><div class="line"><a name="l00479"></a><span class="lineno"> 479</span>  <span class="keywordflow">if</span> (<a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a9a31de15dde57d6fa30b9c98baadd118">GetMnemonic</a>(vchSecureCryptedMnemonic, vchSecureCryptedMnemonicPassphrase)) {</div><div class="line"><a name="l00480"></a><span class="lineno"> 480</span>  <a class="code" href="secure_8h.html#a74df98445c5299c9e987447c7b123e55">SecureVector</a> vchSecureMnemonic;</div><div class="line"><a name="l00481"></a><span class="lineno"> 481</span>  <a class="code" href="secure_8h.html#a74df98445c5299c9e987447c7b123e55">SecureVector</a> vchSecureMnemonicPassphrase;</div><div class="line"><a name="l00482"></a><span class="lineno"> 482</span> </div><div class="line"><a name="l00483"></a><span class="lineno"> 483</span>  std::vector<unsigned char> vchCryptedMnemonic(vchSecureCryptedMnemonic.begin(), vchSecureCryptedMnemonic.end());</div><div class="line"><a name="l00484"></a><span class="lineno"> 484</span>  std::vector<unsigned char> vchCryptedMnemonicPassphrase(vchSecureCryptedMnemonicPassphrase.begin(), vchSecureCryptedMnemonicPassphrase.end());</div><div class="line"><a name="l00485"></a><span class="lineno"> 485</span> </div><div class="line"><a name="l00486"></a><span class="lineno"> 486</span>  <span class="keywordflow">if</span> (!vchCryptedMnemonic.empty() && !<a class="code" href="crypter_8cpp.html#aca91610bb6ae114b7d1768ccda008e2a">DecryptSecret</a>(<a class="code" href="classCCryptoKeyStore.html#ac74e458a90ce17a95e238bad724df3fd">vMasterKey</a>, vchCryptedMnemonic, <a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a37c75884a3ef7c7ff435aae648c3c6de">GetID</a>(), vchSecureMnemonic))</div><div class="line"><a name="l00487"></a><span class="lineno"> 487</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00488"></a><span class="lineno"> 488</span>  <span class="keywordflow">if</span> (!vchCryptedMnemonicPassphrase.empty() && !<a class="code" href="crypter_8cpp.html#aca91610bb6ae114b7d1768ccda008e2a">DecryptSecret</a>(<a class="code" href="classCCryptoKeyStore.html#ac74e458a90ce17a95e238bad724df3fd">vMasterKey</a>, vchCryptedMnemonicPassphrase, <a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a37c75884a3ef7c7ff435aae648c3c6de">GetID</a>(), vchSecureMnemonicPassphrase))</div><div class="line"><a name="l00489"></a><span class="lineno"> 489</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00490"></a><span class="lineno"> 490</span> </div><div class="line"><a name="l00491"></a><span class="lineno"> 491</span>  <span class="keywordflow">if</span> (!hdChainRet.<a class="code" href="classCHDChain.html#a94873f2f4a63b5cdaf4d22f9714f2fe4">SetMnemonic</a>(vchSecureMnemonic, vchSecureMnemonicPassphrase, <span class="keyword">false</span>))</div><div class="line"><a name="l00492"></a><span class="lineno"> 492</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00493"></a><span class="lineno"> 493</span>  }</div><div class="line"><a name="l00494"></a><span class="lineno"> 494</span> </div><div class="line"><a name="l00495"></a><span class="lineno"> 495</span>  hdChainRet.<a class="code" href="classCHDChain.html#aa9bf14ae725c2ba4f568c5793e923619">SetCrypted</a>(<span class="keyword">false</span>);</div><div class="line"><a name="l00496"></a><span class="lineno"> 496</span>  hdChainRet.<a class="code" href="classCHDChain.html#ada5366bcf86ad715b0e0fed80733e35b">Debug</a>(__func__);</div><div class="line"><a name="l00497"></a><span class="lineno"> 497</span> </div><div class="line"><a name="l00498"></a><span class="lineno"> 498</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00499"></a><span class="lineno"> 499</span> }</div><div class="line"><a name="l00500"></a><span class="lineno"> 500</span> </div><div class="line"><a name="l00501"></a><span class="lineno"><a class="line" href="classCCryptoKeyStore.html#aa83082b7cdde407247666d9fd73dd492"> 501</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCryptoKeyStore.html#aa83082b7cdde407247666d9fd73dd492">CCryptoKeyStore::SetHDChain</a>(<span class="keyword">const</span> <a class="code" href="classCHDChain.html">CHDChain</a>& chain)</div><div class="line"><a name="l00502"></a><span class="lineno"> 502</span> {</div><div class="line"><a name="l00503"></a><span class="lineno"> 503</span>  <span class="keywordflow">if</span> (<a class="code" href="classCCryptoKeyStore.html#acc8fed44366c98fb481333ca6e867088">IsCrypted</a>())</div><div class="line"><a name="l00504"></a><span class="lineno"> 504</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00505"></a><span class="lineno"> 505</span> </div><div class="line"><a name="l00506"></a><span class="lineno"> 506</span>  <span class="keywordflow">if</span> (chain.<a class="code" href="classCHDChain.html#ab84a980e07cc1722a2db8c800b919b67">IsCrypted</a>())</div><div class="line"><a name="l00507"></a><span class="lineno"> 507</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00508"></a><span class="lineno"> 508</span> </div><div class="line"><a name="l00509"></a><span class="lineno"> 509</span>  <a class="code" href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">hdChain</a> = chain;</div><div class="line"><a name="l00510"></a><span class="lineno"> 510</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00511"></a><span class="lineno"> 511</span> }</div><div class="line"><a name="l00512"></a><span class="lineno"> 512</span> </div><div class="line"><a name="l00513"></a><span class="lineno"><a class="line" href="classCCryptoKeyStore.html#a289f2c42d460d338b632ec63aeb06e47"> 513</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCryptoKeyStore.html#a289f2c42d460d338b632ec63aeb06e47">CCryptoKeyStore::SetCryptedHDChain</a>(<span class="keyword">const</span> <a class="code" href="classCHDChain.html">CHDChain</a>& chain)</div><div class="line"><a name="l00514"></a><span class="lineno"> 514</span> {</div><div class="line"><a name="l00515"></a><span class="lineno"> 515</span>  <span class="keywordflow">if</span> (!<a class="code" href="classCCryptoKeyStore.html#af202f587051735be5a39344d9e333720">SetCrypted</a>())</div><div class="line"><a name="l00516"></a><span class="lineno"> 516</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00517"></a><span class="lineno"> 517</span> </div><div class="line"><a name="l00518"></a><span class="lineno"> 518</span>  <span class="keywordflow">if</span> (!chain.<a class="code" href="classCHDChain.html#ab84a980e07cc1722a2db8c800b919b67">IsCrypted</a>())</div><div class="line"><a name="l00519"></a><span class="lineno"> 519</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00520"></a><span class="lineno"> 520</span> </div><div class="line"><a name="l00521"></a><span class="lineno"> 521</span>  <a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a> = chain;</div><div class="line"><a name="l00522"></a><span class="lineno"> 522</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00523"></a><span class="lineno"> 523</span> }</div><div class="line"><a name="l00524"></a><span class="lineno"> 524</span> </div><div class="line"><a name="l00525"></a><span class="lineno"><a class="line" href="classCCryptoKeyStore.html#a3ac809397b8ee98c8f08358481b363ef"> 525</a></span> <span class="keywordtype">bool</span> <a class="code" href="classCCryptoKeyStore.html#a3ac809397b8ee98c8f08358481b363ef">CCryptoKeyStore::GetHDChain</a>(<a class="code" href="classCHDChain.html">CHDChain</a>& hdChainRet)<span class="keyword"> const</span></div><div class="line"><a name="l00526"></a><span class="lineno"> 526</span> <span class="keyword"></span>{</div><div class="line"><a name="l00527"></a><span class="lineno"> 527</span>  <span class="keywordflow">if</span>(<a class="code" href="classCCryptoKeyStore.html#acc8fed44366c98fb481333ca6e867088">IsCrypted</a>()) {</div><div class="line"><a name="l00528"></a><span class="lineno"> 528</span>  hdChainRet = <a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>;</div><div class="line"><a name="l00529"></a><span class="lineno"> 529</span>  <span class="keywordflow">return</span> !<a class="code" href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">cryptedHDChain</a>.<a class="code" href="classCHDChain.html#a72b48b299ab3d24d46e487d4bc1603b2">IsNull</a>();</div><div class="line"><a name="l00530"></a><span class="lineno"> 530</span>  }</div><div class="line"><a name="l00531"></a><span class="lineno"> 531</span> </div><div class="line"><a name="l00532"></a><span class="lineno"> 532</span>  hdChainRet = <a class="code" href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">hdChain</a>;</div><div class="line"><a name="l00533"></a><span class="lineno"> 533</span>  <span class="keywordflow">return</span> !<a class="code" href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">hdChain</a>.<a class="code" href="classCHDChain.html#a72b48b299ab3d24d46e487d4bc1603b2">IsNull</a>();</div><div class="line"><a name="l00534"></a><span class="lineno"> 534</span> }</div><div class="ttc" id="classCCryptoKeyStore_html_acc8fed44366c98fb481333ca6e867088"><div class="ttname"><a href="classCCryptoKeyStore.html#acc8fed44366c98fb481333ca6e867088">CCryptoKeyStore::IsCrypted</a></div><div class="ttdeci">bool IsCrypted() const</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00153">crypter.h:153</a></div></div>
|
|
<div class="ttc" id="classCHDChain_html_ab5b4faac580f27c4d6720bcad9067df5"><div class="ttname"><a href="classCHDChain.html#ab5b4faac580f27c4d6720bcad9067df5">CHDChain::SetNull</a></div><div class="ttdeci">bool SetNull()</div><div class="ttdef"><b>Definition:</b> <a href="hdchain_8cpp_source.html#l00012">hdchain.cpp:12</a></div></div>
|
|
<div class="ttc" id="crypter_8h_html_abf8d5f4eb0b3c828d9fbedb9b2e10b2a"><div class="ttname"><a href="crypter_8h.html#abf8d5f4eb0b3c828d9fbedb9b2e10b2a">WALLET_CRYPTO_KEY_SIZE</a></div><div class="ttdeci">const unsigned int WALLET_CRYPTO_KEY_SIZE</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00014">crypter.h:14</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_ac468711074b26df2a6c7fbc3a2cde470"><div class="ttname"><a href="classCCryptoKeyStore.html#ac468711074b26df2a6c7fbc3a2cde470">CCryptoKeyStore::DecryptHDChain</a></div><div class="ttdeci">bool DecryptHDChain(CHDChain &hdChainRet) const</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00450">crypter.cpp:450</a></div></div>
|
|
<div class="ttc" id="crypter_8cpp_html_a226a32c844661568e96a8e4facdb4804"><div class="ttname"><a href="crypter_8cpp.html#a226a32c844661568e96a8e4facdb4804">EncryptAES256</a></div><div class="ttdeci">bool EncryptAES256(const SecureString &sKey, const SecureString &sPlaintext, const std::string &sIV, std::string &sCiphertext)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00125">crypter.cpp:125</a></div></div>
|
|
<div class="ttc" id="classCCrypter_html_a124fcd3021569a660ce2daa3391c8ea4"><div class="ttname"><a href="classCCrypter.html#a124fcd3021569a660ce2daa3391c8ea4">CCrypter::Encrypt</a></div><div class="ttdeci">bool Encrypt(const CKeyingMaterial &vchPlaintext, std::vector< unsigned char > &vchCiphertext)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00050">crypter.cpp:50</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_a2cd80fec8ff9aa4420e98ca3da8e8d75"><div class="ttname"><a href="classCCryptoKeyStore.html#a2cd80fec8ff9aa4420e98ca3da8e8d75">CCryptoKeyStore::fOnlyMixingAllowed</a></div><div class="ttdeci">bool fOnlyMixingAllowed</div><div class="ttdoc">if fOnlyMixingAllowed is true, only mixing should be allowed in unlocked wallet </div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00133">crypter.h:133</a></div></div>
|
|
<div class="ttc" id="classCHDChain_html_a72b48b299ab3d24d46e487d4bc1603b2"><div class="ttname"><a href="classCHDChain.html#a72b48b299ab3d24d46e487d4bc1603b2">CHDChain::IsNull</a></div><div class="ttdeci">bool IsNull() const</div><div class="ttdef"><b>Definition:</b> <a href="hdchain_8cpp_source.html#l00027">hdchain.cpp:27</a></div></div>
|
|
<div class="ttc" id="classCPubKey_html_ab1aaa3f6085a3e9bc034d3e1269d870d"><div class="ttname"><a href="classCPubKey.html#ab1aaa3f6085a3e9bc034d3e1269d870d">CPubKey::GetHash</a></div><div class="ttdeci">uint256 GetHash() const</div><div class="ttdoc">Get the 256-bit hash of this public key. </div><div class="ttdef"><b>Definition:</b> <a href="pubkey_8h_source.html#l00150">pubkey.h:150</a></div></div>
|
|
<div class="ttc" id="classCHDChain_html_a9a31de15dde57d6fa30b9c98baadd118"><div class="ttname"><a href="classCHDChain.html#a9a31de15dde57d6fa30b9c98baadd118">CHDChain::GetMnemonic</a></div><div class="ttdeci">bool GetMnemonic(SecureVector &vchMnemonicRet, SecureVector &vchMnemonicPassphraseRet) const</div><div class="ttdef"><b>Definition:</b> <a href="hdchain_8cpp_source.html#l00107">hdchain.cpp:107</a></div></div>
|
|
<div class="ttc" id="classCCrypter_html_a11ec47962b8d46116877957726aeb291"><div class="ttname"><a href="classCCrypter.html#a11ec47962b8d46116877957726aeb291">CCrypter::chKey</a></div><div class="ttdeci">unsigned char chKey[WALLET_CRYPTO_KEY_SIZE]</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00073">crypter.h:73</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_a340109b8673267676a34664a76ed3274"><div class="ttname"><a href="classCCryptoKeyStore.html#a340109b8673267676a34664a76ed3274">CCryptoKeyStore::AddKeyPubKey</a></div><div class="ttdeci">bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey)</div><div class="ttdoc">Add a key to the store. </div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00302">crypter.cpp:302</a></div></div>
|
|
<div class="ttc" id="secure_8h_html_a396ed773a5ac24aec28c8f7dc413c7ac"><div class="ttname"><a href="secure_8h.html#a396ed773a5ac24aec28c8f7dc413c7ac">SecureString</a></div><div class="ttdeci">std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString</div><div class="ttdef"><b>Definition:</b> <a href="secure_8h_source.html#l00061">secure.h:61</a></div></div>
|
|
<div class="ttc" id="classCHDChain_html_a3606bfc2be2e89278b11440528141978"><div class="ttname"><a href="classCHDChain.html#a3606bfc2be2e89278b11440528141978">CHDChain::GetSeed</a></div><div class="ttdeci">SecureVector GetSeed() const</div><div class="ttdef"><b>Definition:</b> <a href="hdchain_8cpp_source.html#l00141">hdchain.cpp:141</a></div></div>
|
|
<div class="ttc" id="keystore_8h_html_a64709c9a3acc8f5694515789a183ad7b"><div class="ttname"><a href="keystore_8h.html#a64709c9a3acc8f5694515789a183ad7b">CKeyingMaterial</a></div><div class="ttdeci">std::vector< unsigned char, secure_allocator< unsigned char > > CKeyingMaterial</div><div class="ttdef"><b>Definition:</b> <a href="keystore_8h_source.html#l00116">keystore.h:116</a></div></div>
|
|
<div class="ttc" id="classCKeyID_html"><div class="ttname"><a href="classCKeyID.html">CKeyID</a></div><div class="ttdef"><b>Definition:</b> <a href="pubkey_8h_source.html#l00027">pubkey.h:27</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_ad1fb9b23eee7a352617209ee2e4f3498"><div class="ttname"><a href="classCCryptoKeyStore.html#ad1fb9b23eee7a352617209ee2e4f3498">CCryptoKeyStore::mapCryptedKeys</a></div><div class="ttdeci">CryptedKeyMap mapCryptedKeys</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00120">crypter.h:120</a></div></div>
|
|
<div class="ttc" id="classCCrypter_html_a5368279e4a1549d3c1d15d8aa2179708"><div class="ttname"><a href="classCCrypter.html#a5368279e4a1549d3c1d15d8aa2179708">CCrypter::SetKeyFromPassphrase</a></div><div class="ttdeci">bool SetKeyFromPassphrase(const SecureString &strKeyData, const std::vector< unsigned char > &chSalt, const unsigned int nRounds, const unsigned int nDerivationMethod)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00017">crypter.cpp:17</a></div></div>
|
|
<div class="ttc" id="crypter_8cpp_html_a706e11496e7a89bd65def6cce072ca77"><div class="ttname"><a href="crypter_8cpp.html#a706e11496e7a89bd65def6cce072ca77">DecryptKey</a></div><div class="ttdeci">static bool DecryptKey(const CKeyingMaterial &vMasterKey, const std::vector< unsigned char > &vchCryptedSecret, const CPubKey &vchPubKey, CKey &key)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00209">crypter.cpp:209</a></div></div>
|
|
<div class="ttc" id="classCCrypter_html_a4a1485fd00acb8424cfef256c78ac176"><div class="ttname"><a href="classCCrypter.html#a4a1485fd00acb8424cfef256c78ac176">CCrypter::fKeySet</a></div><div class="ttdeci">bool fKeySet</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00075">crypter.h:75</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_af46ec271fffb65a113702ba40a3738c8"><div class="ttname"><a href="classCCryptoKeyStore.html#af46ec271fffb65a113702ba40a3738c8">CCryptoKeyStore::GetKey</a></div><div class="ttdeci">bool GetKey(const CKeyID &address, CKey &keyOut) const</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00336">crypter.cpp:336</a></div></div>
|
|
<div class="ttc" id="classCHDChain_html"><div class="ttname"><a href="classCHDChain.html">CHDChain</a></div><div class="ttdef"><b>Definition:</b> <a href="hdchain_8h_source.html#l00028">hdchain.h:28</a></div></div>
|
|
<div class="ttc" id="script_8h_html"><div class="ttname"><a href="script_8h.html">script.h</a></div></div>
|
|
<div class="ttc" id="crypter_8cpp_html_ae8eca4e4f0534b828d8a2a549536c762"><div class="ttname"><a href="crypter_8cpp.html#ae8eca4e4f0534b828d8a2a549536c762">DecryptAES256</a></div><div class="ttdeci">bool DecryptAES256(const SecureString &sKey, const std::string &sCiphertext, const std::string &sIV, SecureString &sPlaintext)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00174">crypter.cpp:174</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_a78f20a092d0f6e862b15216221d7f38e"><div class="ttname"><a href="classCCryptoKeyStore.html#a78f20a092d0f6e862b15216221d7f38e">CCryptoKeyStore::fUseCrypto</a></div><div class="ttdeci">bool fUseCrypto</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00127">crypter.h:127</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_aa83082b7cdde407247666d9fd73dd492"><div class="ttname"><a href="classCCryptoKeyStore.html#aa83082b7cdde407247666d9fd73dd492">CCryptoKeyStore::SetHDChain</a></div><div class="ttdeci">bool SetHDChain(const CHDChain &chain)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00501">crypter.cpp:501</a></div></div>
|
|
<div class="ttc" id="classCPubKey_html_a2675f7e6f72eff68e7a5227289feb021"><div class="ttname"><a href="classCPubKey.html#a2675f7e6f72eff68e7a5227289feb021">CPubKey::GetID</a></div><div class="ttdeci">CKeyID GetID() const</div><div class="ttdoc">Get the KeyID of this public key (hash of its serialization) </div><div class="ttdef"><b>Definition:</b> <a href="pubkey_8h_source.html#l00144">pubkey.h:144</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_a20b474adfe6900bb36cd4fd6f9c31380"><div class="ttname"><a href="classCCryptoKeyStore.html#a20b474adfe6900bb36cd4fd6f9c31380">CCryptoKeyStore::GetPubKey</a></div><div class="ttdeci">bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00354">crypter.cpp:354</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_a3ac809397b8ee98c8f08358481b363ef"><div class="ttname"><a href="classCCryptoKeyStore.html#a3ac809397b8ee98c8f08358481b363ef">CCryptoKeyStore::GetHDChain</a></div><div class="ttdeci">bool GetHDChain(CHDChain &hdChainRet) const</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00525">crypter.cpp:525</a></div></div>
|
|
<div class="ttc" id="classCCrypter_html_a4d7a740fe37b389b9ec8447d193bcfc7"><div class="ttname"><a href="classCCrypter.html#a4d7a740fe37b389b9ec8447d193bcfc7">CCrypter::chIV</a></div><div class="ttdeci">unsigned char chIV[WALLET_CRYPTO_KEY_SIZE]</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00074">crypter.h:74</a></div></div>
|
|
<div class="ttc" id="classCBasicKeyStore_html_a69328ee642e4234922356f59876e956d"><div class="ttname"><a href="classCBasicKeyStore.html#a69328ee642e4234922356f59876e956d">CBasicKeyStore::GetKey</a></div><div class="ttdeci">bool GetKey(const CKeyID &address, CKey &keyOut) const</div><div class="ttdef"><b>Definition:</b> <a href="keystore_8h_source.html#l00091">keystore.h:91</a></div></div>
|
|
<div class="ttc" id="cleanse_8cpp_html_a5a4afb85dd16ecc1f6019c782db78663"><div class="ttname"><a href="cleanse_8cpp.html#a5a4afb85dd16ecc1f6019c782db78663">memory_cleanse</a></div><div class="ttdeci">void memory_cleanse(void *ptr, size_t len)</div><div class="ttdef"><b>Definition:</b> <a href="cleanse_8cpp_source.html#l00010">cleanse.cpp:10</a></div></div>
|
|
<div class="ttc" id="classCCrypter_html"><div class="ttname"><a href="classCCrypter.html">CCrypter</a></div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00070">crypter.h:70</a></div></div>
|
|
<div class="ttc" id="util_8h_html_afc02c0a4258fedfb316be612bb659ba8"><div class="ttname"><a href="util_8h.html#afc02c0a4258fedfb316be612bb659ba8">LogPrintf</a></div><div class="ttdeci">#define LogPrintf(...)</div><div class="ttdef"><b>Definition:</b> <a href="util_8h_source.html#l00098">util.h:98</a></div></div>
|
|
<div class="ttc" id="classCBasicKeyStore_html_ad22c4b52ef77767df36c4ec70cdd7e23"><div class="ttname"><a href="classCBasicKeyStore.html#ad22c4b52ef77767df36c4ec70cdd7e23">CBasicKeyStore::GetPubKey</a></div><div class="ttdeci">bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const</div><div class="ttdef"><b>Definition:</b> <a href="keystore_8cpp_source.html#l00018">keystore.cpp:18</a></div></div>
|
|
<div class="ttc" id="classCHDChain_html_ab84a980e07cc1722a2db8c800b919b67"><div class="ttname"><a href="classCHDChain.html#ab84a980e07cc1722a2db8c800b919b67">CHDChain::IsCrypted</a></div><div class="ttdeci">bool IsCrypted() const</div><div class="ttdef"><b>Definition:</b> <a href="hdchain_8cpp_source.html#l00037">hdchain.cpp:37</a></div></div>
|
|
<div class="ttc" id="classCKeyStore_html_a386524ff4a00959b81c195cb39fe307d"><div class="ttname"><a href="classCKeyStore.html#a386524ff4a00959b81c195cb39fe307d">CKeyStore::cs_KeyStore</a></div><div class="ttdeci">CCriticalSection cs_KeyStore</div><div class="ttdef"><b>Definition:</b> <a href="keystore_8h_source.html#l00023">keystore.h:23</a></div></div>
|
|
<div class="ttc" id="sync_8h_html_a911fe23f057c2fe5aad629162d6c99d0"><div class="ttname"><a href="sync_8h.html#a911fe23f057c2fe5aad629162d6c99d0">LOCK</a></div><div class="ttdeci">#define LOCK(cs)</div><div class="ttdef"><b>Definition:</b> <a href="sync_8h_source.html#l00168">sync.h:168</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_aa4b09072f1b75ccceda5ebc924408804"><div class="ttname"><a href="classCCryptoKeyStore.html#aa4b09072f1b75ccceda5ebc924408804">CCryptoKeyStore::cryptedHDChain</a></div><div class="ttdeci">CHDChain cryptedHDChain</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00121">crypter.h:121</a></div></div>
|
|
<div class="ttc" id="tests_8c_html_a06a3e29ada83211a695a49e8f7405842"><div class="ttname"><a href="tests_8c.html#a06a3e29ada83211a695a49e8f7405842">ctx</a></div><div class="ttdeci">static secp256k1_context * ctx</div><div class="ttdef"><b>Definition:</b> <a href="tests_8c_source.html#l00042">tests.c:42</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_a251b9ed228a19ab39d542985b425fc85"><div class="ttname"><a href="classCCryptoKeyStore.html#a251b9ed228a19ab39d542985b425fc85">CCryptoKeyStore::NotifyStatusChanged</a></div><div class="ttdeci">boost::signals2::signal< void(CCryptoKeyStore *wallet)> NotifyStatusChanged</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00225">crypter.h:225</a></div></div>
|
|
<div class="ttc" id="secure_8h_html_a74df98445c5299c9e987447c7b123e55"><div class="ttname"><a href="secure_8h.html#a74df98445c5299c9e987447c7b123e55">SecureVector</a></div><div class="ttdeci">std::vector< unsigned char, secure_allocator< unsigned char > > SecureVector</div><div class="ttdef"><b>Definition:</b> <a href="secure_8h_source.html#l00063">secure.h:63</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_af9a5bd9adc6d09c3eddbf81e71237994"><div class="ttname"><a href="classCCryptoKeyStore.html#af9a5bd9adc6d09c3eddbf81e71237994">CCryptoKeyStore::IsLocked</a></div><div class="ttdeci">bool IsLocked(bool fForMixing=false) const</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00166">crypter.h:166</a></div></div>
|
|
<div class="ttc" id="classCCrypter_html_a0d948dd4796e2420e1dd9c1ddbf7974e"><div class="ttname"><a href="classCCrypter.html#a0d948dd4796e2420e1dd9c1ddbf7974e">CCrypter::SetKey</a></div><div class="ttdeci">bool SetKey(const CKeyingMaterial &chNewKey, const std::vector< unsigned char > &chNewIV)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00038">crypter.cpp:38</a></div></div>
|
|
<div class="ttc" id="classCBasicKeyStore_html_ac520003e5c3d863bf71fde247c6e0672"><div class="ttname"><a href="classCBasicKeyStore.html#ac520003e5c3d863bf71fde247c6e0672">CBasicKeyStore::mapKeys</a></div><div class="ttdeci">KeyMap mapKeys</div><div class="ttdef"><b>Definition:</b> <a href="keystore_8h_source.html#l00059">keystore.h:59</a></div></div>
|
|
<div class="ttc" id="crypter_8cpp_html_aca91610bb6ae114b7d1768ccda008e2a"><div class="ttname"><a href="crypter_8cpp.html#aca91610bb6ae114b7d1768ccda008e2a">DecryptSecret</a></div><div class="ttdeci">static bool DecryptSecret(const CKeyingMaterial &vMasterKey, const std::vector< unsigned char > &vchCiphertext, const uint256 &nIV, CKeyingMaterial &vchPlaintext)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00164">crypter.cpp:164</a></div></div>
|
|
<div class="ttc" id="classCCrypter_html_a4dbabed4975d4435d22c76deac43df7f"><div class="ttname"><a href="classCCrypter.html#a4dbabed4975d4435d22c76deac43df7f">CCrypter::Decrypt</a></div><div class="ttdeci">bool Decrypt(const std::vector< unsigned char > &vchCiphertext, CKeyingMaterial &vchPlaintext)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00081">crypter.cpp:81</a></div></div>
|
|
<div class="ttc" id="classCHDChain_html_aa9bf14ae725c2ba4f568c5793e923619"><div class="ttname"><a href="classCHDChain.html#aa9bf14ae725c2ba4f568c5793e923619">CHDChain::SetCrypted</a></div><div class="ttdeci">void SetCrypted(bool fCryptedIn)</div><div class="ttdef"><b>Definition:</b> <a href="hdchain_8cpp_source.html#l00032">hdchain.cpp:32</a></div></div>
|
|
<div class="ttc" id="classuint256_html"><div class="ttname"><a href="classuint256.html">uint256</a></div><div class="ttdef"><b>Definition:</b> <a href="uint256_8h_source.html#l00114">uint256.h:114</a></div></div>
|
|
<div class="ttc" id="crypter_8h_html_aa42a9547c4738b8f92fd88016c5184a0"><div class="ttname"><a href="crypter_8h.html#aa42a9547c4738b8f92fd88016c5184a0">WALLET_CRYPTO_SALT_SIZE</a></div><div class="ttdeci">const unsigned int WALLET_CRYPTO_SALT_SIZE</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00015">crypter.h:15</a></div></div>
|
|
<div class="ttc" id="classCHDChain_html_a37c75884a3ef7c7ff435aae648c3c6de"><div class="ttname"><a href="classCHDChain.html#a37c75884a3ef7c7ff435aae648c3c6de">CHDChain::GetID</a></div><div class="ttdeci">uint256 GetID() const</div><div class="ttdef"><b>Definition:</b> <a href="hdchain_8h_source.html#l00111">hdchain.h:111</a></div></div>
|
|
<div class="ttc" id="crypter_8h_html"><div class="ttname"><a href="crypter_8h.html">crypter.h</a></div></div>
|
|
<div class="ttc" id="classCPubKey_html_a25f8b70340ad20ddab0f80ec4cee9396"><div class="ttname"><a href="classCPubKey.html#a25f8b70340ad20ddab0f80ec4cee9396">CPubKey::IsCompressed</a></div><div class="ttdeci">bool IsCompressed() const</div><div class="ttdoc">Check whether this is a compressed public key. </div><div class="ttdef"><b>Definition:</b> <a href="pubkey_8h_source.html#l00169">pubkey.h:169</a></div></div>
|
|
<div class="ttc" id="glibc__compat_8cpp_html_a0f46826ab0466591e136db24394923cf"><div class="ttname"><a href="glibc__compat_8cpp.html#a0f46826ab0466591e136db24394923cf">memcpy</a></div><div class="ttdeci">void * memcpy(void *a, const void *b, size_t c)</div><div class="ttdef"><b>Definition:</b> <a href="glibc__compat_8cpp_source.html#l00017">glibc_compat.cpp:17</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_a0717bc91b52f267df77e61870211ca62"><div class="ttname"><a href="classCCryptoKeyStore.html#a0717bc91b52f267df77e61870211ca62">CCryptoKeyStore::Unlock</a></div><div class="ttdeci">bool Unlock(const CKeyingMaterial &vMasterKeyIn, bool fForMixingOnly=false)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00248">crypter.cpp:248</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_a1973070a17085d994a194e6dc1b4b293"><div class="ttname"><a href="classCCryptoKeyStore.html#a1973070a17085d994a194e6dc1b4b293">CCryptoKeyStore::Lock</a></div><div class="ttdeci">bool Lock(bool fAllowMixing=false)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00233">crypter.cpp:233</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_a3f55c097b0bc9e75c309db4bc1d53a67"><div class="ttname"><a href="classCCryptoKeyStore.html#a3f55c097b0bc9e75c309db4bc1d53a67">CCryptoKeyStore::EncryptHDChain</a></div><div class="ttdeci">bool EncryptHDChain(const CKeyingMaterial &vMasterKeyIn)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00397">crypter.cpp:397</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_af202f587051735be5a39344d9e333720"><div class="ttname"><a href="classCCryptoKeyStore.html#af202f587051735be5a39344d9e333720">CCryptoKeyStore::SetCrypted</a></div><div class="ttdeci">bool SetCrypted()</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00222">crypter.cpp:222</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_a9f4d2df95008205b2b9784c5f0e8e12b"><div class="ttname"><a href="classCCryptoKeyStore.html#a9f4d2df95008205b2b9784c5f0e8e12b">CCryptoKeyStore::AddCryptedKey</a></div><div class="ttdeci">virtual bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00324">crypter.cpp:324</a></div></div>
|
|
<div class="ttc" id="classCPubKey_html"><div class="ttname"><a href="classCPubKey.html">CPubKey</a></div><div class="ttdef"><b>Definition:</b> <a href="pubkey_8h_source.html#l00037">pubkey.h:37</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_ac74e458a90ce17a95e238bad724df3fd"><div class="ttname"><a href="classCCryptoKeyStore.html#ac74e458a90ce17a95e238bad724df3fd">CCryptoKeyStore::vMasterKey</a></div><div class="ttdeci">CKeyingMaterial vMasterKey</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00123">crypter.h:123</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_a46872ff611730d228f7d1a92c1d8526e"><div class="ttname"><a href="classCCryptoKeyStore.html#a46872ff611730d228f7d1a92c1d8526e">CCryptoKeyStore::fDecryptionThoroughlyChecked</a></div><div class="ttdeci">bool fDecryptionThoroughlyChecked</div><div class="ttdoc">keeps track of whether Unlock has run a thorough check before </div><div class="ttdef"><b>Definition:</b> <a href="crypter_8h_source.html#l00130">crypter.h:130</a></div></div>
|
|
<div class="ttc" id="classCHDChain_html_a94873f2f4a63b5cdaf4d22f9714f2fe4"><div class="ttname"><a href="classCHDChain.html#a94873f2f4a63b5cdaf4d22f9714f2fe4">CHDChain::SetMnemonic</a></div><div class="ttdeci">bool SetMnemonic(const SecureVector &vchMnemonic, const SecureVector &vchMnemonicPassphrase, bool fUpdateID)</div><div class="ttdef"><b>Definition:</b> <a href="hdchain_8cpp_source.html#l00072">hdchain.cpp:72</a></div></div>
|
|
<div class="ttc" id="classCHDChain_html_a5674417d85794b38fd7ee42911dcce77"><div class="ttname"><a href="classCHDChain.html#a5674417d85794b38fd7ee42911dcce77">CHDChain::SetSeed</a></div><div class="ttdeci">bool SetSeed(const SecureVector &vchSeedIn, bool fUpdateID)</div><div class="ttdef"><b>Definition:</b> <a href="hdchain_8cpp_source.html#l00130">hdchain.cpp:130</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_a289f2c42d460d338b632ec63aeb06e47"><div class="ttname"><a href="classCCryptoKeyStore.html#a289f2c42d460d338b632ec63aeb06e47">CCryptoKeyStore::SetCryptedHDChain</a></div><div class="ttdeci">bool SetCryptedHDChain(const CHDChain &chain)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00513">crypter.cpp:513</a></div></div>
|
|
<div class="ttc" id="classCKey_html"><div class="ttname"><a href="classCKey.html">CKey</a></div><div class="ttdef"><b>Definition:</b> <a href="key_8h_source.html#l00035">key.h:35</a></div></div>
|
|
<div class="ttc" id="classCBasicKeyStore_html_acc2e33f319de88e88f86b0dc79bdcb65"><div class="ttname"><a href="classCBasicKeyStore.html#acc2e33f319de88e88f86b0dc79bdcb65">CBasicKeyStore::AddKeyPubKey</a></div><div class="ttdeci">bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey)</div><div class="ttdoc">Add a key to the store. </div><div class="ttdef"><b>Definition:</b> <a href="keystore_8cpp_source.html#l00034">keystore.cpp:34</a></div></div>
|
|
<div class="ttc" id="classCBasicKeyStore_html_a5706be85f1e813cf0490b21c65bf2323"><div class="ttname"><a href="classCBasicKeyStore.html#a5706be85f1e813cf0490b21c65bf2323">CBasicKeyStore::hdChain</a></div><div class="ttdeci">CHDChain hdChain</div><div class="ttdef"><b>Definition:</b> <a href="keystore_8h_source.html#l00064">keystore.h:64</a></div></div>
|
|
<div class="ttc" id="standard_8h_html"><div class="ttname"><a href="standard_8h.html">standard.h</a></div></div>
|
|
<div class="ttc" id="namespaceextract__strings__qt_html_a1b7a78cde0039f63310f11692b713dca"><div class="ttname"><a href="namespaceextract__strings__qt.html#a1b7a78cde0039f63310f11692b713dca">extract_strings_qt.key</a></div><div class="ttdeci">key</div><div class="ttdef"><b>Definition:</b> <a href="extract__strings__qt_8py_source.html#l00073">extract_strings_qt.py:73</a></div></div>
|
|
<div class="ttc" id="classCCryptoKeyStore_html_a8c0f6b63fb04193df16243c4459b7c61"><div class="ttname"><a href="classCCryptoKeyStore.html#a8c0f6b63fb04193df16243c4459b7c61">CCryptoKeyStore::EncryptKeys</a></div><div class="ttdeci">bool EncryptKeys(CKeyingMaterial &vMasterKeyIn)</div><div class="ttdoc">will encrypt previously unencrypted keys </div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00373">crypter.cpp:373</a></div></div>
|
|
<div class="ttc" id="crypter_8cpp_html_ada64a9935b2b07723ad9feb4ce9eccfc"><div class="ttname"><a href="crypter_8cpp.html#ada64a9935b2b07723ad9feb4ce9eccfc">EncryptSecret</a></div><div class="ttdeci">static bool EncryptSecret(const CKeyingMaterial &vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256 &nIV, std::vector< unsigned char > &vchCiphertext)</div><div class="ttdef"><b>Definition:</b> <a href="crypter_8cpp_source.html#l00113">crypter.cpp:113</a></div></div>
|
|
<div class="ttc" id="classCHDChain_html_ada5366bcf86ad715b0e0fed80733e35b"><div class="ttname"><a href="classCHDChain.html#ada5366bcf86ad715b0e0fed80733e35b">CHDChain::Debug</a></div><div class="ttdeci">void Debug(std::string strName) const</div><div class="ttdef"><b>Definition:</b> <a href="hdchain_8cpp_source.html#l00042">hdchain.cpp:42</a></div></div>
|
|
<div class="ttc" id="classCHDChain_html_a4593a3c0b9eb1918f0c3820f1a54b5f4"><div class="ttname"><a href="classCHDChain.html#a4593a3c0b9eb1918f0c3820f1a54b5f4">CHDChain::GetSeedHash</a></div><div class="ttdeci">uint256 GetSeedHash()</div><div class="ttdef"><b>Definition:</b> <a href="hdchain_8cpp_source.html#l00146">hdchain.cpp:146</a></div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_e91c81f9be83f649fcd1d8691438a113.html">wallet</a></li><li class="navelem"><a class="el" href="crypter_8cpp.html">crypter.cpp</a></li>
|
|
<li class="footer">Generated on Thu Dec 14 2017 13:15:09 for Dash Core by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|