Foxit PDF SDK

fs_security.h
浏览该文件的文档.
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 {
65 e_CipherNone = 0,
67 e_CipherRC4 = 1,
72 e_CipherAES = 2
73 } CipherType;
74
76 SecurityHandler();
77 #ifndef __EMSCRIPTEN_RENDER__
78
83 SecurityHandler(const SecurityHandler& other);
84
85 // 强烈建议用户不要使用此方法；否则可能会发生未知情况。
86 explicit SecurityHandler(FS_HANDLE handle);
87
89 virtual ~SecurityHandler();
90
98 SecurityHandler& operator = (const SecurityHandler& other);
99 #endif
100
107 bool operator == (const SecurityHandler& other);
115 bool operator != (const SecurityHandler& other);
116
124 bool IsEmpty() const;
125
132 virtual PDFDoc::EncryptType GetSecurityType();
133
134 };
135
137 class StdEncryptData FS_FINAL {
138 public:
151 StdEncryptData(bool is_encrypt_metadata, uint32 user_permissions, SecurityHandler::CipherType cipher,
152 int key_length) {
153 this->is_encrypt_metadata = is_encrypt_metadata;
154 this->user_permissions = user_permissions;
155 this->cipher = cipher;
156 this->key_length = key_length;
157 }
158
160 StdEncryptData()
161 : is_encrypt_metadata(true)
162 , user_permissions(0)
163 , cipher(SecurityHandler::e_CipherNone)
164 , key_length(0) {}
165
171 StdEncryptData(const StdEncryptData& other) {
172 is_encrypt_metadata = other.is_encrypt_metadata;
173 user_permissions = other.user_permissions;
174 cipher = other.cipher;
175 key_length = other.key_length;
176 }
177
185 StdEncryptData& operator = (const StdEncryptData& other) {
186 is_encrypt_metadata = other.is_encrypt_metadata;
187 user_permissions = other.user_permissions;
188 cipher = other.cipher;
189 key_length = other.key_length;
190 return *this;
191 }
192
200 bool operator == (const StdEncryptData& other) const {
201 return (is_encrypt_metadata == other.is_encrypt_metadata &&
202 user_permissions == other.user_permissions &&
203 cipher == other.cipher &&
204 key_length == other.key_length);
205 }
206
214 bool operator != (const StdEncryptData& other) const {
215 return !(is_encrypt_metadata == other.is_encrypt_metadata &&
216 user_permissions == other.user_permissions &&
217 cipher == other.cipher &&
218 key_length == other.key_length);
219 }
220
235 void Set(bool is_encrypt_metadata, uint32 user_permissions, SecurityHandler::CipherType cipher, int key_length) {
236 this->is_encrypt_metadata = is_encrypt_metadata;
237 this->user_permissions = user_permissions;
238 this->cipher = cipher;
239 this->key_length = key_length;
240 }
241
245 bool is_encrypt_metadata;
249 uint32 user_permissions;
253 SecurityHandler::CipherType cipher;
261 int key_length;
262 };
263
269 class StdSecurityHandler FS_FINAL : public SecurityHandler {
270 public:
276 typedef enum _ModifyFlag {
278 e_ModifyPermission = 0x01,
280 e_ModifyUserPassword = 0x02,
282 e_ModifyOwnerPassword = 0x04
283 } ModifyFlag;
284
285
287 StdSecurityHandler();
293 explicit StdSecurityHandler(const foxit::pdf::SecurityHandler& other);
294
304 bool Initialize(const StdEncryptData& encrypt_data, const String& user_password, const String& owner_password);
305
315 bool InitializeW(const StdEncryptData& encrypt_data, const WString& user_password, const WString& owner_password);
316
326 void SetAES256ModifyFlags(uint32 modify_flags);
327 };
328
330 class CertificateEncryptData FS_FINAL {
331 public:
339 CertificateEncryptData(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray& envelopes) {
340 this->is_encrypt_metadata = is_encrypt_metadata;
341 this->cipher = cipher;
342 this->envelopes = envelopes;
343 }
344
346 CertificateEncryptData()
347 : is_encrypt_metadata(true)
348 , cipher(SecurityHandler::e_CipherNone) {}
349
355 CertificateEncryptData(const CertificateEncryptData& other) {
356 is_encrypt_metadata = other.is_encrypt_metadata;
357 cipher = other.cipher;
358 envelopes = other.envelopes;
359 }
360
368 CertificateEncryptData& operator = (const CertificateEncryptData& other) {
369 is_encrypt_metadata = other.is_encrypt_metadata;
370 cipher = other.cipher;
371 envelopes = other.envelopes;
372 return *this;
373 }
374
382 bool operator == (const CertificateEncryptData& other) const {
383 if (is_encrypt_metadata == other.is_encrypt_metadata && cipher == other.cipher) {
384 if (envelopes.GetSize() == other.envelopes.GetSize()) {
385 for (size_t i=0; i<envelopes.GetSize(); i++) {
386 if (envelopes[i] != other.envelopes[i]) return false;
387 }
388 return true;
389 }
390 }
391 return false;
392 }
393
401 bool operator != (const CertificateEncryptData& other) const {
402 if (!(is_encrypt_metadata == other.is_encrypt_metadata && cipher == other.cipher)) {
403 if (envelopes.GetSize() == other.envelopes.GetSize()) {
404 if (envelopes.GetSize() == 0) return false;
405 for (size_t i=0; i<envelopes.GetSize(); i++) {
406 if (envelopes[i] == other.envelopes[i]) return false;
407 }
408 return true;
409 }
410 }
411 return false;
412 }
413
423 void Set(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray& envelopes) {
424 this->is_encrypt_metadata = is_encrypt_metadata;
425 this->cipher = cipher;
426 this->envelopes =envelopes;
427 }
428
432 bool is_encrypt_metadata;
436 SecurityHandler::CipherType cipher;
440 StringArray envelopes;
441 };
442
443 #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_)
444
445 class Envelope : public Base {
446 public:
453 Envelope(const void* buffer, size_t size);
459 Envelope(const char* cert_file_path);
460
461 // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
462 explicit Envelope(FS_HANDLE handle);
464 Envelope(const Envelope& other);
466 bool operator==(const Envelope& other) const;
468 bool operator!=(const Envelope& other) const;
469
478 String GetDecryptionKey(const char* p12_file_path, const String& password);
479 };
480
482 typedef CFX_ArrayTemplate<Envelope> EnvelopeArray;
483
484 #endif
485
491 class CertificateSecurityHandler FS_FINAL : public SecurityHandler {
492 public:
494 CertificateSecurityHandler();
500 explicit CertificateSecurityHandler(const foxit::pdf::SecurityHandler& other);
501
502 #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_)
503
512 bool Initialize(foxit::pdf::EnvelopeArray envelopes, foxit::pdf::SecurityHandler::CipherType cipher, bool is_encrypt_metadata);
513 #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_)
514
523 bool Initialize(const CertificateEncryptData& encrypt_data, const String& encrypt_key);
524 };
525
527 class DRMEncryptData FS_FINAL {
528 public:
539 DRMEncryptData(bool is_encrypt_metadata, const String& sub_filter, SecurityHandler::CipherType cipher,
540 int key_length, bool is_owner, uint32 user_permissions) {
541 this->is_encrypt_metadata = is_encrypt_metadata;
542 this->sub_filter = sub_filter;
543 this->cipher = cipher;
544 this->key_length = key_length;
545 this->is_owner = is_owner;
546 this->user_permissions = user_permissions;
547 }
548
550 DRMEncryptData()
551 : is_encrypt_metadata(true)
552 , sub_filter("")
553 , cipher(SecurityHandler::e_CipherNone)
554 , key_length(0)
555 , is_owner(false)
556 , user_permissions(0) {}
557
563 DRMEncryptData(const DRMEncryptData& other) {
564 is_encrypt_metadata = other.is_encrypt_metadata;
565 sub_filter = other.sub_filter;
566 cipher = other.cipher;
567 key_length = other.key_length;
568 is_owner = other.is_owner;
569 user_permissions = other.user_permissions;
570 }
571
579 DRMEncryptData& operator = (const DRMEncryptData& other) {
580 is_encrypt_metadata = other.is_encrypt_metadata;
581 sub_filter = other.sub_filter;
582 cipher = other.cipher;
583 key_length = other.key_length;
584 is_owner = other.is_owner;
585 user_permissions = other.user_permissions;
586 return *this;
587 }
588
596 bool operator == (const DRMEncryptData& other) const {
597 return (is_encrypt_metadata == other.is_encrypt_metadata &&
598 sub_filter == other.sub_filter &&
599 cipher == other.cipher && key_length == other.key_length &&
600 is_owner == other.is_owner &&
601 user_permissions == other.user_permissions);
602 }
603
611 bool operator != (const DRMEncryptData& other) const {
612 return !(is_encrypt_metadata == other.is_encrypt_metadata &&
613 sub_filter == other.sub_filter &&
614 cipher == other.cipher && key_length == other.key_length &&
615 is_owner == other.is_owner &&
616 user_permissions == other.user_permissions);
617 }
618
631 void Set(bool is_encrypt_metadata, const String& sub_filter, SecurityHandler::CipherType cipher,
632 int key_length, bool is_owner, uint32 user_permissions) {
633 this->is_encrypt_metadata = is_encrypt_metadata;
634 this->sub_filter = sub_filter;
635 this->cipher = cipher;
636 this->key_length = key_length;
637 this->is_owner = is_owner;
638 this->user_permissions = user_permissions;
639 }
640
644 bool is_encrypt_metadata;
646 String sub_filter;
650 SecurityHandler::CipherType cipher;
653 int key_length;
657 bool is_owner;
661 uint32 user_permissions;
662 };
663
669 class DRMSecurityHandler FS_FINAL : public SecurityHandler {
670 public:
672 DRMSecurityHandler();
678 explicit DRMSecurityHandler(const foxit::pdf::SecurityHandler& other);
679
689 bool Initialize(const DRMEncryptData& encrypt_data, const char* file_id, const String& initial_key);
707 WString GetDRMValue(const char* key);
726 bool SetDRMValue(const char* key, const WString& value);
727
735 bool VerifyEncryptionParams();
736 };
737
739 class CustomEncryptData FS_FINAL {
740 public:
748 CustomEncryptData(bool is_encrypt_metadata, const String& filter, const String& sub_filter) {
749 this->is_encrypt_metadata = is_encrypt_metadata;
750 this->filter = filter;
751 this->sub_filter = sub_filter;
752 }
753
755 CustomEncryptData()
756 : is_encrypt_metadata(true)
757 , filter("")
758 , sub_filter("") {}
759
765 CustomEncryptData(const CustomEncryptData& other) {
766 is_encrypt_metadata = other.is_encrypt_metadata;
767 filter = other.filter;
768 sub_filter = other.sub_filter;
769 }
777 CustomEncryptData& operator = (const CustomEncryptData& other) {
778 is_encrypt_metadata = other.is_encrypt_metadata;
779 filter = other.filter;
780 sub_filter = other.sub_filter;
781 return *this;
782 }
783
791 bool operator == (const CustomEncryptData& other) const {
792 return (is_encrypt_metadata == other.is_encrypt_metadata &&
793 filter == other.filter && sub_filter == other.sub_filter);
794 }
795
803 bool operator != (const CustomEncryptData& other) const {
804 return !(is_encrypt_metadata == other.is_encrypt_metadata &&
805 filter == other.filter && sub_filter == other.sub_filter);
806 }
816 void Set(bool is_encrypt_metadata, const String& filter, const String& sub_filter) {
817 this->is_encrypt_metadata = is_encrypt_metadata;
818 this->filter = filter;
819 this->sub_filter = sub_filter;
820 }
821
825 bool is_encrypt_metadata;
827 String filter;
829 String sub_filter;
830 };
831
837 class CustomSecurityHandler FS_FINAL : public SecurityHandler {
838 public:
840 CustomSecurityHandler();
846 explicit CustomSecurityHandler(const foxit::pdf::SecurityHandler& other);
847
859 bool Initialize(const CustomEncryptData& encrypt_data,
860 const CustomSecurityCallback* callback, const char* encrypt_info = "");
861 };
862
864 class RMSEncryptData FS_FINAL {
865 public:
874 RMSEncryptData(bool is_encrypt_metadata, const char* publish_license, const StringArray& server_eul_list,
875 float irm_version = 1.0) {
876 this->is_encrypt_metadata = is_encrypt_metadata;
877 this->publish_license = publish_license;
878 this->server_eul_list = server_eul_list;
879 if (irm_version<1.0)
880 this->irm_version = 1.0;
881 else
882 this->irm_version = irm_version;
883 }
884
886 RMSEncryptData()
887 : is_encrypt_metadata(true)
888 , publish_license("")
889 , irm_version(1.0) {}
890
896 RMSEncryptData(const RMSEncryptData& other) {
897 is_encrypt_metadata = other.is_encrypt_metadata;
898 publish_license = other.publish_license;
899 server_eul_list = other.server_eul_list;
900 irm_version = other.irm_version;
901 }
902
910 RMSEncryptData& operator = (const RMSEncryptData& other) {
911 is_encrypt_metadata = other.is_encrypt_metadata;
912 publish_license = other.publish_license;
913 server_eul_list = other.server_eul_list;
914 irm_version = other.irm_version;
915 return *this;
916 }
917
925 bool operator == (const RMSEncryptData& other) const {
926 if (is_encrypt_metadata == other.is_encrypt_metadata && publish_license == other.publish_license &&
927 fabs(irm_version - other.irm_version) <= FLT_EPSILON) {
928 if (server_eul_list.GetSize() == other.server_eul_list.GetSize()) {
929 for (size_t i=0; i<server_eul_list.GetSize(); i++) {
930 if (server_eul_list[i] != other.server_eul_list[i]) return false;
931 }
932 return true;
933 }
934 }
935 return false;
936 }
937
945 bool operator != (const RMSEncryptData& other) const {
946 if (!(is_encrypt_metadata == other.is_encrypt_metadata && publish_license == other.publish_license &&
947 fabs(irm_version - other.irm_version) <= FLT_EPSILON)) {
948 if (server_eul_list.GetSize() == other.server_eul_list.GetSize()) {
949 if (server_eul_list.GetSize() == 0) return false;
950 for (size_t i=0; i<server_eul_list.GetSize(); i++) {
951 if (server_eul_list[i] == other.server_eul_list[i]) return false;
952 }
953 return true;
954 }
955 }
956 return false;
957 }
958
969 void Set(bool is_encrypt_metadata, const char* publish_license, const StringArray& server_eul_list,
970 float irm_version = 1.0) {
971 this->is_encrypt_metadata = is_encrypt_metadata;
972 this->publish_license = publish_license;
973 this->server_eul_list = server_eul_list;
974 if (irm_version<1.0)
975 this->irm_version = 1.0;
976 else
977 this->irm_version = irm_version;
978 }
979
983 bool is_encrypt_metadata;
989 String publish_license;
995 StringArray server_eul_list;
999 float irm_version;
1000 };
1001
1009 class RMSSecurityHandler FS_FINAL : public SecurityHandler {
1010 public:
1016 RMSSecurityHandler();
1024 explicit RMSSecurityHandler(const foxit::pdf::SecurityHandler& other);
1025
1036 bool Initialize(const RMSEncryptData& encrypt_data, const RMSSecurityCallback* callback);
1037 };
1038
1043 class SecurityCallback {
1044 public:
1050 virtual void Release() = 0;
1057 virtual PDFDoc::EncryptType GetSecurityType() {return PDFDoc::e_EncryptUnknown;}
1058
1059 protected:
1060 ~SecurityCallback() {}
1061 };
1062
1071 class CertificateSecurityCallback: public SecurityCallback {
1072 public:
1080 virtual PDFDoc::EncryptType GetSecurityType() FS_OVERRIDE {return PDFDoc::e_EncryptCertificate;}
1091 virtual String GetDecryptionKey(const void* envelope_buffer, uint32 envelope_length) = 0;
1092
1093 protected:
1094 ~CertificateSecurityCallback() {}
1095 };
1096
1105 class DRMSecurityCallback: public SecurityCallback {
1106 public:
1114 virtual PDFDoc::EncryptType GetSecurityType() FS_OVERRIDE {return PDFDoc::e_EncryptFoxitDRM;}
1125 virtual bool IsOwner(const PDFDoc& document, const char* sub_filter) = 0;
1137 virtual uint32 GetUserPermissions(const PDFDoc& document, const char* sub_filter) = 0;
1149 virtual SecurityHandler::CipherType GetCipherType(const PDFDoc& document, const char* sub_filter) = 0;
1163 virtual uint32 GetKeyLength(const PDFDoc& document, const char* sub_filter) = 0;
1174 virtual String GetFileID(const PDFDoc& document, const char* sub_filter) = 0;
1185 virtual String GetInitialKey(const PDFDoc& document, const char* sub_filter) = 0;
1186
1187 protected:
1188 ~DRMSecurityCallback() {}
1189 };
1190
1199 class CustomSecurityCallback: public SecurityCallback {
1200 public:
1208 virtual PDFDoc::EncryptType GetSecurityType() FS_OVERRIDE {return PDFDoc::e_EncryptCustom;}
1220 virtual void* CreateContext(const char* filter, const char* sub_filter, const char* encrypt_info) = 0;
1231 virtual bool ReleaseContext(void* context) = 0;
1245 virtual uint32 GetUserPermissions(const void* context, uint32 user_permission) = 0;
1256 virtual bool IsOwner(const void* context) = 0;
1268 virtual SecurityHandler::CipherType GetCipher(const void* context) = 0;
1279 virtual String GetEncryptKey(const void* context) = 0;
1291 virtual uint32 GetDecryptedSize(const void* context, uint32 src_data_size) = 0;
1304 virtual void* StartDecryptor(const void* context, int obj_num, int gen_num) = 0;
1317 virtual String DecryptData(const void* decryptor, const void* encrypted_data, uint32 encrypted_data_len) = 0;
1328 virtual String FinishDecryptor(void* decryptor) = 0;
1343 virtual uint32 GetEncryptedSize(const void* context, int obj_num, int gen_num,
1344 const void* src_data, uint32 src_data_len) = 0;
1361 virtual bool EncryptData(const void* context, int obj_num, int gen_num,
1362 const void* src_data, uint32 src_data_len,
1363 void* out_dst_buffer, uint32* out_dst_buffer_len) = 0;
1364
1380 virtual bool UseStandardCryptoMethod(const void* context) { return false; }
1381
1382 protected:
1383 ~CustomSecurityCallback() {}
1384 };
1385
1389 class RMSSecurityCallback: public CustomSecurityCallback {
1390 public:
1398 virtual PDFDoc::EncryptType GetSecurityType() FS_OVERRIDE {return PDFDoc::e_EncryptRMS;}
1399
1400 protected:
1401 ~RMSSecurityCallback() {}
1402 };
1403 } // namespace pdf
1404 } // namespace foxit
1405 #endif // FS_SECURITY_H_
1406
foxit::pdf::CustomSecurityCallback::GetDecryptedSize
virtual uint32 GetDecryptedSize(const void *context, uint32 src_data_size)=0
用于获取估计的解密数据大小的回调函数。
foxit::pdf::StdEncryptData::cipher
SecurityHandler::CipherType cipher
加密算法类型。请参考从 SecurityHandler::e_CipherRC4 开始的值，应该是这些值中的一个，除了 SecurityHandler::e_CipherNone。
Definition: fs_security.h:253
foxit::pdf::SecurityHandler::IsEmpty
bool IsEmpty() const
检查当前对象是否为空。
foxit::pdf::CustomSecurityCallback::FinishDecryptor
virtual String FinishDecryptor(void *decryptor)=0
用于完成解密的回调函数。
foxit::pdf::SecurityHandler::operator==
bool operator==(const SecurityHandler &other)
等于操作符。
foxit::pdf::RMSEncryptData::RMSEncryptData
RMSEncryptData(bool is_encrypt_metadata, const char *publish_license, const StringArray &server_eul_list, float irm_version=1.0)
构造函数，带参数。
Definition: fs_security.h:874
foxit::pdf::CustomSecurityCallback::CreateContext
virtual void * CreateContext(const char *filter, const char *sub_filter, const char *encrypt_info)=0
用于创建加密和解密上下文的回调函数。
foxit::pdf::CustomEncryptData::filter
String filter
自定义安全回调对象的过滤器名称。不应为空字符串。
Definition: fs_security.h:827
foxit::pdf::DRMSecurityCallback::GetCipherType
virtual SecurityHandler::CipherType GetCipherType(const PDFDoc &document, const char *sub_filter)=0
用于获取加密算法的密码类型的回调函数。
foxit::FS_HANDLE
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:214
foxit::pdf::DRMEncryptData::operator==
bool operator==(const DRMEncryptData &other) const
等于操作符。
Definition: fs_security.h:596
foxit::pdf::CustomEncryptData::CustomEncryptData
CustomEncryptData(bool is_encrypt_metadata, const String &filter, const String &sub_filter)
构造函数，带参数。
Definition: fs_security.h:748
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
用于获取估计的加密大小的回调函数。
foxit::pdf::RMSSecurityHandler::RMSSecurityHandler
RMSSecurityHandler()
构造函数。
foxit::pdf::CustomSecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
获取安全回调的加密类型。
Definition: fs_security.h:1208
foxit::pdf::StdSecurityHandler::e_ModifyUserPassword
如果设置，在加密过程中将修改用户密码和所有者密码。
Definition: fs_security.h:280
foxit::pdf::DRMSecurityHandler::DRMSecurityHandler
DRMSecurityHandler()
构造函数。
foxit::pdf::RMSSecurityCallback
Definition: fs_security.h:1389
foxit::pdf::CertificateEncryptData::CertificateEncryptData
CertificateEncryptData(const CertificateEncryptData &other)
构造函数，使用另一个证书加密数据对象。
Definition: fs_security.h:355
foxit::pdf::CertificateEncryptData::operator==
bool operator==(const CertificateEncryptData &other) const
等于操作符。
Definition: fs_security.h:382
foxit::StringArray
Definition: fs_basictypes.h:230
foxit::pdf::CertificateSecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
获取当前安全回调的加密类型。
Definition: fs_security.h:1080
foxit::StringArray::GetSize
size_t GetSize() const
获取当前数组中元素的大小。
foxit::pdf::CustomEncryptData::CustomEncryptData
CustomEncryptData(const CustomEncryptData &other)
构造函数，使用另一个自定义加密数据对象。
Definition: fs_security.h:765
foxit::pdf::CertificateEncryptData
Definition: fs_security.h:330
foxit::pdf::CertificateSecurityHandler::CertificateSecurityHandler
CertificateSecurityHandler()
构造函数。
foxit::pdf::StdEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
决定是否加密元数据的布尔值。true 表示加密元数据，false 表示不加密元数据。
Definition: fs_security.h:245
foxit::pdf::DRMSecurityCallback::GetInitialKey
virtual String GetInitialKey(const PDFDoc &document, const char *sub_filter)=0
用于获取解密DRM保护文档的初始密钥的回调函数。
foxit::pdf::CustomSecurityCallback::StartDecryptor
virtual void * StartDecryptor(const void *context, int obj_num, int gen_num)=0
用于开始解密的回调函数。
foxit::pdf::CustomEncryptData::sub_filter
String sub_filter
指定加密字典内容语法的子过滤器名称。不应为空字符串。
Definition: fs_security.h:829
foxit::pdf::CustomEncryptData::operator=
CustomEncryptData & operator=(const CustomEncryptData &other)
赋值操作符。
Definition: fs_security.h:777
foxit::pdf::StdSecurityHandler::Initialize
bool Initialize(const StdEncryptData &encrypt_data, const String &user_password, const String &owner_password)
（不支持AES-256）初始化当前标准安全处理器。
foxit::pdf::SecurityHandler::operator!=
bool operator!=(const SecurityHandler &other)
不等于操作符。
foxit::pdf::DRMEncryptData::is_owner
bool is_owner
决定当前用户是否为所有者的布尔值。true 表示当前用户是所有者，false 表示当前用户不是所有者。
Definition: fs_security.h:657
fs_common.h
通用定义和类的头文件。
foxit::pdf::DRMEncryptData::operator!=
bool operator!=(const DRMEncryptData &other) const
不等于操作符。
Definition: fs_security.h:611
foxit::pdf::CertificateSecurityCallback::GetDecryptionKey
virtual String GetDecryptionKey(const void *envelope_buffer, uint32 envelope_length)=0
用于获取解密证书保护的PDF文档的密钥的回调函数。
CFX_ArrayTemplate
Definition: fx_basic.h:1278
foxit::pdf::CustomSecurityCallback::DecryptData
virtual String DecryptData(const void *decryptor, const void *encrypted_data, uint32 encrypted_data_len)=0
用于解密加密数据的回调函数。
foxit::pdf::SecurityHandler::e_CipherRC4
使用RC4加密算法，密钥长度在5字节到16字节之间。
Definition: fs_security.h:67
foxit::pdf::DRMSecurityHandler::SetDRMValue
bool SetDRMValue(const char *key, const WString &value)
设置指定参数的DRM值。
foxit::pdf::RMSEncryptData
Definition: fs_security.h:864
foxit::pdf::CustomSecurityCallback
Definition: fs_security.h:1199
foxit::pdf::SecurityHandler::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
获取当前安全处理器的加密类型。
foxit::pdf::SecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
获取安全回调的加密类型。
Definition: fs_security.h:1057
foxit::pdf::StdEncryptData::operator=
StdEncryptData & operator=(const StdEncryptData &other)
赋值操作符。
Definition: fs_security.h:185
foxit::pdf::PDFDoc::e_EncryptFoxitDRM
加密类型：福昕DRM加密。
Definition: fs_pdfdoc.h:804
foxit::pdf::CustomSecurityHandler
Definition: fs_security.h:837
foxit::pdf::RMSSecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
获取安全回调的加密类型。
Definition: fs_security.h:1398
foxit::pdf::StdEncryptData::Set
void Set(bool is_encrypt_metadata, uint32 user_permissions, SecurityHandler::CipherType cipher, int key_length)
设置值。
Definition: fs_security.h:235
foxit::pdf::CustomSecurityCallback::IsOwner
virtual bool IsOwner(const void *context)=0
用于检查当前用户是否是PDF文档所有者的回调函数。
foxit::pdf::CertificateSecurityHandler
Definition: fs_security.h:491
foxit::pdf::SecurityHandler::SecurityHandler
SecurityHandler()
构造函数。
foxit::pdf::CustomSecurityHandler::CustomSecurityHandler
CustomSecurityHandler()
构造函数。
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)
设置值。
Definition: fs_security.h:631
foxit::pdf::RMSEncryptData::publish_license
String publish_license
从服务器发放给内容发布者的编码发布许可证，采用ASCII编码。不应为空字符串。
Definition: fs_security.h:989
foxit::pdf::StdSecurityHandler::ModifyFlag
ModifyFlag
（仅适用于AES-256）修改标志的枚举，用于决定在加密过程中哪些安全数据或密码将被修改
Definition: fs_security.h:276
foxit::pdf::SecurityHandler::CipherType
CipherType
加密算法的枚举。
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
用于获取加密数据的回调函数。
foxit::pdf::CustomEncryptData::Set
void Set(bool is_encrypt_metadata, const String &filter, const String &sub_filter)
设置值。
Definition: fs_security.h:816
foxit::pdf::CustomEncryptData
Definition: fs_security.h:739
foxit::pdf::StdSecurityHandler::e_ModifyPermission
如果设置，在加密过程中将修改用户权限和"是否加密元数据"值（在 StdEncryptData 中定义）。
Definition: fs_security.h:278
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)
构造函数，带参数。
Definition: fs_security.h:539
foxit::pdf::DRMSecurityCallback::GetUserPermissions
virtual uint32 GetUserPermissions(const PDFDoc &document, const char *sub_filter)=0
用于获取当前用户权限的回调函数。
foxit::pdf::SecurityCallback
Definition: fs_security.h:1043
foxit::pdf::CertificateSecurityCallback
Definition: fs_security.h:1071
foxit::pdf::RMSEncryptData::RMSEncryptData
RMSEncryptData(const RMSEncryptData &other)
构造函数，使用另一个RMS加密数据对象。
Definition: fs_security.h:896
CFX_ByteString
字节字符串类
Definition: fx_string.h:317
foxit::pdf::CertificateEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
决定是否加密元数据的布尔值。true 表示加密元数据，false 表示不加密元数据。
Definition: fs_security.h:432
foxit::pdf::StdEncryptData::StdEncryptData
StdEncryptData(bool is_encrypt_metadata, uint32 user_permissions, SecurityHandler::CipherType cipher, int key_length)
构造函数，带参数。
Definition: fs_security.h:151
foxit::pdf::DRMSecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
获取安全回调的加密类型。
Definition: fs_security.h:1114
foxit::pdf::RMSEncryptData::operator=
RMSEncryptData & operator=(const RMSEncryptData &other)
赋值操作符。
Definition: fs_security.h:910
foxit::pdf::PDFDoc::e_EncryptRMS
加密类型：微软RMS加密。
Definition: fs_pdfdoc.h:808
foxit::pdf::CustomSecurityHandler::Initialize
bool Initialize(const CustomEncryptData &encrypt_data, const CustomSecurityCallback *callback, const char *encrypt_info="")
初始化当前自定义安全处理器。
foxit::pdf::StdEncryptData::key_length
int key_length
密钥长度，以字节为单位。
Definition: fs_security.h:261
foxit::pdf::DRMEncryptData::DRMEncryptData
DRMEncryptData()
构造函数。
Definition: fs_security.h:550
foxit::pdf::PDFDoc::e_EncryptUnknown
未知加密类型。
Definition: fs_pdfdoc.h:796
foxit::pdf::SecurityHandler::~SecurityHandler
virtual ~SecurityHandler()
析构函数。
foxit::pdf::CertificateEncryptData::CertificateEncryptData
CertificateEncryptData(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray &envelopes)
构造函数，带参数。
Definition: fs_security.h:339
foxit::pdf::CertificateEncryptData::cipher
SecurityHandler::CipherType cipher
加密算法类型。请参考从 SecurityHandler::e_CipherRC4 开始的值，应该是这些值中的一个，除了 SecurityHandler::e_CipherNone。
Definition: fs_security.h:436
foxit::pdf::DRMSecurityHandler::Initialize
bool Initialize(const DRMEncryptData &encrypt_data, const char *file_id, const String &initial_key)
初始化当前DRM安全处理器。
foxit::pdf::StdEncryptData
Definition: fs_security.h:137
foxit::pdf::DRMEncryptData::operator=
DRMEncryptData & operator=(const DRMEncryptData &other)
赋值操作符。
Definition: fs_security.h:579
foxit::pdf::StdEncryptData::StdEncryptData
StdEncryptData()
构造函数。
Definition: fs_security.h:160
foxit::pdf::StdSecurityHandler
Definition: fs_security.h:269
operator==
bool operator==(const char *str1, const CFX_ByteString &str2)
检查两个字节字符串是否相等。
Definition: fs_basictypes.h:128
foxit::pdf::SecurityCallback::Release
virtual void Release()=0
用于释放当前回调对象自身的回调函数。
foxit::pdf::DRMSecurityCallback::GetKeyLength
virtual uint32 GetKeyLength(const PDFDoc &document, const char *sub_filter)=0
用于获取密码密钥长度的回调函数。
foxit::pdf::RMSEncryptData::server_eul_list
StringArray server_eul_list
包含字符串对的字符串数组，用于表示编码服务器EUL的字典对象的内容。
Definition: fs_security.h:995
foxit::pdf::RMSEncryptData::irm_version
float irm_version
Microsoft IRM版本。应大于1。如果输入版本小于1，Foxit PDF SDK将默认使用1作为版本。默认值：1.0。
Definition: fs_security.h:999
foxit::pdf::PDFDoc::EncryptType
EncryptType
加密类型的枚举。
Definition: fs_pdfdoc.h:794
foxit::pdf::DRMSecurityCallback::IsOwner
virtual bool IsOwner(const PDFDoc &document, const char *sub_filter)=0
用于检查当前用户是否是PDF文档所有者的回调函数。
foxit::pdf::CustomEncryptData::operator!=
bool operator!=(const CustomEncryptData &other) const
不等于操作符。
Definition: fs_security.h:803
foxit::pdf::CertificateSecurityHandler::Initialize
bool Initialize(const CertificateEncryptData &encrypt_data, const String &encrypt_key)
初始化当前证书安全处理器。
foxit
Foxit命名空间。
Definition: fs_taggedpdf.h:27
foxit::pdf::SecurityHandler
Definition: fs_security.h:56
foxit::pdf::DRMSecurityHandler::VerifyEncryptionParams
bool VerifyEncryptionParams()
验证加密参数。
foxit::pdf::CertificateEncryptData::Set
void Set(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray &envelopes)
设置值。
Definition: fs_security.h:423
foxit::pdf::DRMEncryptData::DRMEncryptData
DRMEncryptData(const DRMEncryptData &other)
构造函数，使用另一个DRM加密数据对象。
Definition: fs_security.h:563
foxit::pdf::CertificateEncryptData::envelopes
StringArray envelopes
指定证书信封数组的字符串数组。此数组应包含一个或多个信封。
Definition: fs_security.h:440
foxit::pdf::RMSSecurityHandler
Definition: fs_security.h:1009
foxit::pdf::StdEncryptData::StdEncryptData
StdEncryptData(const StdEncryptData &other)
构造函数，使用另一个标准加密数据对象。
Definition: fs_security.h:171
foxit::pdf::DRMSecurityHandler::GetDRMValue
WString GetDRMValue(const char *key)
获取指定参数的DRM值。
foxit::pdf::CustomSecurityCallback::GetCipher
virtual SecurityHandler::CipherType GetCipher(const void *context)=0
用于获取密码类型的回调函数。
foxit::pdf::PDFDoc::e_EncryptCertificate
加密类型：数字证书加密。
Definition: fs_pdfdoc.h:802
operator!=
bool operator!=(const char *str1, const CFX_ByteString &str2)
检查两个字节字符串是否不相等。
Definition: fs_basictypes.h:140
foxit::pdf::CertificateEncryptData::CertificateEncryptData
CertificateEncryptData()
构造函数。
Definition: fs_security.h:346
fs_pdfdoc.h
PDF文档相关定义和类的头文件。
foxit::pdf::StdSecurityHandler::e_ModifyOwnerPassword
如果设置，在加密过程中将仅修改所有者密码。
Definition: fs_security.h:282
foxit::pdf::CustomSecurityCallback::GetUserPermissions
virtual uint32 GetUserPermissions(const void *context, uint32 user_permission)=0
用于获取用户权限的回调函数。
foxit::pdf::CustomSecurityCallback::ReleaseContext
virtual bool ReleaseContext(void *context)=0
用于释放加密和解密上下文的回调函数。
foxit::pdf::CustomEncryptData::CustomEncryptData
CustomEncryptData()
构造函数。
Definition: fs_security.h:755
foxit::pdf::PDFDoc
Definition: fs_pdfdoc.h:771
foxit::pdf::CustomSecurityCallback::GetEncryptKey
virtual String GetEncryptKey(const void *context)=0
用于获取加密密钥的回调函数。
foxit::pdf::CustomEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
决定是否加密元数据的布尔值。true 表示加密元数据，false 表示不加密元数据。
Definition: fs_security.h:825
foxit::pdf::SecurityHandler::e_CipherNone
不使用加密算法。
Definition: fs_security.h:65
foxit::pdf::CustomEncryptData::operator==
bool operator==(const CustomEncryptData &other) const
等于操作符。
Definition: fs_security.h:791
foxit::pdf::RMSEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
决定是否加密元数据的布尔值。true 表示加密元数据，false 表示不加密元数据。
Definition: fs_security.h:983
foxit::pdf::DRMEncryptData::user_permissions
uint32 user_permissions
用户权限。请参考从 PDFDoc::e_PermPrint 开始的值，可以是这些值中的一个或多个的组合。
Definition: fs_security.h:661
foxit::pdf::SecurityHandler::operator=
SecurityHandler & operator=(const SecurityHandler &other)
赋值操作符。
foxit::pdf::RMSSecurityHandler::Initialize
bool Initialize(const RMSEncryptData &encrypt_data, const RMSSecurityCallback *callback)
初始化当前Microsoft RMS安全处理器。
foxit::pdf::DRMEncryptData
Definition: fs_security.h:527
foxit::pdf::RMSEncryptData::operator!=
bool operator!=(const RMSEncryptData &other) const
不等于操作符。
Definition: fs_security.h:945
foxit::pdf::CustomSecurityCallback::UseStandardCryptoMethod
virtual bool UseStandardCryptoMethod(const void *context)
用于检查是否使用标准加密方法或自定义加密方法的回调函数。
Definition: fs_security.h:1380
foxit::pdf::StdEncryptData::operator==
bool operator==(const StdEncryptData &other) const
等于操作符。
Definition: fs_security.h:200
foxit::pdf::SecurityHandler::e_CipherAES
使用AES加密算法，密钥长度为16字节（AES-128）或 32字节（AES-256，仅在PDF 2.0中支持）。
Definition: fs_security.h:72
foxit::pdf::PDFDoc::e_EncryptCustom
加密类型：自定义加密。
Definition: fs_pdfdoc.h:806
foxit::pdf::DRMSecurityCallback::GetFileID
virtual String GetFileID(const PDFDoc &document, const char *sub_filter)=0
用于获取文件标识字符串的回调函数。
foxit::pdf::DRMEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
决定是否加密元数据的布尔值。true 表示加密元数据，false 表示不加密元数据。
Definition: fs_security.h:644
foxit::pdf::CertificateEncryptData::operator!=
bool operator!=(const CertificateEncryptData &other) const
不等于操作符。
Definition: fs_security.h:401
foxit::pdf::StdSecurityHandler::StdSecurityHandler
StdSecurityHandler()
构造函数。
CFX_WideString
宽字符串类
Definition: fx_string.h:1457
foxit::pdf::StdSecurityHandler::SetAES256ModifyFlags
void SetAES256ModifyFlags(uint32 modify_flags)
（仅适用于AES-256）设置修改标志以决定在加密过程中哪些安全数据或密码将被修改。
foxit::pdf::DRMSecurityHandler
Definition: fs_security.h:669
foxit::pdf::DRMEncryptData::sub_filter
String sub_filter
指定加密字典内容语法的子过滤器名称。
Definition: fs_security.h:646
foxit::pdf::RMSEncryptData::RMSEncryptData
RMSEncryptData()
构造函数。
Definition: fs_security.h:886
foxit::pdf::DRMEncryptData::key_length
int key_length
密钥长度，以字节为单位。 对于 SecurityHandler::e_CipherRC4 加密算法，此值应该在5到16之间。 对于 SecurityHandler::e_CipherAES 加密算法，此...
Definition: fs_security.h:653
foxit::pdf::DRMSecurityCallback
Definition: fs_security.h:1105
foxit::pdf::StdEncryptData::operator!=
bool operator!=(const StdEncryptData &other) const
不等于操作符。
Definition: fs_security.h:214
foxit::pdf::RMSEncryptData::Set
void Set(bool is_encrypt_metadata, const char *publish_license, const StringArray &server_eul_list, float irm_version=1.0)
设置值。
Definition: fs_security.h:969
foxit::uint32
FX_UINT32 uint32
无符号 32 位整数。
Definition: fs_basictypes.h:196
foxit::pdf::StdSecurityHandler::InitializeW
bool InitializeW(const StdEncryptData &encrypt_data, const WString &user_password, const WString &owner_password)
（仅适用于AES-256）初始化当前标准安全处理器。
foxit::pdf::CertificateEncryptData::operator=
CertificateEncryptData & operator=(const CertificateEncryptData &other)
赋值操作符。
Definition: fs_security.h:368
foxit::Base
Definition: fs_basictypes.h:449
foxit::pdf::RMSEncryptData::operator==
bool operator==(const RMSEncryptData &other) const
等于操作符。
Definition: fs_security.h:925
foxit::pdf::StdEncryptData::user_permissions
uint32 user_permissions
用户权限。请参考从 PDFDoc::e_PermPrint 开始的值，应该是这些值中的一个或多个的组合。
Definition: fs_security.h:249
foxit::pdf::DRMEncryptData::cipher
SecurityHandler::CipherType cipher
加密算法类型。请参考从 SecurityHandler::e_CipherRC4 开始的值，应该是这些值中的一个，除了 SecurityHandler::e_CipherNone。
Definition: fs_security.h:650