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 
82  SecurityHandler(const SecurityHandler& other);
83  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
84  explicit SecurityHandler(FS_HANDLE handle);
86  virtual ~SecurityHandler();
87 
103  bool operator == (const SecurityHandler& other);
111  bool operator != (const SecurityHandler& other);
112 
120  bool IsEmpty() const;
121 
129 
130 };
131 
133 class StdEncryptData FS_FINAL {
134  public:
155  int key_length) {
156  this->is_encrypt_metadata = is_encrypt_metadata;
157  this->user_permissions = user_permissions;
158  this->cipher = cipher;
159  this->key_length = key_length;
160  }
161 
164  : is_encrypt_metadata(true)
165  , user_permissions(0)
166  , cipher(SecurityHandler::e_CipherNone)
167  , key_length(0) {}
168 
171 
180  cipher = other.cipher;
181  key_length = other.key_length;
182  }
183 
194  cipher = other.cipher;
195  key_length = other.key_length;
196  return *this;
197  }
198 
206  bool operator == (const StdEncryptData& other) const {
207  return (is_encrypt_metadata == other.is_encrypt_metadata &&
209  cipher == other.cipher &&
210  key_length == other.key_length);
211  }
212 
220  bool operator != (const StdEncryptData& other) const {
221  return !(is_encrypt_metadata == other.is_encrypt_metadata &&
223  cipher == other.cipher &&
224  key_length == other.key_length);
225  }
226 
249  this->is_encrypt_metadata = is_encrypt_metadata;
250  this->user_permissions = user_permissions;
251  this->cipher = cipher;
252  this->key_length = key_length;
253  }
254 
280 };
281 
287 class StdSecurityHandler FS_FINAL : public SecurityHandler {
288  public:
296  explicit StdSecurityHandler(const foxit::pdf::SecurityHandler& other);
297 
313  bool Initialize(const StdEncryptData& encrypt_data, const String& user_password, const String& owner_password);
314 
327  bool InitializeW(const StdEncryptData& encrypt_data, const WString& user_password, const WString& owner_password);
328 
329 };
330 
332 class CertificateEncryptData FS_FINAL {
333  public:
345  this->is_encrypt_metadata = is_encrypt_metadata;
346  this->cipher = cipher;
347  this->envelopes = envelopes;
348  }
349 
352  : is_encrypt_metadata(true)
353  , cipher(SecurityHandler::e_CipherNone) {}
354 
357 
365  cipher = other.cipher;
366  envelopes = other.envelopes;
367  }
368 
378  cipher = other.cipher;
379  envelopes = other.envelopes;
380  return *this;
381  }
382 
390  bool operator == (const CertificateEncryptData& other) const {
391  if (is_encrypt_metadata == other.is_encrypt_metadata && cipher == other.cipher) {
392  if (envelopes.GetSize() == other.envelopes.GetSize()) {
393  for (size_t i=0; i<envelopes.GetSize(); i++) {
394  if (envelopes[i] != other.envelopes[i]) return false;
395  }
396  return true;
397  }
398  }
399  return false;
400  }
401 
409  bool operator != (const CertificateEncryptData& other) const {
410  if (!(is_encrypt_metadata == other.is_encrypt_metadata && cipher == other.cipher)) {
411  if (envelopes.GetSize() == other.envelopes.GetSize()) {
412  if (envelopes.GetSize() == 0) return false;
413  for (size_t i=0; i<envelopes.GetSize(); i++) {
414  if (envelopes[i] == other.envelopes[i]) return false;
415  }
416  return true;
417  }
418  }
419  return false;
420  }
421 
435  this->is_encrypt_metadata = is_encrypt_metadata;
436  this->cipher = cipher;
437  this->envelopes =envelopes;
438  }
439 
455 };
456 
457 #if (_FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_ || defined(SWIG)) && !defined(_SWIG_JAVA_) && !defined(_SWIG_DOTNET_) && !defined(_OC_) && !defined(_SWIG_MACOC_)
458 
459 class Envelope : public Base {
460  public:
467  Envelope(const void* buffer, size_t size);
473  Envelope(const char* certFilePath);
474 
475  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
476  explicit Envelope(FS_HANDLE handle);
478  Envelope(const Envelope& other);
480  bool operator==(const Envelope& other) const;
482  bool operator!=(const Envelope& other) const;
483 
492  String GetDecryptionKey(const char* p12FilePath, const String& password);
493 
494 };
495 
497 typedef CFX_ArrayTemplate<Envelope> EnvelopeArray;
498 
499 #endif
500 
507  public:
516 
517 #if (_FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_ || defined(SWIG)) && !defined(_SWIG_JAVA_) && !defined(_SWIG_DOTNET_) && !defined(_OC_) && !defined(_SWIG_MACOC_)
518 
530  bool Initialize(foxit::pdf::EnvelopeArray envelopes, foxit::pdf::SecurityHandler::CipherType cipher, bool is_encrypt_metadata);
531 #endif // (_FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_ || defined(SWIG)) && !defined(_SWIG_JAVA_) && !defined(_SWIG_DOTNET_) && !defined(_OC_) && !defined(_SWIG_MACOC_)
532 
546  bool Initialize(const CertificateEncryptData& encrypt_data, const String& encrypt_key);
547 };
548 
550 class DRMEncryptData FS_FINAL {
551  public:
573  this->is_encrypt_metadata = is_encrypt_metadata;
574  this->sub_filter = sub_filter;
575  this->cipher = cipher;
576  this->key_length = key_length;
577  this->is_owner = is_owner;
578  this->user_permissions = user_permissions;
579  }
580 
583  : is_encrypt_metadata(true)
584  , sub_filter("")
585  , cipher(SecurityHandler::e_CipherNone)
586  , key_length(0)
587  , is_owner(false)
588  , user_permissions(0) {}
589 
592 
600  sub_filter = other.sub_filter;
601  cipher = other.cipher;
602  key_length = other.key_length;
603  is_owner = other.is_owner;
605  }
606 
616  sub_filter = other.sub_filter;
617  cipher = other.cipher;
618  key_length = other.key_length;
619  is_owner = other.is_owner;
621  return *this;
622  }
623 
631  bool operator == (const DRMEncryptData& other) const {
632  return (is_encrypt_metadata == other.is_encrypt_metadata &&
633  sub_filter == other.sub_filter &&
634  cipher == other.cipher && key_length == other.key_length &&
635  is_owner == other.is_owner &&
637  }
638 
646  bool operator != (const DRMEncryptData& other) const {
647  return !(is_encrypt_metadata == other.is_encrypt_metadata &&
648  sub_filter == other.sub_filter &&
649  cipher == other.cipher && key_length == other.key_length &&
650  is_owner == other.is_owner &&
652  }
653 
677  this->is_encrypt_metadata = is_encrypt_metadata;
678  this->sub_filter = sub_filter;
679  this->cipher = cipher;
680  this->key_length = key_length;
681  this->is_owner = is_owner;
682  this->user_permissions = user_permissions;
683  }
684 
708  bool is_owner;
714 };
715 
721 class DRMSecurityHandler FS_FINAL : public SecurityHandler {
722  public:
730  explicit DRMSecurityHandler(const foxit::pdf::SecurityHandler& other);
731 
742  bool Initialize(const DRMEncryptData& encrypt_data, const char* file_id, const String& initial_key);
761  WString GetDRMValue(const char* key);
781  bool SetDRMValue(const char* key, const WString& value);
782 
793  bool VerifyEncryptionParams();
794 };
795 
797 class CustomEncryptData FS_FINAL {
798  public:
808  this->is_encrypt_metadata = is_encrypt_metadata;
809  this->filter = filter;
810  this->sub_filter = sub_filter;
811  }
812 
815  : is_encrypt_metadata(true)
816  , filter("")
817  , sub_filter("") {}
818 
821 
829  filter = other.filter;
830  sub_filter = other.sub_filter;
831  }
841  filter = other.filter;
842  sub_filter = other.sub_filter;
843  return *this;
844  }
845 
853  bool operator == (const CustomEncryptData& other) const {
854  return (is_encrypt_metadata == other.is_encrypt_metadata &&
855  filter == other.filter && sub_filter == other.sub_filter);
856  }
857 
865  bool operator != (const CustomEncryptData& other) const {
866  return !(is_encrypt_metadata == other.is_encrypt_metadata &&
867  filter == other.filter && sub_filter == other.sub_filter);
868  }
879  void Set(bool is_encrypt_metadata, const String& filter, const String& sub_filter) {
880  this->is_encrypt_metadata = is_encrypt_metadata;
881  this->filter = filter;
882  this->sub_filter = sub_filter;
883  }
884 
894 };
895 
901 class CustomSecurityHandler FS_FINAL : public SecurityHandler {
902  public:
910  explicit CustomSecurityHandler(const foxit::pdf::SecurityHandler& other);
911 
932  bool Initialize(const CustomEncryptData& encrypt_data,
933  const CustomSecurityCallback * callback, const char* encrypt_info = "");
934 };
935 
937 class RMSEncryptData FS_FINAL {
938  public:
966  float irm_version = 1.0) {
967  this->is_encrypt_metadata = is_encrypt_metadata;
968  this->publish_license = publish_license;
969  this->server_eul_list = server_eul_list;
970  if (irm_version<1.0)
971  this->irm_version = 1.0;
972  else
973  this->irm_version = irm_version;
974  }
975 
978  : is_encrypt_metadata(true)
979  , publish_license("")
980  , irm_version(1.0) {}
981 
984 
994  irm_version = other.irm_version;
995  }
996 
1008  irm_version = other.irm_version;
1009  return *this;
1010  }
1011 
1019  bool operator == (const RMSEncryptData& other) const {
1021  fabs(irm_version - other.irm_version) <= FLT_EPSILON) {
1022  if (server_eul_list.GetSize() == other.server_eul_list.GetSize()) {
1023  for (size_t i=0; i<server_eul_list.GetSize(); i++) {
1024  if (server_eul_list[i] != other.server_eul_list[i]) return false;
1025  }
1026  return true;
1027  }
1028  }
1029  return false;
1030  }
1031 
1039  bool operator != (const RMSEncryptData& other) const {
1041  fabs(irm_version - other.irm_version) <= FLT_EPSILON)) {
1042  if (server_eul_list.GetSize() == other.server_eul_list.GetSize()) {
1043  if (server_eul_list.GetSize() == 0) return false;
1044  for (size_t i=0; i<server_eul_list.GetSize(); i++) {
1045  if (server_eul_list[i] == other.server_eul_list[i]) return false;
1046  }
1047  return true;
1048  }
1049  }
1050  return false;
1051  }
1052 
1082  float irm_version = 1.0) {
1083  this->is_encrypt_metadata = is_encrypt_metadata;
1084  this->publish_license = publish_license;
1085  this->server_eul_list = server_eul_list;
1086  if (irm_version<1.0)
1087  this->irm_version = 1.0;
1088  else
1089  this->irm_version = irm_version;
1090  }
1091 
1126 };
1127 
1138 class RMSSecurityHandler FS_FINAL : public SecurityHandler {
1139  public:
1157  explicit RMSSecurityHandler(const foxit::pdf::SecurityHandler& other);
1158 
1176  bool Initialize(const RMSEncryptData& encrypt_data, const RMSSecurityCallback* callback);
1177 };
1178 
1185  public:
1191  virtual void Release() = 0;
1199 
1200  protected:
1201  ~SecurityCallback() {}
1202 };
1203 
1213  public:
1232  virtual String GetDecryptionKey(const void* envelope_buffer, uint32 envelope_length) = 0;
1233 
1234  protected:
1236 };
1237 
1247  public:
1266  virtual bool IsOwner(const PDFDoc& document, const char* sub_filter) = 0;
1278  virtual uint32 GetUserPermissions(const PDFDoc& document, const char* sub_filter) = 0;
1290  virtual SecurityHandler::CipherType GetCipherType(const PDFDoc& document, const char* sub_filter) = 0;
1304  virtual uint32 GetKeyLength(const PDFDoc& document, const char* sub_filter) = 0;
1315  virtual String GetFileID(const PDFDoc& document, const char* sub_filter) = 0;
1326  virtual String GetInitialKey(const PDFDoc& document, const char* sub_filter) = 0;
1327 
1328  protected:
1329  ~DRMSecurityCallback() {}
1330 };
1331 
1341  public:
1361  virtual void* CreateContext(const char* filter, const char* sub_filter, const char* encrypt_info) = 0;
1372  virtual bool ReleaseContext(void* context) = 0;
1386  virtual uint32 GetUserPermissions(const void* context, uint32 user_permission) = 0;
1397  virtual bool IsOwner(const void* context) = 0;
1409  virtual SecurityHandler::CipherType GetCipher(const void* context) = 0;
1420  virtual String GetEncryptKey(const void* context) = 0;
1432  virtual uint32 GetDecryptedSize(const void* context, uint32 src_data_size) = 0;
1445  virtual void* StartDecryptor(const void* context, int obj_num, int gen_num) = 0;
1458  virtual String DecryptData(const void* decryptor, const void* encrypted_data, uint32 encrypted_data_len) = 0;
1469  virtual String FinishDecryptor(void* decryptor) = 0;
1484  virtual uint32 GetEncryptedSize(const void* context, int obj_num, int gen_num,
1485  const void* src_data, uint32 src_data_len) = 0;
1502  virtual bool EncryptData(const void* context, int obj_num, int gen_num,
1503  const void* src_data, uint32 src_data_len,
1504  void* out_dst_buffer, uint32* out_dst_buffer_len) = 0;
1505 
1506  protected:
1508 };
1509 
1519  public:
1528 
1529  protected:
1530  ~RMSSecurityCallback() {}
1531 };
1532 } // namespace pdf
1533 } // namespace foxit
1534 #endif // FS_SECURITY_H_
1535 
StdEncryptData()
Constructor.
Definition: fs_security.h:163
String sub_filter
The sub filter of PDF document for encryption. It should not be an empty string.
Definition: fs_security.h:893
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 CertificateEncryptData object.
Definition: fs_security.h:363
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:889
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of current security callback.
Definition: fs_security.h:1221
SecurityHandler::CipherType cipher
Cipher type. Please refer to values starting from SecurityHandler::e_CipherRC4 and this should be one...
Definition: fs_security.h:269
String filter
The filter of PDF document for encryption. It should not be an empty string.
Definition: fs_security.h:891
bool operator!=(const StdEncryptData &other) const
Not equal operator.
Definition: fs_security.h:220
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:170
bool operator==(const RMSEncryptData &other) const
Equal operator.
Definition: fs_security.h:1019
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:696
Header file for PDF document related definitions and classes.
int key_length
The key length, in bytes.
Definition: fs_security.h:279
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:965
Definition: fs_security.h:1212
Definition: fs_security.h:1246
DRMSecurityHandler()
Constructor function.
Definition: fs_security.h:721
virtual SecurityHandler::CipherType GetCipher(const void *context)=0
A callback function used to get the cipher type.
virtual ~SecurityHandler()
Destructor.
Definition: fs_security.h:506
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:1107
Encryption type: customized encryption.
Definition: fs_pdfdoc.h:373
WIDE STRING CLASS.
Definition: fx_string.h:1463
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:708
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:1004
Definition: fs_pdfdoc.h:338
bool IsEmpty() const
Check whether current object is empty or not.
Definition: fs_security.h:550
~DRMEncryptData()
Destructor.
Definition: fs_security.h:591
Not use encryption algorithm.
Definition: fs_security.h:65
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1527
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:614
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1198
void Set(bool is_encrypt_metadata, const String &filter, const String &sub_filter)
Set value.
Definition: fs_security.h:879
bool operator==(const StdEncryptData &other) const
Equal operator.
Definition: fs_security.h:206
bool operator!=(const DRMEncryptData &other) const
Not equal operator.
Definition: fs_security.h:646
RMSEncryptData(const RMSEncryptData &other)
Constructor, with another RMSEncryptData object.
Definition: fs_security.h:990
Definition: fs_security.h:937
Definition: fs_security.h:133
bool operator==(const char *str1, const CFX_ByteString &str2)
Check if two byte strings are equal.
Definition: fs_basictypes.h:125
CustomEncryptData(const CustomEncryptData &other)
Constructor, with another CustomEncryptData object.
Definition: fs_security.h:827
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:454
CipherType
Enumeration for Encryption Algorithm.
Definition: fs_security.h:63
~CertificateEncryptData()
Destructor.
Definition: fs_security.h:356
bool operator!=(const CustomEncryptData &other) const
Not equal operator.
Definition: fs_security.h:865
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:571
bool operator!=(const SecurityHandler &other)
Not equal operator.
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:675
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:444
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:449
~CustomEncryptData()
Destructor.
Definition: fs_security.h:820
CustomEncryptData(bool is_encrypt_metadata, const String &filter, const String &sub_filter)
Constructor, with parameters.
Definition: fs_security.h:807
DRMEncryptData(const DRMEncryptData &other)
Constructor, with another DRMEncryptData object.
Definition: fs_security.h:598
Definition: fx_basic.h:1246
StdEncryptData(bool is_encrypt_metadata, uint32 user_permissions, SecurityHandler::CipherType cipher, int key_length)
Constructor, with parameters.
Definition: fs_security.h:154
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:248
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:195
Encryption type: digital certificate encryption.
Definition: fs_pdfdoc.h:369
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:213
Header file for common definitions and classes.
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1255
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:1125
virtual void Release()=0
A callback function used to release current security callback object itself.
Definition: fs_security.h:1340
Definition: fs_security.h:1518
CertificateEncryptData(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray &envelopes)
Constructor, with parameters.
Definition: fs_security.h:344
DRMEncryptData()
Constructor.
Definition: fs_security.h:582
Definition: fs_security.h:797
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:375
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:259
Definition: fs_basictypes.h:333
Definition: fs_basictypes.h:225
size_t GetSize() const
Get the size of current array.
StdEncryptData(const StdEncryptData &other)
Constructor, with another StdEncryptData object.
Definition: fs_security.h:177
Definition: fs_security.h:1184
CertificateEncryptData()
Constructor.
Definition: fs_security.h:351
CustomEncryptData & operator=(const CustomEncryptData &other)
Assign operator.
Definition: fs_security.h:839
virtual uint32 GetKeyLength(const PDFDoc &document, const char *sub_filter)=0
A callback function used to get the length of cipher key.
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:1120
void Set(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray &envelopes)
Set value.
Definition: fs_security.h:434
Definition: fs_security.h:901
Definition: fs_security.h:56
bool VerifyEncryptionParams()
Verify encryption parameters.
RMSEncryptData()
Constructor.
Definition: fs_security.h:977
Foxit namespace.
Definition: fs_connectedpdf.h:26
Definition: fs_security.h:1138
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:363
EncryptType
Enumeration for encryption type.
Definition: fs_pdfdoc.h:361
virtual PDFDoc::EncryptType GetSecurityType()
Get the encryption type of security callback.
Definition: fs_security.h:1349
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:1096
bool operator!=(const CertificateEncryptData &other) const
Not equal operator.
Definition: fs_security.h:409
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:713
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:137
~RMSEncryptData()
Destructor.
Definition: fs_security.h:983
int key_length
The key length, in bytes. For SecurityHandler::e_CipherRC4 cipher, this value should be between 5 an...
Definition: fs_security.h:703
uint32 user_permissions
The user permissions. Please refer to values starting from PDFDoc::e_PermPrint and this should be one...
Definition: fs_security.h:264
Encryption type: Foxit DRM encryption.
Definition: fs_pdfdoc.h:371
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:191
bool operator==(const DRMEncryptData &other) const
Equal operator.
Definition: fs_security.h:631
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:1081
CertificateEncryptData & operator=(const CertificateEncryptData &other)
Assign operator.
Definition: fs_security.h:376
Definition: fs_security.h:287
bool is_encrypt_metadata
A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata,...
Definition: fs_security.h:689
Definition: fs_security.h:332
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:853
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:814
bool operator==(const CertificateEncryptData &other) const
Equal operator.
Definition: fs_security.h:390
String sub_filter
The sub filter of PDF document.
Definition: fs_security.h:691
bool operator!=(const RMSEncryptData &other) const
Not equal operator.
Definition: fs_security.h:1039

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.