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 
175 
184  cipher = other.cipher;
185  key_length = other.key_length;
186  }
187 
198  cipher = other.cipher;
199  key_length = other.key_length;
200  return *this;
201  }
202 
210  bool operator == (const StdEncryptData& other) const {
211  return (is_encrypt_metadata == other.is_encrypt_metadata &&
213  cipher == other.cipher &&
214  key_length == other.key_length);
215  }
216 
224  bool operator != (const StdEncryptData& other) const {
225  return !(is_encrypt_metadata == other.is_encrypt_metadata &&
227  cipher == other.cipher &&
228  key_length == other.key_length);
229  }
230 
253  this->is_encrypt_metadata = is_encrypt_metadata;
254  this->user_permissions = user_permissions;
255  this->cipher = cipher;
256  this->key_length = key_length;
257  }
258 
284 };
285 
291 class StdSecurityHandler FS_FINAL : public SecurityHandler {
292  public:
299  typedef enum _ModifyFlag {
306  } ModifyFlag;
307 
308 
316  explicit StdSecurityHandler(const foxit::pdf::SecurityHandler& other);
317 
333  bool Initialize(const StdEncryptData& encrypt_data, const String& user_password, const String& owner_password);
334 
347  bool InitializeW(const StdEncryptData& encrypt_data, const WString& user_password, const WString& owner_password);
348 
364  void SetAES256ModifyFlags(uint32 modify_flags);
365 };
366 
368 class CertificateEncryptData FS_FINAL {
369  public:
381  this->is_encrypt_metadata = is_encrypt_metadata;
382  this->cipher = cipher;
383  this->envelopes = envelopes;
384  }
385 
388  : is_encrypt_metadata(true)
389  , cipher(SecurityHandler::e_CipherNone) {}
390 
393 
401  cipher = other.cipher;
402  envelopes = other.envelopes;
403  }
404 
414  cipher = other.cipher;
415  envelopes = other.envelopes;
416  return *this;
417  }
418 
426  bool operator == (const CertificateEncryptData& other) const {
427  if (is_encrypt_metadata == other.is_encrypt_metadata && cipher == other.cipher) {
428  if (envelopes.GetSize() == other.envelopes.GetSize()) {
429  for (size_t i=0; i<envelopes.GetSize(); i++) {
430  if (envelopes[i] != other.envelopes[i]) return false;
431  }
432  return true;
433  }
434  }
435  return false;
436  }
437 
445  bool operator != (const CertificateEncryptData& other) const {
446  if (!(is_encrypt_metadata == other.is_encrypt_metadata && cipher == other.cipher)) {
447  if (envelopes.GetSize() == other.envelopes.GetSize()) {
448  if (envelopes.GetSize() == 0) return false;
449  for (size_t i=0; i<envelopes.GetSize(); i++) {
450  if (envelopes[i] == other.envelopes[i]) return false;
451  }
452  return true;
453  }
454  }
455  return false;
456  }
457 
471  this->is_encrypt_metadata = is_encrypt_metadata;
472  this->cipher = cipher;
473  this->envelopes =envelopes;
474  }
475 
491 };
492 
493 #if (_FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_ || defined(SWIG)) && !defined(_SWIG_JAVA_) && !defined(_SWIG_DOTNET_) && !defined(_OC_) && !defined(_SWIG_MACOC_)
494 
495 class Envelope : public Base {
496  public:
503  Envelope(const void* buffer, size_t size);
509  Envelope(const char* certFilePath);
510 
511  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
512  explicit Envelope(FS_HANDLE handle);
514  Envelope(const Envelope& other);
516  bool operator==(const Envelope& other) const;
518  bool operator!=(const Envelope& other) const;
519 
528  String GetDecryptionKey(const char* p12FilePath, const String& password);
529 
530 };
531 
533 typedef CFX_ArrayTemplate<Envelope> EnvelopeArray;
534 
535 #endif
536 
543  public:
552 
553 #if (_FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_ || defined(SWIG)) && !defined(_SWIG_JAVA_) && !defined(_SWIG_DOTNET_) && !defined(_OC_) && !defined(_SWIG_MACOC_)
554 
566  bool Initialize(foxit::pdf::EnvelopeArray envelopes, foxit::pdf::SecurityHandler::CipherType cipher, bool is_encrypt_metadata);
567 #endif // (_FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_ || defined(SWIG)) && !defined(_SWIG_JAVA_) && !defined(_SWIG_DOTNET_) && !defined(_OC_) && !defined(_SWIG_MACOC_)
568 
582  bool Initialize(const CertificateEncryptData& encrypt_data, const String& encrypt_key);
583 };
584 
586 class DRMEncryptData FS_FINAL {
587  public:
609  this->is_encrypt_metadata = is_encrypt_metadata;
610  this->sub_filter = sub_filter;
611  this->cipher = cipher;
612  this->key_length = key_length;
613  this->is_owner = is_owner;
614  this->user_permissions = user_permissions;
615  }
616 
619  : is_encrypt_metadata(true)
620  , sub_filter("")
621  , cipher(SecurityHandler::e_CipherNone)
622  , key_length(0)
623  , is_owner(false)
624  , user_permissions(0) {}
625 
628 
636  sub_filter = other.sub_filter;
637  cipher = other.cipher;
638  key_length = other.key_length;
639  is_owner = other.is_owner;
641  }
642 
652  sub_filter = other.sub_filter;
653  cipher = other.cipher;
654  key_length = other.key_length;
655  is_owner = other.is_owner;
657  return *this;
658  }
659 
667  bool operator == (const DRMEncryptData& other) const {
668  return (is_encrypt_metadata == other.is_encrypt_metadata &&
669  sub_filter == other.sub_filter &&
670  cipher == other.cipher && key_length == other.key_length &&
671  is_owner == other.is_owner &&
673  }
674 
682  bool operator != (const DRMEncryptData& other) const {
683  return !(is_encrypt_metadata == other.is_encrypt_metadata &&
684  sub_filter == other.sub_filter &&
685  cipher == other.cipher && key_length == other.key_length &&
686  is_owner == other.is_owner &&
688  }
689 
713  this->is_encrypt_metadata = is_encrypt_metadata;
714  this->sub_filter = sub_filter;
715  this->cipher = cipher;
716  this->key_length = key_length;
717  this->is_owner = is_owner;
718  this->user_permissions = user_permissions;
719  }
720 
744  bool is_owner;
750 };
751 
757 class DRMSecurityHandler FS_FINAL : public SecurityHandler {
758  public:
766  explicit DRMSecurityHandler(const foxit::pdf::SecurityHandler& other);
767 
778  bool Initialize(const DRMEncryptData& encrypt_data, const char* file_id, const String& initial_key);
797  WString GetDRMValue(const char* key);
817  bool SetDRMValue(const char* key, const WString& value);
818 
829  bool VerifyEncryptionParams();
830 };
831 
833 class CustomEncryptData FS_FINAL {
834  public:
844  this->is_encrypt_metadata = is_encrypt_metadata;
845  this->filter = filter;
846  this->sub_filter = sub_filter;
847  }
848 
851  : is_encrypt_metadata(true)
852  , filter("")
853  , sub_filter("") {}
854 
857 
865  filter = other.filter;
866  sub_filter = other.sub_filter;
867  }
877  filter = other.filter;
878  sub_filter = other.sub_filter;
879  return *this;
880  }
881 
889  bool operator == (const CustomEncryptData& other) const {
890  return (is_encrypt_metadata == other.is_encrypt_metadata &&
891  filter == other.filter && sub_filter == other.sub_filter);
892  }
893 
901  bool operator != (const CustomEncryptData& other) const {
902  return !(is_encrypt_metadata == other.is_encrypt_metadata &&
903  filter == other.filter && sub_filter == other.sub_filter);
904  }
915  void Set(bool is_encrypt_metadata, const String& filter, const String& sub_filter) {
916  this->is_encrypt_metadata = is_encrypt_metadata;
917  this->filter = filter;
918  this->sub_filter = sub_filter;
919  }
920 
930 };
931 
937 class CustomSecurityHandler FS_FINAL : public SecurityHandler {
938  public:
946  explicit CustomSecurityHandler(const foxit::pdf::SecurityHandler& other);
947 
968  bool Initialize(const CustomEncryptData& encrypt_data,
969  const CustomSecurityCallback * callback, const char* encrypt_info = "");
970 };
971 
973 class RMSEncryptData FS_FINAL {
974  public:
1004  float irm_version = 1.0) {
1005  this->is_encrypt_metadata = is_encrypt_metadata;
1006  this->publish_license = publish_license;
1007  this->server_eul_list = server_eul_list;
1008  if (irm_version<1.0)
1009  this->irm_version = 1.0;
1010  else
1011  this->irm_version = irm_version;
1012  }
1013 
1016  : is_encrypt_metadata(true)
1017  , publish_license("")
1018  , irm_version(1.0) {}
1019 
1022 
1032  irm_version = other.irm_version;
1033  }
1034 
1046  irm_version = other.irm_version;
1047  return *this;
1048  }
1049 
1057  bool operator == (const RMSEncryptData& other) const {
1059  fabs(irm_version - other.irm_version) <= FLT_EPSILON) {
1060  if (server_eul_list.GetSize() == other.server_eul_list.GetSize()) {
1061  for (size_t i=0; i<server_eul_list.GetSize(); i++) {
1062  if (server_eul_list[i] != other.server_eul_list[i]) return false;
1063  }
1064  return true;
1065  }
1066  }
1067  return false;
1068  }
1069 
1077  bool operator != (const RMSEncryptData& other) const {
1079  fabs(irm_version - other.irm_version) <= FLT_EPSILON)) {
1080  if (server_eul_list.GetSize() == other.server_eul_list.GetSize()) {
1081  if (server_eul_list.GetSize() == 0) return false;
1082  for (size_t i=0; i<server_eul_list.GetSize(); i++) {
1083  if (server_eul_list[i] == other.server_eul_list[i]) return false;
1084  }
1085  return true;
1086  }
1087  }
1088  return false;
1089  }
1090 
1122  float irm_version = 1.0) {
1123  this->is_encrypt_metadata = is_encrypt_metadata;
1124  this->publish_license = publish_license;
1125  this->server_eul_list = server_eul_list;
1126  if (irm_version<1.0)
1127  this->irm_version = 1.0;
1128  else
1129  this->irm_version = irm_version;
1130  }
1131 
1167 };
1168 
1179 class RMSSecurityHandler FS_FINAL : public SecurityHandler {
1180  public:
1198  explicit RMSSecurityHandler(const foxit::pdf::SecurityHandler& other);
1199 
1218  bool Initialize(const RMSEncryptData& encrypt_data, const RMSSecurityCallback* callback);
1219 };
1220 
1227  public:
1233  virtual void Release() = 0;
1241 
1242  protected:
1243  ~SecurityCallback() {}
1244 };
1245 
1255  public:
1274  virtual String GetDecryptionKey(const void* envelope_buffer, uint32 envelope_length) = 0;
1275 
1276  protected:
1278 };
1279 
1289  public:
1308  virtual bool IsOwner(const PDFDoc& document, const char* sub_filter) = 0;
1320  virtual uint32 GetUserPermissions(const PDFDoc& document, const char* sub_filter) = 0;
1332  virtual SecurityHandler::CipherType GetCipherType(const PDFDoc& document, const char* sub_filter) = 0;
1346  virtual uint32 GetKeyLength(const PDFDoc& document, const char* sub_filter) = 0;
1357  virtual String GetFileID(const PDFDoc& document, const char* sub_filter) = 0;
1368  virtual String GetInitialKey(const PDFDoc& document, const char* sub_filter) = 0;
1369 
1370  protected:
1371  ~DRMSecurityCallback() {}
1372 };
1373 
1383  public:
1403  virtual void* CreateContext(const char* filter, const char* sub_filter, const char* encrypt_info) = 0;
1414  virtual bool ReleaseContext(void* context) = 0;
1428  virtual uint32 GetUserPermissions(const void* context, uint32 user_permission) = 0;
1439  virtual bool IsOwner(const void* context) = 0;
1451  virtual SecurityHandler::CipherType GetCipher(const void* context) = 0;
1462  virtual String GetEncryptKey(const void* context) = 0;
1474  virtual uint32 GetDecryptedSize(const void* context, uint32 src_data_size) = 0;
1487  virtual void* StartDecryptor(const void* context, int obj_num, int gen_num) = 0;
1500  virtual String DecryptData(const void* decryptor, const void* encrypted_data, uint32 encrypted_data_len) = 0;
1511  virtual String FinishDecryptor(void* decryptor) = 0;
1526  virtual uint32 GetEncryptedSize(const void* context, int obj_num, int gen_num,
1527  const void* src_data, uint32 src_data_len) = 0;
1544  virtual bool EncryptData(const void* context, int obj_num, int gen_num,
1545  const void* src_data, uint32 src_data_len,
1546  void* out_dst_buffer, uint32* out_dst_buffer_len) = 0;
1547 
1563  virtual bool UseStandardCryptoMethod(const void* context) { return false; }
1564 
1565  protected:
1567 };
1568 
1578  public:
1587 
1588  protected:
1589  ~RMSSecurityCallback() {}
1590 };
1591 } // namespace pdf
1592 } // namespace foxit
1593 #endif // FS_SECURITY_H_
1594 
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:301
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:929
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:399
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:925
bool operator !=(const CertificateEncryptData &other) const
Not equal operator.
Definition: fs_security.h:445
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of current security callback.
Definition: fs_security.h:1263
SecurityHandler::CipherType cipher
Cipher type. Please refer to values starting from SecurityHandler::e_CipherRC4 and this should be one...
Definition: fs_security.h:273
String filter
The filter name of a custom security callback object. It should not be an empty string.
Definition: fs_security.h:927
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.
~StdEncryptData()
Destructor.
Definition: fs_security.h:174
bool operator==(const RMSEncryptData &other) const
Equal operator.
Definition: fs_security.h:1057
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:732
Header file for PDF document related definitions and classes.
If set, only owner password will be modified during encryption process.
Definition: fs_security.h:305
int key_length
The key length, in bytes.
Definition: fs_security.h:283
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:1003
Definition: fs_security.h:1254
Definition: fs_security.h:1288
DRMSecurityHandler()
Constructor function.
Definition: fs_security.h:757
virtual SecurityHandler::CipherType GetCipher(const void *context)=0
A callback function used to get the cipher type.
virtual ~SecurityHandler()
Destructor.
Definition: fs_security.h:542
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:1147
ModifyFlag
(Only for AES-256) Enumeration for modify flag used to decide which security data or password will be...
Definition: fs_security.h:299
Encryption type: customized encryption.
Definition: fs_pdfdoc.h:424
WIDE STRING CLASS.
Definition: fx_string.h:1452
bool operator !=(const RMSEncryptData &other) const
Not equal operator.
Definition: fs_security.h:1077
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:744
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:1042
Definition: fs_pdfdoc.h:389
bool IsEmpty() const
Check whether current object is empty or not.
Definition: fs_security.h:586
~DRMEncryptData()
Destructor.
Definition: fs_security.h:627
Not use encryption algorithm.
Definition: fs_security.h:65
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1586
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:650
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1240
void Set(bool is_encrypt_metadata, const String &filter, const String &sub_filter)
Set value.
Definition: fs_security.h:915
virtual bool UseStandardCryptoMethod(const void *context)
A callback function to check if to use stanard crypto method or custom crypto method.
Definition: fs_security.h:1563
bool operator==(const StdEncryptData &other) const
Equal operator.
Definition: fs_security.h:210
RMSEncryptData(const RMSEncryptData &other)
Constructor, with another RMS encrypt data object.
Definition: fs_security.h:1028
Definition: fs_security.h:973
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:863
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:490
CipherType
Enumeration for Encryption Algorithm.
Definition: fs_security.h:63
~CertificateEncryptData()
Destructor.
Definition: fs_security.h:392
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:607
If set, user password and owner password will be modified during encryption process.
Definition: fs_security.h:303
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:711
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:480
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:485
~CustomEncryptData()
Destructor.
Definition: fs_security.h:856
CustomEncryptData(bool is_encrypt_metadata, const String &filter, const String &sub_filter)
Constructor, with parameters.
Definition: fs_security.h:843
DRMEncryptData(const DRMEncryptData &other)
Constructor, with another DRM encrypt data object.
Definition: fs_security.h:634
Definition: fx_basic.h:1288
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:252
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:198
Encryption type: digital certificate encryption.
Definition: fs_pdfdoc.h:420
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:216
Header file for common definitions and classes.
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1297
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:1166
virtual void Release()=0
A callback function used to release current callback object itself.
Definition: fs_security.h:1382
Definition: fs_security.h:1577
CertificateEncryptData(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray &envelopes)
Constructor, with parameters.
Definition: fs_security.h:380
DRMEncryptData()
Constructor.
Definition: fs_security.h:618
Definition: fs_security.h:833
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:426
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:263
Definition: fs_basictypes.h:399
Definition: fs_basictypes.h:228
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:181
Definition: fs_security.h:1226
bool operator !=(const StdEncryptData &other) const
Not equal operator.
Definition: fs_security.h:224
CertificateEncryptData()
Constructor.
Definition: fs_security.h:387
CustomEncryptData & operator=(const CustomEncryptData &other)
Assign operator.
Definition: fs_security.h:875
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:901
bool operator !=(const DRMEncryptData &other) const
Not equal operator.
Definition: fs_security.h:682
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:1161
void Set(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray &envelopes)
Set value.
Definition: fs_security.h:470
Definition: fs_security.h:937
Definition: fs_security.h:56
bool VerifyEncryptionParams()
Verify encryption parameters.
RMSEncryptData()
Constructor.
Definition: fs_security.h:1015
Foxit namespace.
Definition: fs_compare.h:27
Definition: fs_security.h:1179
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:414
EncryptType
Enumeration for encryption type.
Definition: fs_pdfdoc.h:412
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1391
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:1136
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:749
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
~RMSEncryptData()
Destructor.
Definition: fs_security.h:1021
int key_length
The key length, in bytes. For SecurityHandler::e_CipherRC4 cipher, this value should be between 5 an...
Definition: fs_security.h:739
uint32 user_permissions
The user permissions. Please refer to values starting from PDFDoc::e_PermPrint and this should be one...
Definition: fs_security.h:268
Encryption type: Foxit DRM encryption.
Definition: fs_pdfdoc.h:422
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:195
bool operator==(const DRMEncryptData &other) const
Equal operator.
Definition: fs_security.h:667
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:1121
CertificateEncryptData & operator=(const CertificateEncryptData &other)
Assign operator.
Definition: fs_security.h:412
Definition: fs_security.h:291
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:725
Definition: fs_security.h:368
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:889
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:850
bool operator==(const CertificateEncryptData &other) const
Equal operator.
Definition: fs_security.h:426
String sub_filter
The sub filter name that specifies the syntax of the encryption dictionary contents.
Definition: fs_security.h:727