@@ -37,7 +37,7 @@ bool CCrypter::SetKeyFromPassphrase(const SecureString& strKeyData, const std::v
3737
3838bool CCrypter::SetKey (const CKeyingMaterial& chNewKey, const std::vector<unsigned char >& chNewIV)
3939{
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 )
4141 return false ;
4242
4343 memcpy (&chKey[0 ], &chNewKey[0 ], sizeof chKey);
@@ -105,8 +105,8 @@ bool CCrypter::Decrypt(const std::vector<unsigned char>& vchCiphertext, CKeyingM
105105static bool EncryptSecret (const CKeyingMaterial& vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256& nIV, std::vector<unsigned char > &vchCiphertext)
106106{
107107 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 );
110110 if (!cKeyCrypter.SetKey (vMasterKey, chIV))
111111 return false ;
112112 return cKeyCrypter.Encrypt (*((const CKeyingMaterial*)&vchPlaintext), vchCiphertext);
@@ -115,8 +115,8 @@ static bool EncryptSecret(const CKeyingMaterial& vMasterKey, const CKeyingMateri
115115static bool DecryptSecret (const CKeyingMaterial& vMasterKey, const std::vector<unsigned char >& vchCiphertext, const uint256& nIV, CKeyingMaterial& vchPlaintext)
116116{
117117 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 );
120120 if (!cKeyCrypter.SetKey (vMasterKey, chIV))
121121 return false ;
122122 return cKeyCrypter.Decrypt (vchCiphertext, *((CKeyingMaterial*)&vchPlaintext));
0 commit comments