@@ -37,7 +37,7 @@ bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::v
37
37
38
38
bool CCrypter::SetKey (const CKeyingMaterial& chNewKey, const std::vector<unsigned char >& chNewIV)
39
39
{
40
- if (chNewKey.size () != WALLET_CRYPTO_KEY_SIZE || chNewIV.size () != WALLET_CRYPTO_KEY_SIZE )
40
+ if (chNewKey.size () != WALLET_CRYPTO_KEY_SIZE || chNewIV.size () != WALLET_CRYPTO_IV_SIZE )
41
41
return false ;
42
42
43
43
memcpy (&chKey[0 ], &chNewKey[0 ], sizeof chKey);
@@ -105,8 +105,8 @@ bool CCrypter::Decrypt(const std::vector<unsigned char>& vchCiphertext, CKeyingM
105
105
static bool EncryptSecret (const CKeyingMaterial& vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256& nIV, std::vector<unsigned char > &vchCiphertext)
106
106
{
107
107
CCrypter cKeyCrypter;
108
- std::vector<unsigned char > chIV (WALLET_CRYPTO_KEY_SIZE );
109
- memcpy (&chIV[0 ], &nIV, WALLET_CRYPTO_KEY_SIZE );
108
+ std::vector<unsigned char > chIV (WALLET_CRYPTO_IV_SIZE );
109
+ memcpy (&chIV[0 ], &nIV, WALLET_CRYPTO_IV_SIZE );
110
110
if (!cKeyCrypter.SetKey (vMasterKey, chIV))
111
111
return false ;
112
112
return cKeyCrypter.Encrypt (*((const CKeyingMaterial*)&vchPlaintext), vchCiphertext);
@@ -115,8 +115,8 @@ static bool EncryptSecret(const CKeyingMaterial& vMasterKey, const CKeyingMateri
115
115
static bool DecryptSecret (const CKeyingMaterial& vMasterKey, const std::vector<unsigned char >& vchCiphertext, const uint256& nIV, CKeyingMaterial& vchPlaintext)
116
116
{
117
117
CCrypter cKeyCrypter;
118
- std::vector<unsigned char > chIV (WALLET_CRYPTO_KEY_SIZE );
119
- memcpy (&chIV[0 ], &nIV, WALLET_CRYPTO_KEY_SIZE );
118
+ std::vector<unsigned char > chIV (WALLET_CRYPTO_IV_SIZE );
119
+ memcpy (&chIV[0 ], &nIV, WALLET_CRYPTO_IV_SIZE );
120
120
if (!cKeyCrypter.SetKey (vMasterKey, chIV))
121
121
return false ;
122
122
return cKeyCrypter.Decrypt (vchCiphertext, *((CKeyingMaterial*)&vchPlaintext));
0 commit comments