MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / EncryptSecret

Function EncryptSecret

src/wallet/crypter.cpp:105–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103
104
105static bool EncryptSecret(const CKeyingMaterial& vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256& nIV, std::vector<unsigned char> &vchCiphertext)
106{
107 CCrypter cKeyCrypter;
108 std::vector<unsigned char> chIV(WALLET_CRYPTO_KEY_SIZE);
109 memcpy(&chIV[0], &nIV, WALLET_CRYPTO_KEY_SIZE);
110 if(!cKeyCrypter.SetKey(vMasterKey, chIV))
111 return false;
112 return cKeyCrypter.Encrypt(*((const CKeyingMaterial*)&vchPlaintext), vchCiphertext);
113}
114
115static bool DecryptSecret(const CKeyingMaterial& vMasterKey, const std::vector<unsigned char>& vchCiphertext, const uint256& nIV, CKeyingMaterial& vchPlaintext)
116{

Callers 2

AddKeyPubKeyMethod · 0.85
BOOST_FOREACHFunction · 0.85

Calls 3

memcpyFunction · 0.85
EncryptMethod · 0.80
SetKeyMethod · 0.45

Tested by

no test coverage detected