Fix crypto implementation compilation errors
This commit is contained in:
@@ -77,7 +77,7 @@ std::vector<unsigned char> Crypto::decrypt(const std::vector<unsigned char>& cip
|
|||||||
std::vector<unsigned char> plaintext(ciphertext.size());
|
std::vector<unsigned char> plaintext(ciphertext.size());
|
||||||
|
|
||||||
// Perform decryption and authentication
|
// Perform decryption and authentication
|
||||||
DecryptionResult result = decryption.DecryptAndVerify(
|
bool valid = decryption.DecryptAndVerify(
|
||||||
plaintext.data(),
|
plaintext.data(),
|
||||||
auth_tag.data(),
|
auth_tag.data(),
|
||||||
auth_tag.size(),
|
auth_tag.size(),
|
||||||
@@ -89,13 +89,10 @@ std::vector<unsigned char> Crypto::decrypt(const std::vector<unsigned char>& cip
|
|||||||
ciphertext.size()
|
ciphertext.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
if(!result.isValidCoding) {
|
if(!valid) {
|
||||||
throw std::runtime_error("Authentication failed during decryption");
|
throw std::runtime_error("Authentication failed during decryption");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize to actual plaintext size
|
|
||||||
plaintext.resize(result.messageLength);
|
|
||||||
|
|
||||||
return plaintext;
|
return plaintext;
|
||||||
}
|
}
|
||||||
catch(const Exception& e) {
|
catch(const Exception& e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user