| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_STANDARD_CRYPTO_HANDLER_H_ | |
| 8 #define CORE_FPDFAPI_FPDF_PARSER_CPDF_STANDARD_CRYPTO_HANDLER_H_ | |
| 9 | |
| 10 #include "core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h" | |
| 11 | |
| 12 class CPDF_StandardCryptoHandler : public IPDF_CryptoHandler { | |
| 13 public: | |
| 14 CPDF_StandardCryptoHandler(); | |
| 15 ~CPDF_StandardCryptoHandler() override; | |
| 16 | |
| 17 // IPDF_CryptoHandler | |
| 18 FX_BOOL Init(CPDF_Dictionary* pEncryptDict, | |
| 19 IPDF_SecurityHandler* pSecurityHandler) override; | |
| 20 uint32_t DecryptGetSize(uint32_t src_size) override; | |
| 21 void* DecryptStart(uint32_t objnum, uint32_t gennum) override; | |
| 22 FX_BOOL DecryptStream(void* context, | |
| 23 const uint8_t* src_buf, | |
| 24 uint32_t src_size, | |
| 25 CFX_BinaryBuf& dest_buf) override; | |
| 26 FX_BOOL DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) override; | |
| 27 uint32_t EncryptGetSize(uint32_t objnum, | |
| 28 uint32_t version, | |
| 29 const uint8_t* src_buf, | |
| 30 uint32_t src_size) override; | |
| 31 FX_BOOL EncryptContent(uint32_t objnum, | |
| 32 uint32_t version, | |
| 33 const uint8_t* src_buf, | |
| 34 uint32_t src_size, | |
| 35 uint8_t* dest_buf, | |
| 36 uint32_t& dest_size) override; | |
| 37 | |
| 38 FX_BOOL Init(int cipher, const uint8_t* key, int keylen); | |
| 39 | |
| 40 protected: | |
| 41 virtual void CryptBlock(FX_BOOL bEncrypt, | |
| 42 uint32_t objnum, | |
| 43 uint32_t gennum, | |
| 44 const uint8_t* src_buf, | |
| 45 uint32_t src_size, | |
| 46 uint8_t* dest_buf, | |
| 47 uint32_t& dest_size); | |
| 48 virtual void* CryptStart(uint32_t objnum, uint32_t gennum, FX_BOOL bEncrypt); | |
| 49 virtual FX_BOOL CryptStream(void* context, | |
| 50 const uint8_t* src_buf, | |
| 51 uint32_t src_size, | |
| 52 CFX_BinaryBuf& dest_buf, | |
| 53 FX_BOOL bEncrypt); | |
| 54 virtual FX_BOOL CryptFinish(void* context, | |
| 55 CFX_BinaryBuf& dest_buf, | |
| 56 FX_BOOL bEncrypt); | |
| 57 | |
| 58 uint8_t m_EncryptKey[32]; | |
| 59 int m_KeyLen; | |
| 60 int m_Cipher; | |
| 61 uint8_t* m_pAESContext; | |
| 62 }; | |
| 63 | |
| 64 #endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_STANDARD_CRYPTO_HANDLER_H_ | |
| OLD | NEW |