MCPcopy Create free account
hub / github.com/ElementsProject/elements / EncryptSecret

Function EncryptSecret

src/wallet/crypter.cpp:108–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108bool EncryptSecret(const CKeyingMaterial& vMasterKey, const CKeyingMaterial &vchPlaintext, const uint256& nIV, std::vector<unsigned char> &vchCiphertext)
109{
110 CCrypter cKeyCrypter;
111 std::vector<unsigned char> chIV(WALLET_CRYPTO_IV_SIZE);
112 memcpy(chIV.data(), &nIV, WALLET_CRYPTO_IV_SIZE);
113 if(!cKeyCrypter.SetKey(vMasterKey, chIV))
114 return false;
115 return cKeyCrypter.Encrypt(*((const CKeyingMaterial*)&vchPlaintext), vchCiphertext);
116}
117
118bool DecryptSecret(const CKeyingMaterial& vMasterKey, const std::vector<unsigned char>& vchCiphertext, const uint256& nIV, CKeyingMaterial& vchPlaintext)
119{

Callers 3

EncryptMethod · 0.85
AddKeyPubKeyInnerMethod · 0.85

Calls 3

dataMethod · 0.45
SetKeyMethod · 0.45
EncryptMethod · 0.45

Tested by

no test coverage detected