Foxit PDF SDK
fs_security.h
Go to the documentation of this file.
1 
15 #ifndef FS_SECURITY_H_
16 #define FS_SECURITY_H_
17 
18 #include "common/fs_common.h"
19 #include "pdf/fs_pdfdoc.h"
20 
26 namespace foxit {
30 namespace pdf {
31 // forward declaration
32 class CustomSecurityCallback;
33 class RMSSecurityCallback;
34 
56 class SecurityHandler : public Base {
57  public:
63  typedef enum _CipherType {
73  } CipherType;
74 
77 #ifndef __EMSCRIPTEN_RENDER__
78 
83  SecurityHandler(const SecurityHandler& other);
84 
85  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
86  explicit SecurityHandler(FS_HANDLE handle);
87 
89  virtual ~SecurityHandler();
90 
99 #endif
100 
107  bool operator == (const SecurityHandler& other);
115  bool operator != (const SecurityHandler& other);
116 
124  bool IsEmpty() const;
125 
133 
134 };
135 
137 class StdEncryptData FS_FINAL {
138  public:
159  int key_length) {
160  this->is_encrypt_metadata = is_encrypt_metadata;
161  this->user_permissions = user_permissions;
162  this->cipher = cipher;
163  this->key_length = key_length;
164  }
165 
168  : is_encrypt_metadata(true)
169  , user_permissions(0)
170  , cipher(SecurityHandler::e_CipherNone)
171  , key_length(0) {}
172 
181  cipher = other.cipher;
182  key_length = other.key_length;
183  }
184 
195  cipher = other.cipher;
196  key_length = other.key_length;
197  return *this;
198  }
199 
207  bool operator == (const StdEncryptData& other) const {
208  return (is_encrypt_metadata == other.is_encrypt_metadata &&
210  cipher == other.cipher &&
211  key_length == other.key_length);
212  }
213 
221  bool operator != (const StdEncryptData& other) const {
222  return !(is_encrypt_metadata == other.is_encrypt_metadata &&
224  cipher == other.cipher &&
225  key_length == other.key_length);
226  }
227 
250  this->is_encrypt_metadata = is_encrypt_metadata;
251  this->user_permissions = user_permissions;
252  this->cipher = cipher;
253  this->key_length = key_length;
254  }
255 
281 };
282 
288 class StdSecurityHandler FS_FINAL : public SecurityHandler {
289  public:
296  typedef enum _ModifyFlag {
303  } ModifyFlag;
304 
305 
313  explicit StdSecurityHandler(const foxit::pdf::SecurityHandler& other);
314 
330  bool Initialize(const StdEncryptData& encrypt_data, const String& user_password, const String& owner_password);
331 
344  bool InitializeW(const StdEncryptData& encrypt_data, const WString& user_password, const WString& owner_password);
345 
361  void SetAES256ModifyFlags(uint32 modify_flags);
362 };
363 
365 class CertificateEncryptData FS_FINAL {
366  public:
378  this->is_encrypt_metadata = is_encrypt_metadata;
379  this->cipher = cipher;
380  this->envelopes = envelopes;
381  }
382 
385  : is_encrypt_metadata(true)
386  , cipher(SecurityHandler::e_CipherNone) {}
387 
395  cipher = other.cipher;
396  envelopes = other.envelopes;
397  }
398 
408  cipher = other.cipher;
409  envelopes = other.envelopes;
410  return *this;
411  }
412 
420  bool operator == (const CertificateEncryptData& other) const {
421  if (is_encrypt_metadata == other.is_encrypt_metadata && cipher == other.cipher) {
422  if (envelopes.GetSize() == other.envelopes.GetSize()) {
423  for (size_t i=0; i<envelopes.GetSize(); i++) {
424  if (envelopes[i] != other.envelopes[i]) return false;
425  }
426  return true;
427  }
428  }
429  return false;
430  }
431 
439  bool operator != (const CertificateEncryptData& other) const {
440  if (!(is_encrypt_metadata == other.is_encrypt_metadata && cipher == other.cipher)) {
441  if (envelopes.GetSize() == other.envelopes.GetSize()) {
442  if (envelopes.GetSize() == 0) return false;
443  for (size_t i=0; i<envelopes.GetSize(); i++) {
444  if (envelopes[i] == other.envelopes[i]) return false;
445  }
446  return true;
447  }
448  }
449  return false;
450  }
451 
465  this->is_encrypt_metadata = is_encrypt_metadata;
466  this->cipher = cipher;
467  this->envelopes =envelopes;
468  }
469 
485 };
486 
487 #if (_FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_ || defined(SWIG) || defined(__EMSCRIPTEN__)) && !defined(_SWIG_JAVA_) && !defined(_SWIG_DOTNET_) && !defined(_SWIG_PYTHON_) && !defined(_OC_) && !defined(_SWIG_MACOC_) && !defined(_SWIG_NODEJS_) && !defined(_SWIG_GO_) && !defined(_FSDK_NO_OPENSSL_)
488 struct CertPermission;
490 class Envelope : public Base {
491  public:
498  Envelope(const void* buffer, size_t size);
504  Envelope(const char* cert_file_path);
505 
512  Envelope(const char* certFilePath, const CertPermission* permission);
519  Envelope(foxit::common::file::ReaderCallback *certFile, const CertPermission* permission);
520 
521  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
522  explicit Envelope(FS_HANDLE handle);
524  Envelope(const Envelope& other);
525 
527  virtual ~Envelope();
528 
530  bool operator==(const Envelope& other) const;
532  bool operator!=(const Envelope& other) const;
533 
542  String GetDecryptionKey(const char* p12_file_path, const String& password);
543 };
544 
545 enum PRINT_PERMISSION
546 {
547  PRINT_NONE = 0,
548  PRINT_LOW,
549  PRINT_HIGH
550 };
551 
552 enum CHANGE_PERMISSION
553 {
554  CHANGE_NONE = 0,
555  CHANGE_INSERTDELROTATE,
556  CHANGE_FORMFILL,
557  CHANGE_COMMENTSFORMFILL,
558  CHANGE_ANYEXCEPTEXTRACT
559 };
560 
561 enum PROPERTITY_PERMISSION
562 {
563  PERMISSION_PRINTING = 0, //Printing;
564  PERMISSION_CHANGEDOC, //Changing the Document;
565  PERMISSION_DOCASSEMBLY, //Document Assembly;
566  PERMISSION_CONTENTCOPY, //Content Copying;
567  PERMISSION_CONTENTCOPYACCESS, // Content Copying for Accessibility;
568  PERMISSION_PAGEEXTRACT, //Page Extraction;
569  PERMISSION_COMMENT, //Commenting;
570  PERMISSION_FILLFORM, //Filling of form fields;
571  PERMISSION_SIGN //Signing;
572 
573 };
574 
575 struct CertPermission
576 {
577  CertPermission()
578  {
579  bEnableCopy = false;
580  bEnableTextAccess = false;
581  printPer = PRINT_NONE;
582  changePer = CHANGE_NONE;
583  }
584 
585  bool bEnableCopy;
586  bool bEnableTextAccess;
587 
588  PRINT_PERMISSION printPer;
589  CHANGE_PERMISSION changePer;
590 };
591 
593 typedef CFX_ArrayTemplate<Envelope> EnvelopeArray;
594 
595 #endif
596 
603  public:
612 
613 #if (_FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_ || defined(SWIG) || defined(__EMSCRIPTEN__)) && !defined(_SWIG_JAVA_) && !defined(_SWIG_DOTNET_) && !defined(_SWIG_PYTHON_) && !defined(_OC_) && !defined(_SWIG_MACOC_) && !defined(_SWIG_NODEJS_) && !defined(_SWIG_GO_) && !defined(_FSDK_NO_OPENSSL_)
614 
626  bool Initialize(foxit::pdf::EnvelopeArray envelopes, foxit::pdf::SecurityHandler::CipherType cipher, bool is_encrypt_metadata);
627 #endif // (_FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_ || defined(SWIG)) && !defined(_SWIG_JAVA_) && !defined(_SWIG_DOTNET_) && !defined(_OC_) && !defined(_SWIG_MACOC_) && !defined(_SWIG_GO_)
628 
642  bool Initialize(const CertificateEncryptData& encrypt_data, const String& encrypt_key);
643 };
644 
646 class DRMEncryptData FS_FINAL {
647  public:
669  this->is_encrypt_metadata = is_encrypt_metadata;
670  this->sub_filter = sub_filter;
671  this->cipher = cipher;
672  this->key_length = key_length;
673  this->is_owner = is_owner;
674  this->user_permissions = user_permissions;
675  }
676 
679  : is_encrypt_metadata(true)
680  , sub_filter("")
681  , cipher(SecurityHandler::e_CipherNone)
682  , key_length(0)
683  , is_owner(false)
684  , user_permissions(0) {}
685 
693  sub_filter = other.sub_filter;
694  cipher = other.cipher;
695  key_length = other.key_length;
696  is_owner = other.is_owner;
698  }
699 
709  sub_filter = other.sub_filter;
710  cipher = other.cipher;
711  key_length = other.key_length;
712  is_owner = other.is_owner;
714  return *this;
715  }
716 
724  bool operator == (const DRMEncryptData& other) const {
725  return (is_encrypt_metadata == other.is_encrypt_metadata &&
726  sub_filter == other.sub_filter &&
727  cipher == other.cipher && key_length == other.key_length &&
728  is_owner == other.is_owner &&
730  }
731 
739  bool operator != (const DRMEncryptData& other) const {
740  return !(is_encrypt_metadata == other.is_encrypt_metadata &&
741  sub_filter == other.sub_filter &&
742  cipher == other.cipher && key_length == other.key_length &&
743  is_owner == other.is_owner &&
745  }
746 
770  this->is_encrypt_metadata = is_encrypt_metadata;
771  this->sub_filter = sub_filter;
772  this->cipher = cipher;
773  this->key_length = key_length;
774  this->is_owner = is_owner;
775  this->user_permissions = user_permissions;
776  }
777 
801  bool is_owner;
807 };
808 
814 class DRMSecurityHandler FS_FINAL : public SecurityHandler {
815  public:
823  explicit DRMSecurityHandler(const foxit::pdf::SecurityHandler& other);
824 
835  bool Initialize(const DRMEncryptData& encrypt_data, const char* file_id, const String& initial_key);
854  WString GetDRMValue(const char* key);
874  bool SetDRMValue(const char* key, const WString& value);
875 
886  bool VerifyEncryptionParams();
887 };
888 
890 class CustomEncryptData FS_FINAL {
891  public:
901  this->is_encrypt_metadata = is_encrypt_metadata;
902  this->filter = filter;
903  this->sub_filter = sub_filter;
904  }
905 
908  : is_encrypt_metadata(true)
909  , filter("")
910  , sub_filter("") {}
911 
919  filter = other.filter;
920  sub_filter = other.sub_filter;
921  }
931  filter = other.filter;
932  sub_filter = other.sub_filter;
933  return *this;
934  }
935 
943  bool operator == (const CustomEncryptData& other) const {
944  return (is_encrypt_metadata == other.is_encrypt_metadata &&
945  filter == other.filter && sub_filter == other.sub_filter);
946  }
947 
955  bool operator != (const CustomEncryptData& other) const {
956  return !(is_encrypt_metadata == other.is_encrypt_metadata &&
957  filter == other.filter && sub_filter == other.sub_filter);
958  }
969  void Set(bool is_encrypt_metadata, const String& filter, const String& sub_filter) {
970  this->is_encrypt_metadata = is_encrypt_metadata;
971  this->filter = filter;
972  this->sub_filter = sub_filter;
973  }
974 
984 };
985 
991 class CustomSecurityHandler FS_FINAL : public SecurityHandler {
992  public:
1000  explicit CustomSecurityHandler(const foxit::pdf::SecurityHandler& other);
1001 
1022  bool Initialize(const CustomEncryptData& encrypt_data,
1023  const CustomSecurityCallback* callback, const char* encrypt_info = "");
1024 };
1025 
1027 class RMSEncryptData FS_FINAL {
1028  public:
1058  float irm_version = 1.0) {
1059  this->is_encrypt_metadata = is_encrypt_metadata;
1060  this->publish_license = publish_license;
1061  this->server_eul_list = server_eul_list;
1062  if (irm_version<1.0)
1063  this->irm_version = 1.0;
1064  else
1065  this->irm_version = irm_version;
1066  }
1067 
1070  : is_encrypt_metadata(true)
1071  , publish_license("")
1072  , irm_version(1.0) {}
1073 
1083  irm_version = other.irm_version;
1084  }
1085 
1097  irm_version = other.irm_version;
1098  return *this;
1099  }
1100 
1108  bool operator == (const RMSEncryptData& other) const {
1110  fabs(irm_version - other.irm_version) <= FLT_EPSILON) {
1111  if (server_eul_list.GetSize() == other.server_eul_list.GetSize()) {
1112  for (size_t i=0; i<server_eul_list.GetSize(); i++) {
1113  if (server_eul_list[i] != other.server_eul_list[i]) return false;
1114  }
1115  return true;
1116  }
1117  }
1118  return false;
1119  }
1120 
1128  bool operator != (const RMSEncryptData& other) const {
1130  fabs(irm_version - other.irm_version) <= FLT_EPSILON)) {
1131  if (server_eul_list.GetSize() == other.server_eul_list.GetSize()) {
1132  if (server_eul_list.GetSize() == 0) return false;
1133  for (size_t i=0; i<server_eul_list.GetSize(); i++) {
1134  if (server_eul_list[i] == other.server_eul_list[i]) return false;
1135  }
1136  return true;
1137  }
1138  }
1139  return false;
1140  }
1141 
1173  float irm_version = 1.0) {
1174  this->is_encrypt_metadata = is_encrypt_metadata;
1175  this->publish_license = publish_license;
1176  this->server_eul_list = server_eul_list;
1177  if (irm_version<1.0)
1178  this->irm_version = 1.0;
1179  else
1180  this->irm_version = irm_version;
1181  }
1182 
1218 };
1219 
1230 class RMSSecurityHandler FS_FINAL : public SecurityHandler {
1231  public:
1249  explicit RMSSecurityHandler(const foxit::pdf::SecurityHandler& other);
1250 
1269  bool Initialize(const RMSEncryptData& encrypt_data, const RMSSecurityCallback* callback);
1270 };
1271 
1278  public:
1284  virtual void Release() = 0;
1292 
1293  protected:
1294  ~SecurityCallback() {}
1295 };
1296 
1306  public:
1325  virtual String GetDecryptionKey(const void* envelope_buffer, uint32 envelope_length) = 0;
1326 
1327  protected:
1329 };
1330 
1340  public:
1359  virtual bool IsOwner(const PDFDoc& document, const char* sub_filter) = 0;
1371  virtual uint32 GetUserPermissions(const PDFDoc& document, const char* sub_filter) = 0;
1383  virtual SecurityHandler::CipherType GetCipherType(const PDFDoc& document, const char* sub_filter) = 0;
1397  virtual uint32 GetKeyLength(const PDFDoc& document, const char* sub_filter) = 0;
1408  virtual String GetFileID(const PDFDoc& document, const char* sub_filter) = 0;
1419  virtual String GetInitialKey(const PDFDoc& document, const char* sub_filter) = 0;
1420 
1421  protected:
1422  ~DRMSecurityCallback() {}
1423 };
1424 
1434  public:
1454  virtual void* CreateContext(const char* filter, const char* sub_filter, const char* encrypt_info) = 0;
1465  virtual bool ReleaseContext(void* context) = 0;
1479  virtual uint32 GetUserPermissions(const void* context, uint32 user_permission) = 0;
1490  virtual bool IsOwner(const void* context) = 0;
1502  virtual SecurityHandler::CipherType GetCipher(const void* context) = 0;
1513  virtual String GetEncryptKey(const void* context) = 0;
1525  virtual uint32 GetDecryptedSize(const void* context, uint32 src_data_size) = 0;
1538  virtual void* StartDecryptor(const void* context, int obj_num, int gen_num) = 0;
1551  virtual String DecryptData(const void* decryptor, const void* encrypted_data, uint32 encrypted_data_len) = 0;
1562  virtual String FinishDecryptor(void* decryptor) = 0;
1577  virtual uint32 GetEncryptedSize(const void* context, int obj_num, int gen_num,
1578  const void* src_data, uint32 src_data_len) = 0;
1595  virtual bool EncryptData(const void* context, int obj_num, int gen_num,
1596  const void* src_data, uint32 src_data_len,
1597  void* out_dst_buffer, uint32* out_dst_buffer_len) = 0;
1598 
1614  virtual bool UseStandardCryptoMethod(const void* context) { return false; }
1615 
1616  protected:
1618 };
1619 
1629  public:
1638 
1639  protected:
1640  ~RMSSecurityCallback() {}
1641 };
1642 } // namespace pdf
1643 } // namespace foxit
1644 #endif // FS_SECURITY_H_
1645 
foxit::pdf::CustomSecurityCallback::GetDecryptedSize
virtual uint32 GetDecryptedSize(const void *context, uint32 src_data_size)=0
A callback function used to get the estimated decrypted data size.
foxit::pdf::StdEncryptData::cipher
SecurityHandler::CipherType cipher
Cipher type. Please refer to values starting from SecurityHandler::e_CipherRC4 and this should be one...
Definition: fs_security.h:270
foxit::pdf::SecurityHandler::IsEmpty
bool IsEmpty() const
Check whether current object is empty or not.
foxit::pdf::CustomSecurityCallback::FinishDecryptor
virtual String FinishDecryptor(void *decryptor)=0
A callback function used to finish the decryption.
foxit::pdf::SecurityHandler::operator==
bool operator==(const SecurityHandler &other)
Equal operator.
foxit::pdf::RMSEncryptData::RMSEncryptData
RMSEncryptData(bool is_encrypt_metadata, const char *publish_license, const StringArray &server_eul_list, float irm_version=1.0)
Constructor, with parameters.
Definition: fs_security.h:1057
foxit::pdf::CustomSecurityCallback::CreateContext
virtual void * CreateContext(const char *filter, const char *sub_filter, const char *encrypt_info)=0
A callback function used to create context for encryption and decryption.
foxit::pdf::CustomEncryptData::filter
String filter
The filter name of a custom security callback object. It should not be an empty string.
Definition: fs_security.h:981
foxit::pdf::DRMSecurityCallback::GetCipherType
virtual SecurityHandler::CipherType GetCipherType(const PDFDoc &document, const char *sub_filter)=0
A callback function used to get the cipher type for encryption algorithm.
foxit::FS_HANDLE
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:213
foxit::pdf::DRMEncryptData::operator==
bool operator==(const DRMEncryptData &other) const
Equal operator.
Definition: fs_security.h:724
foxit::pdf::CustomEncryptData::CustomEncryptData
CustomEncryptData(bool is_encrypt_metadata, const String &filter, const String &sub_filter)
Constructor, with parameters.
Definition: fs_security.h:900
foxit::pdf::CustomSecurityCallback::GetEncryptedSize
virtual uint32 GetEncryptedSize(const void *context, int obj_num, int gen_num, const void *src_data, uint32 src_data_len)=0
A callback function used to get the estimated encrypted size.
foxit::pdf::RMSSecurityHandler::RMSSecurityHandler
RMSSecurityHandler()
Constructor.
foxit::pdf::CustomSecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1442
foxit::pdf::StdSecurityHandler::e_ModifyUserPassword
If set, user password and owner password will be modified during encryption process.
Definition: fs_security.h:300
foxit::pdf::DRMSecurityHandler::DRMSecurityHandler
DRMSecurityHandler()
Constructor function.
foxit::pdf::RMSSecurityCallback
Definition: fs_security.h:1628
foxit::pdf::CertificateEncryptData::CertificateEncryptData
CertificateEncryptData(const CertificateEncryptData &other)
Constructor, with another certificate encrypt data object.
Definition: fs_security.h:393
foxit::pdf::CertificateEncryptData::operator==
bool operator==(const CertificateEncryptData &other) const
Equal operator.
Definition: fs_security.h:420
foxit::StringArray
Definition: fs_basictypes.h:229
foxit::pdf::CertificateSecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of current security callback.
Definition: fs_security.h:1314
foxit::StringArray::GetSize
size_t GetSize() const
Get the size of elements in current array.
foxit::pdf::CustomEncryptData::CustomEncryptData
CustomEncryptData(const CustomEncryptData &other)
Constructor, with another custom encrypt data object.
Definition: fs_security.h:917
foxit::pdf::CertificateEncryptData
Definition: fs_security.h:365
foxit::pdf::CertificateSecurityHandler::CertificateSecurityHandler
CertificateSecurityHandler()
Constructor.
foxit::pdf::StdEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:260
foxit::pdf::DRMSecurityCallback::GetInitialKey
virtual String GetInitialKey(const PDFDoc &document, const char *sub_filter)=0
A callback function used to get the initial key to decrypt the DRM protected document.
foxit::pdf::CustomSecurityCallback::StartDecryptor
virtual void * StartDecryptor(const void *context, int obj_num, int gen_num)=0
A callback function used to start a decryption.
foxit::pdf::CustomEncryptData::sub_filter
String sub_filter
The sub filter name that specifies the syntax of the encryption dictionary contents....
Definition: fs_security.h:983
foxit::pdf::CustomEncryptData::operator=
CustomEncryptData & operator=(const CustomEncryptData &other)
Assign operator.
Definition: fs_security.h:929
foxit::pdf::StdSecurityHandler::Initialize
bool Initialize(const StdEncryptData &encrypt_data, const String &user_password, const String &owner_password)
(Not support AES-256) Initialize current standard security handler.
foxit::pdf::SecurityHandler::operator!=
bool operator!=(const SecurityHandler &other)
Not equal operator.
foxit::pdf::DRMEncryptData::is_owner
bool is_owner
A boolean value to decide whether current user is owner or not. true means current user is owner,...
Definition: fs_security.h:801
fs_common.h
Header file for common definitions and classes.
foxit::pdf::DRMEncryptData::operator!=
bool operator!=(const DRMEncryptData &other) const
Not equal operator.
Definition: fs_security.h:739
foxit::pdf::CertificateSecurityCallback::GetDecryptionKey
virtual String GetDecryptionKey(const void *envelope_buffer, uint32 envelope_length)=0
A callback function used to get the key for decrypting certificate protected PDF document.
CFX_ArrayTemplate
Definition: fx_basic.h:1297
foxit::pdf::CustomSecurityCallback::DecryptData
virtual String DecryptData(const void *decryptor, const void *encrypted_data, uint32 encrypted_data_len)=0
A callback function used to decrypt the encrypted data.
IFX_FileRead
File reading interface.
Definition: fx_stream.h:587
foxit::pdf::SecurityHandler::e_CipherRC4
Use RC4 encryption algorithm, with the key length between 5 bytes and 16 bytes.
Definition: fs_security.h:67
foxit::pdf::DRMSecurityHandler::SetDRMValue
bool SetDRMValue(const char *key, const WString &value)
Set the DRM value for a specified parameter.
foxit::pdf::RMSEncryptData
Definition: fs_security.h:1027
foxit::pdf::CustomSecurityCallback
Definition: fs_security.h:1433
foxit::pdf::SecurityHandler::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of current security handler.
foxit::pdf::SecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1291
foxit::pdf::StdEncryptData::operator=
StdEncryptData & operator=(const StdEncryptData &other)
Assign operator.
Definition: fs_security.h:192
foxit::pdf::PDFDoc::e_EncryptFoxitDRM
Encryption type: Foxit DRM encryption.
Definition: fs_pdfdoc.h:809
foxit::pdf::CustomSecurityHandler
Definition: fs_security.h:991
foxit::pdf::RMSSecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1637
foxit::pdf::StdEncryptData::Set
void Set(bool is_encrypt_metadata, uint32 user_permissions, SecurityHandler::CipherType cipher, int key_length)
Set value.
Definition: fs_security.h:249
foxit::pdf::CustomSecurityCallback::IsOwner
virtual bool IsOwner(const void *context)=0
A callback function used to check if current user is the owner of the PDF document.
foxit::pdf::CertificateSecurityHandler
Definition: fs_security.h:602
foxit::pdf::SecurityHandler::SecurityHandler
SecurityHandler()
Constructor.
foxit::pdf::CustomSecurityHandler::CustomSecurityHandler
CustomSecurityHandler()
Constructor.
foxit::pdf::DRMEncryptData::Set
void Set(bool is_encrypt_metadata, const String &sub_filter, SecurityHandler::CipherType cipher, int key_length, bool is_owner, uint32 user_permissions)
Set value.
Definition: fs_security.h:768
foxit::pdf::RMSEncryptData::publish_license
String publish_license
The Encoded Publishing License issued from server to the Content publisher, in ASCII encoding....
Definition: fs_security.h:1198
foxit::pdf::StdSecurityHandler::ModifyFlag
ModifyFlag
(Only for AES-256) Enumeration for modify flag used to decide which security data or password will be...
Definition: fs_security.h:296
foxit::pdf::SecurityHandler::CipherType
CipherType
Enumeration for Encryption Algorithm.
Definition: fs_security.h:63
foxit::pdf::CustomSecurityCallback::EncryptData
virtual bool EncryptData(const void *context, int obj_num, int gen_num, const void *src_data, uint32 src_data_len, void *out_dst_buffer, uint32 *out_dst_buffer_len)=0
A callback function used to get encrypted data.
foxit::pdf::CustomEncryptData::Set
void Set(bool is_encrypt_metadata, const String &filter, const String &sub_filter)
Set value.
Definition: fs_security.h:969
foxit::pdf::CustomEncryptData
Definition: fs_security.h:890
foxit::pdf::StdSecurityHandler::e_ModifyPermission
If set, user permissions and "is encrypt metadata" values (which are defined in StdEncryptData) will ...
Definition: fs_security.h:298
foxit::pdf::DRMEncryptData::DRMEncryptData
DRMEncryptData(bool is_encrypt_metadata, const String &sub_filter, SecurityHandler::CipherType cipher, int key_length, bool is_owner, uint32 user_permissions)
Constructor, with parameters.
Definition: fs_security.h:667
foxit::pdf::DRMSecurityCallback::GetUserPermissions
virtual uint32 GetUserPermissions(const PDFDoc &document, const char *sub_filter)=0
A callback function used to get the current user permissions.
foxit::pdf::SecurityCallback
Definition: fs_security.h:1277
foxit::pdf::CertificateSecurityCallback
Definition: fs_security.h:1305
foxit::pdf::RMSEncryptData::RMSEncryptData
RMSEncryptData(const RMSEncryptData &other)
Constructor, with another RMS encrypt data object.
Definition: fs_security.h:1079
CFX_ByteString
BYTE STRING CLASS.
Definition: fx_string.h:317
foxit::pdf::CertificateEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:474
foxit::pdf::StdEncryptData::StdEncryptData
StdEncryptData(bool is_encrypt_metadata, uint32 user_permissions, SecurityHandler::CipherType cipher, int key_length)
Constructor, with parameters.
Definition: fs_security.h:158
foxit::pdf::DRMSecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1348
foxit::pdf::RMSEncryptData::operator=
RMSEncryptData & operator=(const RMSEncryptData &other)
Assign operator.
Definition: fs_security.h:1093
foxit::pdf::PDFDoc::e_EncryptRMS
Encryption type: Microsoft RMS encryption.
Definition: fs_pdfdoc.h:813
foxit::pdf::CustomSecurityHandler::Initialize
bool Initialize(const CustomEncryptData &encrypt_data, const CustomSecurityCallback *callback, const char *encrypt_info="")
Initialize current custom security handler.
foxit::pdf::StdEncryptData::key_length
int key_length
The key length, in bytes.
Definition: fs_security.h:280
foxit::pdf::DRMEncryptData::DRMEncryptData
DRMEncryptData()
Constructor.
Definition: fs_security.h:678
foxit::pdf::PDFDoc::e_EncryptUnknown
Unknown encryption type.
Definition: fs_pdfdoc.h:801
foxit::pdf::SecurityHandler::~SecurityHandler
virtual ~SecurityHandler()
Destructor.
foxit::pdf::CertificateEncryptData::CertificateEncryptData
CertificateEncryptData(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray &envelopes)
Constructor, with parameters.
Definition: fs_security.h:377
foxit::pdf::CertificateEncryptData::cipher
SecurityHandler::CipherType cipher
Cipher type. Please refer to values starting from SecurityHandler::e_CipherRC4 and this should be one...
Definition: fs_security.h:479
foxit::pdf::DRMSecurityHandler::Initialize
bool Initialize(const DRMEncryptData &encrypt_data, const char *file_id, const String &initial_key)
Initialize current DRM security handler.
foxit::pdf::StdEncryptData
Definition: fs_security.h:137
foxit::pdf::DRMEncryptData::operator=
DRMEncryptData & operator=(const DRMEncryptData &other)
Assign operator.
Definition: fs_security.h:707
foxit::pdf::StdEncryptData::StdEncryptData
StdEncryptData()
Constructor.
Definition: fs_security.h:167
foxit::pdf::StdSecurityHandler
Definition: fs_security.h:288
operator==
bool operator==(const char *str1, const CFX_ByteString &str2)
Check if two byte strings are equal.
Definition: fs_basictypes.h:128
foxit::pdf::SecurityCallback::Release
virtual void Release()=0
A callback function used to release current callback object itself.
foxit::pdf::DRMSecurityCallback::GetKeyLength
virtual uint32 GetKeyLength(const PDFDoc &document, const char *sub_filter)=0
A callback function used to get the length of cipher key.
foxit::pdf::RMSEncryptData::server_eul_list
StringArray server_eul_list
A string array that contains pairs of strings to represent content of a dictionary object which is en...
Definition: fs_security.h:1212
foxit::pdf::RMSEncryptData::irm_version
float irm_version
Microsoft IRM version. It should be above 1. If input version is below 1, Foxit PDF SDK will use 1 as...
Definition: fs_security.h:1217
foxit::pdf::PDFDoc::EncryptType
EncryptType
Enumeration for encryption type.
Definition: fs_pdfdoc.h:799
foxit::pdf::DRMSecurityCallback::IsOwner
virtual bool IsOwner(const PDFDoc &document, const char *sub_filter)=0
A callback function used to check if current user is the owner of the PDF document.
foxit::pdf::CustomEncryptData::operator!=
bool operator!=(const CustomEncryptData &other) const
Not equal operator.
Definition: fs_security.h:955
foxit::pdf::CertificateSecurityHandler::Initialize
bool Initialize(const CertificateEncryptData &encrypt_data, const String &encrypt_key)
Initialize current certificate security handler.
foxit
Foxit namespace.
Definition: fs_taggedpdf.h:27
foxit::pdf::SecurityHandler
Definition: fs_security.h:56
foxit::pdf::DRMSecurityHandler::VerifyEncryptionParams
bool VerifyEncryptionParams()
Verify encryption parameters.
foxit::pdf::CertificateEncryptData::Set
void Set(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray &envelopes)
Set value.
Definition: fs_security.h:464
foxit::pdf::DRMEncryptData::DRMEncryptData
DRMEncryptData(const DRMEncryptData &other)
Constructor, with another DRM encrypt data object.
Definition: fs_security.h:691
foxit::pdf::CertificateEncryptData::envelopes
StringArray envelopes
A string array which specifies an array of certificate envelopes. This array should contains one or m...
Definition: fs_security.h:484
foxit::pdf::RMSSecurityHandler
Definition: fs_security.h:1230
foxit::pdf::StdEncryptData::StdEncryptData
StdEncryptData(const StdEncryptData &other)
Constructor, with another standard encrypt data object.
Definition: fs_security.h:178
foxit::pdf::DRMSecurityHandler::GetDRMValue
WString GetDRMValue(const char *key)
Get the DRM value for a specified parameter.
foxit::pdf::CustomSecurityCallback::GetCipher
virtual SecurityHandler::CipherType GetCipher(const void *context)=0
A callback function used to get the cipher type.
foxit::pdf::PDFDoc::e_EncryptCertificate
Encryption type: digital certificate encryption.
Definition: fs_pdfdoc.h:807
operator!=
bool operator!=(const char *str1, const CFX_ByteString &str2)
Check if two byte strings are not equal.
Definition: fs_basictypes.h:140
foxit::pdf::CertificateEncryptData::CertificateEncryptData
CertificateEncryptData()
Constructor.
Definition: fs_security.h:384
fs_pdfdoc.h
Header file for PDF document related definitions and classes.
foxit::pdf::StdSecurityHandler::e_ModifyOwnerPassword
If set, only owner password will be modified during encryption process.
Definition: fs_security.h:302
foxit::pdf::CustomSecurityCallback::GetUserPermissions
virtual uint32 GetUserPermissions(const void *context, uint32 user_permission)=0
A callback function used to get the user permissions.
foxit::pdf::CustomSecurityCallback::ReleaseContext
virtual bool ReleaseContext(void *context)=0
A callback function used to release the context for encryption and decryption.
foxit::pdf::CustomEncryptData::CustomEncryptData
CustomEncryptData()
Constructor.
Definition: fs_security.h:907
foxit::pdf::PDFDoc
Definition: fs_pdfdoc.h:776
foxit::pdf::CustomSecurityCallback::GetEncryptKey
virtual String GetEncryptKey(const void *context)=0
A callback function used to get the encryption key.
foxit::pdf::CustomEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:979
foxit::pdf::SecurityHandler::e_CipherNone
Not use encryption algorithm.
Definition: fs_security.h:65
foxit::pdf::CustomEncryptData::operator==
bool operator==(const CustomEncryptData &other) const
Equal operator.
Definition: fs_security.h:943
foxit::pdf::RMSEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:1187
foxit::pdf::DRMEncryptData::user_permissions
uint32 user_permissions
The user permissions. Please refer to values starting from PDFDoc::e_PermPrint and this can be one or...
Definition: fs_security.h:806
foxit::pdf::SecurityHandler::operator=
SecurityHandler & operator=(const SecurityHandler &other)
Assign operator.
foxit::pdf::RMSSecurityHandler::Initialize
bool Initialize(const RMSEncryptData &encrypt_data, const RMSSecurityCallback *callback)
Initialize current Microsoft RMS security handler.
foxit::pdf::DRMEncryptData
Definition: fs_security.h:646
foxit::pdf::RMSEncryptData::operator!=
bool operator!=(const RMSEncryptData &other) const
Not equal operator.
Definition: fs_security.h:1128
foxit::pdf::CustomSecurityCallback::UseStandardCryptoMethod
virtual bool UseStandardCryptoMethod(const void *context)
A callback function to check if to use standard crypto method or custom crypto method.
Definition: fs_security.h:1614
foxit::pdf::StdEncryptData::operator==
bool operator==(const StdEncryptData &other) const
Equal operator.
Definition: fs_security.h:207
foxit::pdf::SecurityHandler::e_CipherAES
Use AES encryption algorithm, with the key length be 16 bytes (as AES-128) or 32 bytes (as AES-256,...
Definition: fs_security.h:72
foxit::pdf::PDFDoc::e_EncryptCustom
Encryption type: customized encryption.
Definition: fs_pdfdoc.h:811
foxit::pdf::DRMSecurityCallback::GetFileID
virtual String GetFileID(const PDFDoc &document, const char *sub_filter)=0
A callback function used to get the file identity string.
foxit::pdf::DRMEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:782
foxit::pdf::CertificateEncryptData::operator!=
bool operator!=(const CertificateEncryptData &other) const
Not equal operator.
Definition: fs_security.h:439
foxit::pdf::StdSecurityHandler::StdSecurityHandler
StdSecurityHandler()
Constructor.
CFX_WideString
WIDE STRING CLASS.
Definition: fx_string.h:1461
foxit::pdf::StdSecurityHandler::SetAES256ModifyFlags
void SetAES256ModifyFlags(uint32 modify_flags)
(Only for AES-256) Set modify flags to decide which security data or password will be modified during...
foxit::pdf::DRMSecurityHandler
Definition: fs_security.h:814
foxit::pdf::DRMEncryptData::sub_filter
String sub_filter
The sub filter name that specifies the syntax of the encryption dictionary contents.
Definition: fs_security.h:784
foxit::pdf::RMSEncryptData::RMSEncryptData
RMSEncryptData()
Constructor.
Definition: fs_security.h:1069
foxit::pdf::DRMEncryptData::key_length
int key_length
The key length, in bytes. For SecurityHandler::e_CipherRC4 cipher, this value should be between 5 an...
Definition: fs_security.h:796
foxit::pdf::DRMSecurityCallback
Definition: fs_security.h:1339
foxit::pdf::StdEncryptData::operator!=
bool operator!=(const StdEncryptData &other) const
Not equal operator.
Definition: fs_security.h:221
foxit::pdf::RMSEncryptData::Set
void Set(bool is_encrypt_metadata, const char *publish_license, const StringArray &server_eul_list, float irm_version=1.0)
Set value.
Definition: fs_security.h:1172
foxit::uint32
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:195
foxit::pdf::StdSecurityHandler::InitializeW
bool InitializeW(const StdEncryptData &encrypt_data, const WString &user_password, const WString &owner_password)
(Only for AES-256) Initialize current standard security handler.
foxit::pdf::CertificateEncryptData::operator=
CertificateEncryptData & operator=(const CertificateEncryptData &other)
Assign operator.
Definition: fs_security.h:406
foxit::Base
Definition: fs_basictypes.h:451
foxit::pdf::RMSEncryptData::operator==
bool operator==(const RMSEncryptData &other) const
Equal operator.
Definition: fs_security.h:1108
foxit::pdf::StdEncryptData::user_permissions
uint32 user_permissions
The user permissions. Please refer to values starting from PDFDoc::e_PermPrint and this should be one...
Definition: fs_security.h:265
foxit::pdf::DRMEncryptData::cipher
SecurityHandler::CipherType cipher
Cipher type. Please refer to values starting from SecurityHandler::e_CipherRC4 and this should be one...
Definition: fs_security.h:789