converta o código crypto++ em botan3 int Cps::NormalUncompress(uint8_t* dest, uint32_t*…
- User
converta o código crypto++ em botan3
int Cps::NormalUncompress(uint8_t* dest, uint32_t* destLen, const uint8_t* source, uint32_t sourceLen) { if (sourceLen == 0) { return -1; }
try { CryptoPP::ZlibDecompressor decompressor; CryptoPP::ArraySource arraySource(source, sourceLen, true, new CryptoPP::Redirector(decompressor));
CryptoPP::lword maxRetrievable = decompressor.MaxRetrievable(); if (*destLen < static_cast<unsigned long>(maxRetrievable)) { return -1; } decompressor.Get(dest, static_cast<size_t>(maxRetrievable)); *destLen = static_cast<unsigned long>(maxRetrievable); return 0;} catch (const CryptoPP::Exception& e) { std::cerr << SecureString("Uncompress exception: ") << e.what() << std::endl; return -1; }
- Assistant