vcl: PDFEncryptorR6: check result in decryptPerms
On the one hand, this should check 3 bytes have expected value. On the other hand, it's only called by tests. Signed-off-by: Michael Stahl <michael.stahl@collabora.com> Change-Id: Ia0c9c48835a7b603a545e4f186eef77ade857f0e Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8627 Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com> (cherry picked from commit eaef8be7dbc00573860a24850df30433a3f59187) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209323 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
committed by
Xisco Fauli
parent
063d74b893
commit
679f88a775
@@ -138,11 +138,16 @@ std::vector<sal_uInt8> decryptKey(const sal_uInt8* pPass, size_t nLength, std::v
|
||||
std::vector<sal_uInt8> decryptPerms(std::vector<sal_uInt8>& rPermsEncrypted,
|
||||
std::vector<sal_uInt8>& rFileEncryptionKey)
|
||||
{
|
||||
std::vector<sal_uInt8> aPermsDecrpyted(rPermsEncrypted.size());
|
||||
std::vector<sal_uInt8> aPermsDecrypted(rPermsEncrypted.size());
|
||||
std::vector<sal_uInt8> iv(IV_SIZE, 0);
|
||||
comphelper::Decrypt aDecryptor(rFileEncryptionKey, iv, comphelper::CryptoType::AES_256_ECB);
|
||||
aDecryptor.update(aPermsDecrpyted, rPermsEncrypted);
|
||||
return aPermsDecrpyted;
|
||||
aDecryptor.update(aPermsDecrypted, rPermsEncrypted);
|
||||
if (aPermsDecrypted[9] == 'a' && aPermsDecrypted[10] == 'd' && aPermsDecrypted[11] == 'b')
|
||||
{
|
||||
return aPermsDecrypted;
|
||||
}
|
||||
SAL_INFO("vcl.pdfwriter", "decryptPerms failed");
|
||||
return {};
|
||||
}
|
||||
|
||||
/** Algorithm 10 step f) */
|
||||
|
||||
Reference in New Issue
Block a user