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(_SWIG_JAVA_) && !defined(_SWIG_DOTNET_) && !defined(_SWIG_PYTHON_) && !defined(_OC_) && !defined(_SWIG_MACOC_) && !defined(_SWIG_NODEJS_) && !defined(_SWIG_GO_)
488 
489 class Envelope : public Base {
490  public:
497  Envelope(const void* buffer, size_t size);
503  Envelope(const char* cert_file_path);
504 
505  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
506  explicit Envelope(FS_HANDLE handle);
508  Envelope(const Envelope& other);
510  bool operator==(const Envelope& other) const;
512  bool operator!=(const Envelope& other) const;
513 
522  String GetDecryptionKey(const char* p12_file_path, const String& password);
523 };
524 
526 typedef CFX_ArrayTemplate<Envelope> EnvelopeArray;
527 
528 #endif
529 
536  public:
545 
546 #if (_FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_ || defined(SWIG)) && !defined(_SWIG_JAVA_) && !defined(_SWIG_DOTNET_) && !defined(_SWIG_PYTHON_) && !defined(_OC_) && !defined(_SWIG_MACOC_) && !defined(_SWIG_NODEJS_) && !defined(_SWIG_GO_)
547 
559  bool Initialize(foxit::pdf::EnvelopeArray envelopes, foxit::pdf::SecurityHandler::CipherType cipher, bool is_encrypt_metadata);
560 #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_)
561 
575  bool Initialize(const CertificateEncryptData& encrypt_data, const String& encrypt_key);
576 };
577 
579 class DRMEncryptData FS_FINAL {
580  public:
602  this->is_encrypt_metadata = is_encrypt_metadata;
603  this->sub_filter = sub_filter;
604  this->cipher = cipher;
605  this->key_length = key_length;
606  this->is_owner = is_owner;
607  this->user_permissions = user_permissions;
608  }
609 
612  : is_encrypt_metadata(true)
613  , sub_filter("")
614  , cipher(SecurityHandler::e_CipherNone)
615  , key_length(0)
616  , is_owner(false)
617  , user_permissions(0) {}
618 
626  sub_filter = other.sub_filter;
627  cipher = other.cipher;
628  key_length = other.key_length;
629  is_owner = other.is_owner;
631  }
632 
642  sub_filter = other.sub_filter;
643  cipher = other.cipher;
644  key_length = other.key_length;
645  is_owner = other.is_owner;
647  return *this;
648  }
649 
657  bool operator == (const DRMEncryptData& other) const {
658  return (is_encrypt_metadata == other.is_encrypt_metadata &&
659  sub_filter == other.sub_filter &&
660  cipher == other.cipher && key_length == other.key_length &&
661  is_owner == other.is_owner &&
663  }
664 
672  bool operator != (const DRMEncryptData& other) const {
673  return !(is_encrypt_metadata == other.is_encrypt_metadata &&
674  sub_filter == other.sub_filter &&
675  cipher == other.cipher && key_length == other.key_length &&
676  is_owner == other.is_owner &&
678  }
679 
703  this->is_encrypt_metadata = is_encrypt_metadata;
704  this->sub_filter = sub_filter;
705  this->cipher = cipher;
706  this->key_length = key_length;
707  this->is_owner = is_owner;
708  this->user_permissions = user_permissions;
709  }
710 
734  bool is_owner;
740 };
741 
747 class DRMSecurityHandler FS_FINAL : public SecurityHandler {
748  public:
756  explicit DRMSecurityHandler(const foxit::pdf::SecurityHandler& other);
757 
768  bool Initialize(const DRMEncryptData& encrypt_data, const char* file_id, const String& initial_key);
787  WString GetDRMValue(const char* key);
807  bool SetDRMValue(const char* key, const WString& value);
808 
819  bool VerifyEncryptionParams();
820 };
821 
823 class CustomEncryptData FS_FINAL {
824  public:
834  this->is_encrypt_metadata = is_encrypt_metadata;
835  this->filter = filter;
836  this->sub_filter = sub_filter;
837  }
838 
841  : is_encrypt_metadata(true)
842  , filter("")
843  , sub_filter("") {}
844 
852  filter = other.filter;
853  sub_filter = other.sub_filter;
854  }
864  filter = other.filter;
865  sub_filter = other.sub_filter;
866  return *this;
867  }
868 
876  bool operator == (const CustomEncryptData& other) const {
877  return (is_encrypt_metadata == other.is_encrypt_metadata &&
878  filter == other.filter && sub_filter == other.sub_filter);
879  }
880 
888  bool operator != (const CustomEncryptData& other) const {
889  return !(is_encrypt_metadata == other.is_encrypt_metadata &&
890  filter == other.filter && sub_filter == other.sub_filter);
891  }
902  void Set(bool is_encrypt_metadata, const String& filter, const String& sub_filter) {
903  this->is_encrypt_metadata = is_encrypt_metadata;
904  this->filter = filter;
905  this->sub_filter = sub_filter;
906  }
907 
917 };
918 
924 class CustomSecurityHandler FS_FINAL : public SecurityHandler {
925  public:
933  explicit CustomSecurityHandler(const foxit::pdf::SecurityHandler& other);
934 
955  bool Initialize(const CustomEncryptData& encrypt_data,
956  const CustomSecurityCallback* callback, const char* encrypt_info = "");
957 };
958 
960 class RMSEncryptData FS_FINAL {
961  public:
991  float irm_version = 1.0) {
992  this->is_encrypt_metadata = is_encrypt_metadata;
993  this->publish_license = publish_license;
994  this->server_eul_list = server_eul_list;
995  if (irm_version<1.0)
996  this->irm_version = 1.0;
997  else
998  this->irm_version = irm_version;
999  }
1000 
1003  : is_encrypt_metadata(true)
1004  , publish_license("")
1005  , irm_version(1.0) {}
1006 
1016  irm_version = other.irm_version;
1017  }
1018 
1030  irm_version = other.irm_version;
1031  return *this;
1032  }
1033 
1041  bool operator == (const RMSEncryptData& other) const {
1043  fabs(irm_version - other.irm_version) <= FLT_EPSILON) {
1044  if (server_eul_list.GetSize() == other.server_eul_list.GetSize()) {
1045  for (size_t i=0; i<server_eul_list.GetSize(); i++) {
1046  if (server_eul_list[i] != other.server_eul_list[i]) return false;
1047  }
1048  return true;
1049  }
1050  }
1051  return false;
1052  }
1053 
1061  bool operator != (const RMSEncryptData& other) const {
1063  fabs(irm_version - other.irm_version) <= FLT_EPSILON)) {
1064  if (server_eul_list.GetSize() == other.server_eul_list.GetSize()) {
1065  if (server_eul_list.GetSize() == 0) return false;
1066  for (size_t i=0; i<server_eul_list.GetSize(); i++) {
1067  if (server_eul_list[i] == other.server_eul_list[i]) return false;
1068  }
1069  return true;
1070  }
1071  }
1072  return false;
1073  }
1074 
1106  float irm_version = 1.0) {
1107  this->is_encrypt_metadata = is_encrypt_metadata;
1108  this->publish_license = publish_license;
1109  this->server_eul_list = server_eul_list;
1110  if (irm_version<1.0)
1111  this->irm_version = 1.0;
1112  else
1113  this->irm_version = irm_version;
1114  }
1115 
1151 };
1152 
1163 class RMSSecurityHandler FS_FINAL : public SecurityHandler {
1164  public:
1182  explicit RMSSecurityHandler(const foxit::pdf::SecurityHandler& other);
1183 
1202  bool Initialize(const RMSEncryptData& encrypt_data, const RMSSecurityCallback* callback);
1203 };
1204 
1211  public:
1217  virtual void Release() = 0;
1225 
1226  protected:
1227  ~SecurityCallback() {}
1228 };
1229 
1239  public:
1258  virtual String GetDecryptionKey(const void* envelope_buffer, uint32 envelope_length) = 0;
1259 
1260  protected:
1262 };
1263 
1273  public:
1292  virtual bool IsOwner(const PDFDoc& document, const char* sub_filter) = 0;
1304  virtual uint32 GetUserPermissions(const PDFDoc& document, const char* sub_filter) = 0;
1316  virtual SecurityHandler::CipherType GetCipherType(const PDFDoc& document, const char* sub_filter) = 0;
1330  virtual uint32 GetKeyLength(const PDFDoc& document, const char* sub_filter) = 0;
1341  virtual String GetFileID(const PDFDoc& document, const char* sub_filter) = 0;
1352  virtual String GetInitialKey(const PDFDoc& document, const char* sub_filter) = 0;
1353 
1354  protected:
1355  ~DRMSecurityCallback() {}
1356 };
1357 
1367  public:
1387  virtual void* CreateContext(const char* filter, const char* sub_filter, const char* encrypt_info) = 0;
1398  virtual bool ReleaseContext(void* context) = 0;
1412  virtual uint32 GetUserPermissions(const void* context, uint32 user_permission) = 0;
1423  virtual bool IsOwner(const void* context) = 0;
1435  virtual SecurityHandler::CipherType GetCipher(const void* context) = 0;
1446  virtual String GetEncryptKey(const void* context) = 0;
1458  virtual uint32 GetDecryptedSize(const void* context, uint32 src_data_size) = 0;
1471  virtual void* StartDecryptor(const void* context, int obj_num, int gen_num) = 0;
1484  virtual String DecryptData(const void* decryptor, const void* encrypted_data, uint32 encrypted_data_len) = 0;
1495  virtual String FinishDecryptor(void* decryptor) = 0;
1510  virtual uint32 GetEncryptedSize(const void* context, int obj_num, int gen_num,
1511  const void* src_data, uint32 src_data_len) = 0;
1528  virtual bool EncryptData(const void* context, int obj_num, int gen_num,
1529  const void* src_data, uint32 src_data_len,
1530  void* out_dst_buffer, uint32* out_dst_buffer_len) = 0;
1531 
1547  virtual bool UseStandardCryptoMethod(const void* context) { return false; }
1548 
1549  protected:
1551 };
1552 
1562  public:
1571 
1572  protected:
1573  ~RMSSecurityCallback() {}
1574 };
1575 } // namespace pdf
1576 } // namespace foxit
1577 #endif // FS_SECURITY_H_
1578 
void SetAES256ModifyFlags(uint32 modify_flags)
(Only for AES-256) Set modify flags to decide which security data or password will be modified during...
If set, user permissions and "is encrypt metadata" values (which are defined in StdEncryptData) will ...
Definition: fs_security.h:298
StdEncryptData()
Constructor.
Definition: fs_security.h:167
String sub_filter
The sub filter name that specifies the syntax of the encryption dictionary contents....
Definition: fs_security.h:916
bool InitializeW(const StdEncryptData &encrypt_data, const WString &user_password, const WString &owner_password)
(Only for AES-256) Initialize current standard security handler.
bool Initialize(const CustomEncryptData &encrypt_data, const CustomSecurityCallback *callback, const char *encrypt_info="")
Initialize current custom security handler.
bool SetDRMValue(const char *key, const WString &value)
Set the DRM value for a specified parameter.
CertificateEncryptData(const CertificateEncryptData &other)
Constructor, with another certificate encrypt data object.
Definition: fs_security.h:393
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:912
bool operator !=(const CertificateEncryptData &other) const
Not equal operator.
Definition: fs_security.h:439
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of current security callback.
Definition: fs_security.h:1247
SecurityHandler::CipherType cipher
Cipher type. Please refer to values starting from SecurityHandler::e_CipherRC4 and this should be one...
Definition: fs_security.h:270
String filter
The filter name of a custom security callback object. It should not be an empty string.
Definition: fs_security.h:914
bool operator !=(const SecurityHandler &other)
Not equal operator.
virtual String GetEncryptKey(const void *context)=0
A callback function used to get the encryption key.
bool Initialize(const CertificateEncryptData &encrypt_data, const String &encrypt_key)
Initialize current certificate security handler.
bool operator==(const RMSEncryptData &other) const
Equal operator.
Definition: fs_security.h:1041
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.
virtual bool ReleaseContext(void *context)=0
A callback function used to release the context for encryption and decryption.
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.
SecurityHandler::CipherType cipher
Cipher type. Please refer to values starting from SecurityHandler::e_CipherRC4 and this should be one...
Definition: fs_security.h:722
Header file for PDF document related definitions and classes.
If set, only owner password will be modified during encryption process.
Definition: fs_security.h:302
int key_length
The key length, in bytes.
Definition: fs_security.h:280
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:990
Definition: fs_security.h:1238
Definition: fs_security.h:1272
DRMSecurityHandler()
Constructor function.
Definition: fs_security.h:747
virtual SecurityHandler::CipherType GetCipher(const void *context)=0
A callback function used to get the cipher type.
virtual ~SecurityHandler()
Destructor.
Definition: fs_security.h:535
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.
String publish_license
The Encoded Publishing License issued from server to the Content publisher, in ASCII encoding....
Definition: fs_security.h:1131
ModifyFlag
(Only for AES-256) Enumeration for modify flag used to decide which security data or password will be...
Definition: fs_security.h:296
Encryption type: customized encryption.
Definition: fs_pdfdoc.h:807
WIDE STRING CLASS.
Definition: fx_string.h:1461
bool operator !=(const RMSEncryptData &other) const
Not equal operator.
Definition: fs_security.h:1061
WString GetDRMValue(const char *key)
Get the DRM value for a specified parameter.
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.
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:734
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.
RMSEncryptData & operator=(const RMSEncryptData &other)
Assign operator.
Definition: fs_security.h:1026
Definition: fs_pdfdoc.h:772
bool IsEmpty() const
Check whether current object is empty or not.
Definition: fs_security.h:579
Not use encryption algorithm.
Definition: fs_security.h:65
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1570
virtual uint32 GetUserPermissions(const void *context, uint32 user_permission)=0
A callback function used to get the user permissions.
DRMEncryptData & operator=(const DRMEncryptData &other)
Assign operator.
Definition: fs_security.h:640
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1224
void Set(bool is_encrypt_metadata, const String &filter, const String &sub_filter)
Set value.
Definition: fs_security.h:902
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:1547
bool operator==(const StdEncryptData &other) const
Equal operator.
Definition: fs_security.h:207
RMSEncryptData(const RMSEncryptData &other)
Constructor, with another RMS encrypt data object.
Definition: fs_security.h:1012
Definition: fs_security.h:960
Definition: fs_security.h:137
bool operator==(const char *str1, const CFX_ByteString &str2)
Check if two byte strings are equal.
Definition: fs_basictypes.h:128
CustomEncryptData(const CustomEncryptData &other)
Constructor, with another custom encrypt data object.
Definition: fs_security.h:850
bool Initialize(const RMSEncryptData &encrypt_data, const RMSSecurityCallback *callback)
Initialize current Microsoft RMS security handler.
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
StringArray envelopes
A string array which specifies an array of certificate envelopes. This array should contains one or m...
Definition: fs_security.h:484
CipherType
Enumeration for Encryption Algorithm.
Definition: fs_security.h:63
SecurityHandler & operator=(const SecurityHandler &other)
Assign operator.
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:600
If set, user password and owner password will be modified during encryption process.
Definition: fs_security.h:300
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:701
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
virtual bool IsOwner(const void *context)=0
A callback function used to check if current user is the owner of the PDF document.
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.
bool Initialize(const StdEncryptData &encrypt_data, const String &user_password, const String &owner_password)
(Not support AES-256) Initialize current standard security handler.
virtual void * StartDecryptor(const void *context, int obj_num, int gen_num)=0
A callback function used to start a decryption.
SecurityHandler::CipherType cipher
Cipher type. Please refer to values starting from SecurityHandler::e_CipherRC4 and this should be one...
Definition: fs_security.h:479
CustomEncryptData(bool is_encrypt_metadata, const String &filter, const String &sub_filter)
Constructor, with parameters.
Definition: fs_security.h:833
DRMEncryptData(const DRMEncryptData &other)
Constructor, with another DRM encrypt data object.
Definition: fs_security.h:624
Definition: fx_basic.h:1297
StdEncryptData(bool is_encrypt_metadata, uint32 user_permissions, SecurityHandler::CipherType cipher, int key_length)
Constructor, with parameters.
Definition: fs_security.h:158
virtual uint32 GetUserPermissions(const PDFDoc &document, const char *sub_filter)=0
A callback function used to get the current user permissions.
void Set(bool is_encrypt_metadata, uint32 user_permissions, SecurityHandler::CipherType cipher, int key_length)
Set value.
Definition: fs_security.h:249
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:196
Encryption type: digital certificate encryption.
Definition: fs_pdfdoc.h:803
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:214
Header file for common definitions and classes.
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1281
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:1150
virtual void Release()=0
A callback function used to release current callback object itself.
Definition: fs_security.h:1366
Definition: fs_security.h:1561
CertificateEncryptData(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray &envelopes)
Constructor, with parameters.
Definition: fs_security.h:377
DRMEncryptData()
Constructor.
Definition: fs_security.h:611
Definition: fs_security.h:823
virtual uint32 GetDecryptedSize(const void *context, uint32 src_data_size)=0
A callback function used to get the estimated decrypted data size.
bool Initialize(const DRMEncryptData &encrypt_data, const char *file_id, const String &initial_key)
Initialize current DRM security handler.
Encryption type: Microsoft RMS encryption.
Definition: fs_pdfdoc.h:809
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
Definition: fs_basictypes.h:449
Definition: fs_basictypes.h:230
size_t GetSize() const
Get the size of elements in current array.
StdEncryptData(const StdEncryptData &other)
Constructor, with another standard encrypt data object.
Definition: fs_security.h:178
Definition: fs_security.h:1210
bool operator !=(const StdEncryptData &other) const
Not equal operator.
Definition: fs_security.h:221
CertificateEncryptData()
Constructor.
Definition: fs_security.h:384
CustomEncryptData & operator=(const CustomEncryptData &other)
Assign operator.
Definition: fs_security.h:862
virtual uint32 GetKeyLength(const PDFDoc &document, const char *sub_filter)=0
A callback function used to get the length of cipher key.
bool operator !=(const CustomEncryptData &other) const
Not equal operator.
Definition: fs_security.h:888
bool operator !=(const DRMEncryptData &other) const
Not equal operator.
Definition: fs_security.h:672
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:1145
void Set(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray &envelopes)
Set value.
Definition: fs_security.h:464
Definition: fs_security.h:924
Definition: fs_security.h:56
bool VerifyEncryptionParams()
Verify encryption parameters.
RMSEncryptData()
Constructor.
Definition: fs_security.h:1002
Foxit namespace.
Definition: fs_taggedpdf.h:27
Definition: fs_security.h:1163
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of current security handler.
BYTE STRING CLASS.
Definition: fx_string.h:317
Unknown encryption type.
Definition: fs_pdfdoc.h:797
EncryptType
Enumeration for encryption type.
Definition: fs_pdfdoc.h:795
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1375
virtual String DecryptData(const void *decryptor, const void *encrypted_data, uint32 encrypted_data_len)=0
A callback function used to decrypt the encrypted data.
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:1120
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:739
virtual String FinishDecryptor(void *decryptor)=0
A callback function used to finish the decryption.
bool operator!=(const char *str1, const CFX_ByteString &str2)
Check if two byte strings are not equal.
Definition: fs_basictypes.h:140
int key_length
The key length, in bytes. For SecurityHandler::e_CipherRC4 cipher, this value should be between 5 an...
Definition: fs_security.h:729
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
Encryption type: Foxit DRM encryption.
Definition: fs_pdfdoc.h:805
virtual SecurityHandler::CipherType GetCipherType(const PDFDoc &document, const char *sub_filter)=0
A callback function used to get the cipher type for encryption algorithm.
StdEncryptData & operator=(const StdEncryptData &other)
Assign operator.
Definition: fs_security.h:192
bool operator==(const DRMEncryptData &other) const
Equal operator.
Definition: fs_security.h:657
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:1105
CertificateEncryptData & operator=(const CertificateEncryptData &other)
Assign operator.
Definition: fs_security.h:406
Definition: fs_security.h:288
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:715
Definition: fs_security.h:365
virtual String GetFileID(const PDFDoc &document, const char *sub_filter)=0
A callback function used to get the file identity string.
bool operator==(const CustomEncryptData &other) const
Equal operator.
Definition: fs_security.h:876
bool operator==(const SecurityHandler &other)
Equal operator.
Use RC4 encryption algorithm, with the key length between 5 bytes and 16 bytes.
Definition: fs_security.h:67
CustomEncryptData()
Constructor.
Definition: fs_security.h:840
bool operator==(const CertificateEncryptData &other) const
Equal operator.
Definition: fs_security.h:420
String sub_filter
The sub filter name that specifies the syntax of the encryption dictionary contents.
Definition: fs_security.h:717