Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_encryptor.cpp
Go to the documentation of this file.
1
// Copyright 2017 The PDFium Authors
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
#
include
"core/fpdfapi/parser/cpdf_encryptor.h"
8
9
#
include
<
stdint
.
h
>
10
11
#
include
"core/fpdfapi/parser/cpdf_crypto_handler.h"
12
#
include
"core/fxcrt/data_vector.h"
13
#
include
"third_party/base/check.h"
14
15
CPDF_Encryptor
::
CPDF_Encryptor
(
const
CPDF_CryptoHandler
* pHandler,
int
objnum)
16
:
m_pHandler
(
pHandler
), m_ObjNum(objnum) {
17
DCHECK(m_pHandler);
18
}
19
20
DataVector
<
uint8_t
>
CPDF_Encryptor
::
Encrypt
(
21
pdfium::span<
const
uint8_t> src_data)
const
{
22
if
(src_data.empty())
23
return
DataVector<uint8_t>();
24
25
DataVector<uint8_t> result;
26
size_t buf_size = m_pHandler->EncryptGetSize(src_data);
27
result.resize(buf_size);
28
m_pHandler->EncryptContent(m_ObjNum, 0, src_data, result.data(),
29
buf_size);
// Updates |buf_size| with actual.
30
result.resize(buf_size);
31
return
result;
32
}
33
34
CPDF_Encryptor
::~
CPDF_Encryptor
() =
default
;
CPDF_CryptoHandler
Definition
cpdf_crypto_handler.h:25
CPDF_Encryptor
Definition
cpdf_encryptor.h:18
CPDF_Encryptor::~CPDF_Encryptor
~CPDF_Encryptor()
CPDF_Encryptor::CPDF_Encryptor
CPDF_Encryptor(const CPDF_CryptoHandler *pHandler, int objnum)
Definition
cpdf_encryptor.cpp:15
CPDF_Encryptor::Encrypt
DataVector< uint8_t > Encrypt(pdfium::span< const uint8_t > src_data) const
Definition
cpdf_encryptor.cpp:20
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fpdfapi
parser
cpdf_encryptor.cpp
Generated on Wed Nov 13 2024 00:56:16 for Qt by
1.12.0