diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-03-09 17:42:18 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-03-09 17:42:18 -0800 |
commit | a1193aedb8797fcb26f54d7b99e4662ae72e3de9 (patch) | |
tree | 97f3a1c85e6227e4910981d735cd5ada62ac2b5c /core/include/fpdfapi/ipdf_crypto_handler.h | |
parent | 99406198ac4921a53425edc73cac67e7b4760895 (diff) | |
download | pdfium-a1193aedb8797fcb26f54d7b99e4662ae72e3de9.tar.xz |
Split off IPDF_CryptoHandler into its own .cpp/.h files.
CPDF_CryptoHandler was always a pure-virtual class, now it
is named as IPDF_ to indicate this.
R=dsinclair@chromium.org
Review URL: https://codereview.chromium.org/1782673002 .
Diffstat (limited to 'core/include/fpdfapi/ipdf_crypto_handler.h')
-rw-r--r-- | core/include/fpdfapi/ipdf_crypto_handler.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/core/include/fpdfapi/ipdf_crypto_handler.h b/core/include/fpdfapi/ipdf_crypto_handler.h new file mode 100644 index 0000000000..6a09a02278 --- /dev/null +++ b/core/include/fpdfapi/ipdf_crypto_handler.h @@ -0,0 +1,45 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_INCLUDE_FPDFAPI_IPDF_CRYPTO_HANDLER_H_ +#define CORE_INCLUDE_FPDFAPI_IPDF_CRYPTO_HANDLER_H_ + +#include "core/include/fxcrt/fx_basic.h" + +class CPDF_Dictionary; +class IPDF_SecurityHandler; + +class IPDF_CryptoHandler { + public: + virtual ~IPDF_CryptoHandler(); + + virtual FX_BOOL Init(CPDF_Dictionary* pEncryptDict, + IPDF_SecurityHandler* pSecurityHandler) = 0; + + virtual FX_DWORD DecryptGetSize(FX_DWORD src_size) = 0; + virtual void* DecryptStart(FX_DWORD objnum, FX_DWORD gennum) = 0; + virtual FX_BOOL DecryptStream(void* context, + const uint8_t* src_buf, + FX_DWORD src_size, + CFX_BinaryBuf& dest_buf) = 0; + + virtual FX_BOOL DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) = 0; + virtual FX_DWORD EncryptGetSize(FX_DWORD objnum, + FX_DWORD version, + const uint8_t* src_buf, + FX_DWORD src_size) = 0; + + virtual FX_BOOL EncryptContent(FX_DWORD objnum, + FX_DWORD version, + const uint8_t* src_buf, + FX_DWORD src_size, + uint8_t* dest_buf, + FX_DWORD& dest_size) = 0; + + void Decrypt(FX_DWORD objnum, FX_DWORD version, CFX_ByteString& str); +}; + +#endif // CORE_INCLUDE_FPDFAPI_IPDF_CRYPTO_HANDLER_H_ |