diff options
author | Artem Strygin <art-snake@yandex-team.ru> | 2017-10-02 19:19:28 +0300 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-10-02 16:29:30 +0000 |
commit | d8169d7607b5084cdeceee3eaffca0ab16d2c14d (patch) | |
tree | 7741388e44b50f8a330f4724fa5ce29d6a0097bf /core/fpdfapi/parser/cpdf_crypto_handler.h | |
parent | 73784e81928a664169f0ae013707fdfb0e82e70d (diff) | |
download | pdfium-d8169d7607b5084cdeceee3eaffca0ab16d2c14d.tar.xz |
Implement CPDF_CryptoHandler::DecryptObject
Decryption logic has been extracted from CPDF_SyntaxParser::GetObjectBody
into CPDF_CryptoHandler::DecryptObject
Performance comparison results:
https://pdfium-review.googlesource.com/c/pdfium/+/12970
Change-Id: Iaeaed56b7f96166bbbcf6db162192d2ba9af4698
Reviewed-on: https://pdfium-review.googlesource.com/12971
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_crypto_handler.h')
-rw-r--r-- | core/fpdfapi/parser/cpdf_crypto_handler.h | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.h b/core/fpdfapi/parser/cpdf_crypto_handler.h index d815e786f6..60f32b70ba 100644 --- a/core/fpdfapi/parser/cpdf_crypto_handler.h +++ b/core/fpdfapi/parser/cpdf_crypto_handler.h @@ -17,6 +17,7 @@ #include "core/fxcrt/retain_ptr.h" class CPDF_Dictionary; +class CPDF_Object; class CPDF_SecurityHandler; class CPDF_CryptoHandler : public Retainable { @@ -24,16 +25,14 @@ class CPDF_CryptoHandler : public Retainable { template <typename T, typename... Args> friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); + static bool IsSignatureDictionary(const CPDF_Dictionary* dictionary); + bool Init(CPDF_Dictionary* pEncryptDict, CPDF_SecurityHandler* pSecurityHandler); - uint32_t DecryptGetSize(uint32_t src_size); - void* DecryptStart(uint32_t objnum, uint32_t gennum); - ByteString Decrypt(uint32_t objnum, uint32_t gennum, const ByteString& str); - bool DecryptStream(void* context, - const uint8_t* src_buf, - uint32_t src_size, - CFX_BinaryBuf& dest_buf); - bool DecryptFinish(void* context, CFX_BinaryBuf& dest_buf); + + std::unique_ptr<CPDF_Object> DecryptObjectTree( + std::unique_ptr<CPDF_Object> object); + uint32_t EncryptGetSize(uint32_t objnum, uint32_t version, const uint8_t* src_buf, @@ -52,6 +51,15 @@ class CPDF_CryptoHandler : public Retainable { CPDF_CryptoHandler(); ~CPDF_CryptoHandler() override; + uint32_t DecryptGetSize(uint32_t src_size); + void* DecryptStart(uint32_t objnum, uint32_t gennum); + ByteString Decrypt(uint32_t objnum, uint32_t gennum, const ByteString& str); + bool DecryptStream(void* context, + const uint8_t* src_buf, + uint32_t src_size, + CFX_BinaryBuf& dest_buf); + bool DecryptFinish(void* context, CFX_BinaryBuf& dest_buf); + void PopulateKey(uint32_t objnum, uint32_t gennum, uint8_t* key); void CryptBlock(bool bEncrypt, uint32_t objnum, |