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
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
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(__EMSCRIPTEN__)) && !defined(_SWIG_JAVA_) && !defined(_SWIG_DOTNET_) && !defined(_SWIG_PYTHON_) && !defined(_OC_) && !defined(_SWIG_MACOC_) && !defined(_SWIG_NODEJS_) && !defined(_SWIG_GO_) && !defined(_FSDK_NO_OPENSSL_)
444 struct CertPermission;
446 class Envelope : public Base {
447 public:
454 Envelope(const void* buffer, size_t size);
460 Envelope(const char* cert_file_path);
461
468 Envelope(const char* certFilePath, const CertPermission* permission);
475 Envelope(foxit::common::file::ReaderCallback *certFile, const CertPermission* permission);
476 // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
477 explicit Envelope(FS_HANDLE handle);
479 Envelope(const Envelope& other);
481 bool operator==(const Envelope& other) const;
483 bool operator!=(const Envelope& other) const;
484
493 String GetDecryptionKey(const char* p12_file_path, const String& password);
494 };
495
497 typedef CFX_ArrayTemplate<Envelope> EnvelopeArray;
498
499 #endif
500
506 class CertificateSecurityHandler FS_FINAL : public SecurityHandler {
507 public:
509 CertificateSecurityHandler();
515 explicit CertificateSecurityHandler(const foxit::pdf::SecurityHandler& other);
516
517 #if (_FX_OS_ == _FX_IOS_ || _FX_OS_ == _FX_ANDROID_ || defined(SWIG) || defined(__EMSCRIPTEN__)) && !defined(_SWIG_JAVA_) && !defined(_SWIG_DOTNET_) && !defined(_SWIG_PYTHON_) && !defined(_OC_) && !defined(_SWIG_MACOC_) && !defined(_SWIG_NODEJS_) && !defined(_SWIG_GO_) && !defined(_FSDK_NO_OPENSSL_)
518
527 bool Initialize(foxit::pdf::EnvelopeArray envelopes, foxit::pdf::SecurityHandler::CipherType cipher, bool is_encrypt_metadata);
528 #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_)
529
538 bool Initialize(const CertificateEncryptData& encrypt_data, const String& encrypt_key);
539 };
540
542 class DRMEncryptData FS_FINAL {
543 public:
554 DRMEncryptData(bool is_encrypt_metadata, const String& sub_filter, SecurityHandler::CipherType cipher,
555 int key_length, bool is_owner, uint32 user_permissions) {
556 this->is_encrypt_metadata = is_encrypt_metadata;
557 this->sub_filter = sub_filter;
558 this->cipher = cipher;
559 this->key_length = key_length;
560 this->is_owner = is_owner;
561 this->user_permissions = user_permissions;
562 }
563
565 DRMEncryptData()
566 : is_encrypt_metadata(true)
567 , sub_filter("")
568 , cipher(SecurityHandler::e_CipherNone)
569 , key_length(0)
570 , is_owner(false)
571 , user_permissions(0) {}
572
578 DRMEncryptData(const DRMEncryptData& other) {
579 is_encrypt_metadata = other.is_encrypt_metadata;
580 sub_filter = other.sub_filter;
581 cipher = other.cipher;
582 key_length = other.key_length;
583 is_owner = other.is_owner;
584 user_permissions = other.user_permissions;
585 }
586
594 DRMEncryptData& operator = (const DRMEncryptData& other) {
595 is_encrypt_metadata = other.is_encrypt_metadata;
596 sub_filter = other.sub_filter;
597 cipher = other.cipher;
598 key_length = other.key_length;
599 is_owner = other.is_owner;
600 user_permissions = other.user_permissions;
601 return *this;
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
626 bool operator != (const DRMEncryptData& other) const {
627 return !(is_encrypt_metadata == other.is_encrypt_metadata &&
628 sub_filter == other.sub_filter &&
629 cipher == other.cipher && key_length == other.key_length &&
630 is_owner == other.is_owner &&
631 user_permissions == other.user_permissions);
632 }
633
646 void Set(bool is_encrypt_metadata, const String& sub_filter, SecurityHandler::CipherType cipher,
647 int key_length, bool is_owner, uint32 user_permissions) {
648 this->is_encrypt_metadata = is_encrypt_metadata;
649 this->sub_filter = sub_filter;
650 this->cipher = cipher;
651 this->key_length = key_length;
652 this->is_owner = is_owner;
653 this->user_permissions = user_permissions;
654 }
655
659 bool is_encrypt_metadata;
661 String sub_filter;
665 SecurityHandler::CipherType cipher;
668 int key_length;
672 bool is_owner;
676 uint32 user_permissions;
677 };
678
684 class DRMSecurityHandler FS_FINAL : public SecurityHandler {
685 public:
687 DRMSecurityHandler();
693 explicit DRMSecurityHandler(const foxit::pdf::SecurityHandler& other);
694
704 bool Initialize(const DRMEncryptData& encrypt_data, const char* file_id, const String& initial_key);
722 WString GetDRMValue(const char* key);
741 bool SetDRMValue(const char* key, const WString& value);
742
750 bool VerifyEncryptionParams();
751 };
752
754 class CustomEncryptData FS_FINAL {
755 public:
763 CustomEncryptData(bool is_encrypt_metadata, const String& filter, const String& sub_filter) {
764 this->is_encrypt_metadata = is_encrypt_metadata;
765 this->filter = filter;
766 this->sub_filter = sub_filter;
767 }
768
770 CustomEncryptData()
771 : is_encrypt_metadata(true)
772 , filter("")
773 , sub_filter("") {}
774
780 CustomEncryptData(const CustomEncryptData& other) {
781 is_encrypt_metadata = other.is_encrypt_metadata;
782 filter = other.filter;
783 sub_filter = other.sub_filter;
784 }
792 CustomEncryptData& operator = (const CustomEncryptData& other) {
793 is_encrypt_metadata = other.is_encrypt_metadata;
794 filter = other.filter;
795 sub_filter = other.sub_filter;
796 return *this;
797 }
798
806 bool operator == (const CustomEncryptData& other) const {
807 return (is_encrypt_metadata == other.is_encrypt_metadata &&
808 filter == other.filter && sub_filter == other.sub_filter);
809 }
810
818 bool operator != (const CustomEncryptData& other) const {
819 return !(is_encrypt_metadata == other.is_encrypt_metadata &&
820 filter == other.filter && sub_filter == other.sub_filter);
821 }
831 void Set(bool is_encrypt_metadata, const String& filter, const String& sub_filter) {
832 this->is_encrypt_metadata = is_encrypt_metadata;
833 this->filter = filter;
834 this->sub_filter = sub_filter;
835 }
836
840 bool is_encrypt_metadata;
842 String filter;
844 String sub_filter;
845 };
846
852 class CustomSecurityHandler FS_FINAL : public SecurityHandler {
853 public:
855 CustomSecurityHandler();
861 explicit CustomSecurityHandler(const foxit::pdf::SecurityHandler& other);
862
874 bool Initialize(const CustomEncryptData& encrypt_data,
875 const CustomSecurityCallback* callback, const char* encrypt_info = "");
876 };
877
879 class RMSEncryptData FS_FINAL {
880 public:
889 RMSEncryptData(bool is_encrypt_metadata, const char* publish_license, const StringArray& server_eul_list,
890 float irm_version = 1.0) {
891 this->is_encrypt_metadata = is_encrypt_metadata;
892 this->publish_license = publish_license;
893 this->server_eul_list = server_eul_list;
894 if (irm_version<1.0)
895 this->irm_version = 1.0;
896 else
897 this->irm_version = irm_version;
898 }
899
901 RMSEncryptData()
902 : is_encrypt_metadata(true)
903 , publish_license("")
904 , irm_version(1.0) {}
905
911 RMSEncryptData(const RMSEncryptData& other) {
912 is_encrypt_metadata = other.is_encrypt_metadata;
913 publish_license = other.publish_license;
914 server_eul_list = other.server_eul_list;
915 irm_version = other.irm_version;
916 }
917
925 RMSEncryptData& operator = (const RMSEncryptData& other) {
926 is_encrypt_metadata = other.is_encrypt_metadata;
927 publish_license = other.publish_license;
928 server_eul_list = other.server_eul_list;
929 irm_version = other.irm_version;
930 return *this;
931 }
932
940 bool operator == (const RMSEncryptData& other) const {
941 if (is_encrypt_metadata == other.is_encrypt_metadata && publish_license == other.publish_license &&
942 fabs(irm_version - other.irm_version) <= FLT_EPSILON) {
943 if (server_eul_list.GetSize() == other.server_eul_list.GetSize()) {
944 for (size_t i=0; i<server_eul_list.GetSize(); i++) {
945 if (server_eul_list[i] != other.server_eul_list[i]) return false;
946 }
947 return true;
948 }
949 }
950 return false;
951 }
952
960 bool operator != (const RMSEncryptData& other) const {
961 if (!(is_encrypt_metadata == other.is_encrypt_metadata && publish_license == other.publish_license &&
962 fabs(irm_version - other.irm_version) <= FLT_EPSILON)) {
963 if (server_eul_list.GetSize() == other.server_eul_list.GetSize()) {
964 if (server_eul_list.GetSize() == 0) return false;
965 for (size_t i=0; i<server_eul_list.GetSize(); i++) {
966 if (server_eul_list[i] == other.server_eul_list[i]) return false;
967 }
968 return true;
969 }
970 }
971 return false;
972 }
973
984 void Set(bool is_encrypt_metadata, const char* publish_license, const StringArray& server_eul_list,
985 float irm_version = 1.0) {
986 this->is_encrypt_metadata = is_encrypt_metadata;
987 this->publish_license = publish_license;
988 this->server_eul_list = server_eul_list;
989 if (irm_version<1.0)
990 this->irm_version = 1.0;
991 else
992 this->irm_version = irm_version;
993 }
994
998 bool is_encrypt_metadata;
1004 String publish_license;
1010 StringArray server_eul_list;
1014 float irm_version;
1015 };
1016
1024 class RMSSecurityHandler FS_FINAL : public SecurityHandler {
1025 public:
1031 RMSSecurityHandler();
1039 explicit RMSSecurityHandler(const foxit::pdf::SecurityHandler& other);
1040
1051 bool Initialize(const RMSEncryptData& encrypt_data, const RMSSecurityCallback* callback);
1052 };
1053
1058 class SecurityCallback {
1059 public:
1065 virtual void Release() = 0;
1072 virtual PDFDoc::EncryptType GetSecurityType() {return PDFDoc::e_EncryptUnknown;}
1073
1074 protected:
1075 ~SecurityCallback() {}
1076 };
1077
1086 class CertificateSecurityCallback: public SecurityCallback {
1087 public:
1095 virtual PDFDoc::EncryptType GetSecurityType() FS_OVERRIDE {return PDFDoc::e_EncryptCertificate;}
1106 virtual String GetDecryptionKey(const void* envelope_buffer, uint32 envelope_length) = 0;
1107
1108 protected:
1109 ~CertificateSecurityCallback() {}
1110 };
1111
1120 class DRMSecurityCallback: public SecurityCallback {
1121 public:
1129 virtual PDFDoc::EncryptType GetSecurityType() FS_OVERRIDE {return PDFDoc::e_EncryptFoxitDRM;}
1140 virtual bool IsOwner(const PDFDoc& document, const char* sub_filter) = 0;
1152 virtual uint32 GetUserPermissions(const PDFDoc& document, const char* sub_filter) = 0;
1164 virtual SecurityHandler::CipherType GetCipherType(const PDFDoc& document, const char* sub_filter) = 0;
1178 virtual uint32 GetKeyLength(const PDFDoc& document, const char* sub_filter) = 0;
1189 virtual String GetFileID(const PDFDoc& document, const char* sub_filter) = 0;
1200 virtual String GetInitialKey(const PDFDoc& document, const char* sub_filter) = 0;
1201
1202 protected:
1203 ~DRMSecurityCallback() {}
1204 };
1205
1214 class CustomSecurityCallback: public SecurityCallback {
1215 public:
1223 virtual PDFDoc::EncryptType GetSecurityType() FS_OVERRIDE {return PDFDoc::e_EncryptCustom;}
1235 virtual void* CreateContext(const char* filter, const char* sub_filter, const char* encrypt_info) = 0;
1246 virtual bool ReleaseContext(void* context) = 0;
1260 virtual uint32 GetUserPermissions(const void* context, uint32 user_permission) = 0;
1271 virtual bool IsOwner(const void* context) = 0;
1283 virtual SecurityHandler::CipherType GetCipher(const void* context) = 0;
1294 virtual String GetEncryptKey(const void* context) = 0;
1306 virtual uint32 GetDecryptedSize(const void* context, uint32 src_data_size) = 0;
1319 virtual void* StartDecryptor(const void* context, int obj_num, int gen_num) = 0;
1332 virtual String DecryptData(const void* decryptor, const void* encrypted_data, uint32 encrypted_data_len) = 0;
1343 virtual String FinishDecryptor(void* decryptor) = 0;
1358 virtual uint32 GetEncryptedSize(const void* context, int obj_num, int gen_num,
1359 const void* src_data, uint32 src_data_len) = 0;
1376 virtual bool EncryptData(const void* context, int obj_num, int gen_num,
1377 const void* src_data, uint32 src_data_len,
1378 void* out_dst_buffer, uint32* out_dst_buffer_len) = 0;
1379
1395 virtual bool UseStandardCryptoMethod(const void* context) { return false; }
1396
1397 protected:
1398 ~CustomSecurityCallback() {}
1399 };
1400
1404 class RMSSecurityCallback: public CustomSecurityCallback {
1405 public:
1413 virtual PDFDoc::EncryptType GetSecurityType() FS_OVERRIDE {return PDFDoc::e_EncryptRMS;}
1414
1415 protected:
1416 ~RMSSecurityCallback() {}
1417 };
1418 } // namespace pdf
1419 } // namespace foxit
1420 #endif // FS_SECURITY_H_
1421
foxit::pdf::StdSecurityHandler::SetAES256ModifyFlags
void SetAES256ModifyFlags(uint32 modify_flags)
（仅适用于AES-256）设置修改标志以决定在加密过程中哪些安全数据或密码将被修改。
foxit::pdf::StdSecurityHandler::e_ModifyPermission
如果设置，在加密过程中将修改用户权限和"是否加密元数据"值（在 StdEncryptData 中定义）。
Definition: fs_security.h:278
foxit::pdf::StdEncryptData::StdEncryptData
StdEncryptData()
构造函数。
Definition: fs_security.h:160
foxit::pdf::CustomEncryptData::sub_filter
String sub_filter
指定加密字典内容语法的子过滤器名称。不应为空字符串。
Definition: fs_security.h:844
foxit::pdf::StdSecurityHandler::InitializeW
bool InitializeW(const StdEncryptData &encrypt_data, const WString &user_password, const WString &owner_password)
（仅适用于AES-256）初始化当前标准安全处理器。
foxit::pdf::CustomSecurityHandler::Initialize
bool Initialize(const CustomEncryptData &encrypt_data, const CustomSecurityCallback *callback, const char *encrypt_info="")
初始化当前自定义安全处理器。
foxit::pdf::DRMSecurityHandler::SetDRMValue
bool SetDRMValue(const char *key, const WString &value)
设置指定参数的DRM值。
foxit::pdf::CertificateEncryptData::CertificateEncryptData
CertificateEncryptData(const CertificateEncryptData &other)
构造函数，使用另一个证书加密数据对象。
Definition: fs_security.h:355
foxit::pdf::CustomEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
决定是否加密元数据的布尔值。true 表示加密元数据，false 表示不加密元数据。
Definition: fs_security.h:840
foxit::pdf::CertificateEncryptData::operator !=
bool operator !=(const CertificateEncryptData &other) const
不等于操作符。
Definition: fs_security.h:401
foxit::pdf::CertificateSecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
获取当前安全回调的加密类型。
Definition: fs_security.h:1095
foxit::pdf::StdEncryptData::cipher
SecurityHandler::CipherType cipher
加密算法类型。请参考从 SecurityHandler::e_CipherRC4 开始的值，应该是这些值中的一个，除了 SecurityHandler::e_CipherNone。
Definition: fs_security.h:253
foxit::pdf::CustomEncryptData::filter
String filter
自定义安全回调对象的过滤器名称。不应为空字符串。
Definition: fs_security.h:842
foxit::pdf::SecurityHandler::operator !=
bool operator !=(const SecurityHandler &other)
不等于操作符。
foxit::pdf::CustomSecurityCallback::GetEncryptKey
virtual String GetEncryptKey(const void *context)=0
用于获取加密密钥的回调函数。
foxit::pdf::CertificateSecurityHandler::Initialize
bool Initialize(const CertificateEncryptData &encrypt_data, const String &encrypt_key)
初始化当前证书安全处理器。
foxit::pdf::RMSSecurityHandler::RMSSecurityHandler
RMSSecurityHandler()
构造函数。
foxit::pdf::SecurityHandler::SecurityHandler
SecurityHandler()
构造函数。
foxit::pdf::RMSEncryptData::operator==
bool operator==(const RMSEncryptData &other) const
等于操作符。
Definition: fs_security.h:940
foxit::pdf::DRMSecurityCallback::GetInitialKey
virtual String GetInitialKey(const PDFDoc &document, const char *sub_filter)=0
用于获取解密DRM保护文档的初始密钥的回调函数。
foxit::pdf::CustomSecurityCallback::ReleaseContext
virtual bool ReleaseContext(void *context)=0
用于释放加密和解密上下文的回调函数。
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::DRMEncryptData::cipher
SecurityHandler::CipherType cipher
加密算法类型。请参考从 SecurityHandler::e_CipherRC4 开始的值，应该是这些值中的一个，除了 SecurityHandler::e_CipherNone。
Definition: fs_security.h:665
fs_pdfdoc.h
PDF文档相关定义和类的头文件。
foxit::pdf::StdSecurityHandler::e_ModifyOwnerPassword
如果设置，在加密过程中将仅修改所有者密码。
Definition: fs_security.h:282
foxit::pdf::StdEncryptData::key_length
int key_length
密钥长度，以字节为单位。
Definition: fs_security.h:261
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:889
foxit::pdf::CertificateSecurityCallback
Definition: fs_security.h:1086
foxit::pdf::DRMSecurityCallback
Definition: fs_security.h:1120
foxit::pdf::DRMSecurityHandler::DRMSecurityHandler
DRMSecurityHandler()
构造函数。
foxit::pdf::DRMSecurityHandler
Definition: fs_security.h:684
foxit::pdf::CustomSecurityCallback::GetCipher
virtual SecurityHandler::CipherType GetCipher(const void *context)=0
用于获取密码类型的回调函数。
foxit::pdf::SecurityHandler::~SecurityHandler
virtual ~SecurityHandler()
析构函数。
foxit::pdf::CertificateSecurityHandler
Definition: fs_security.h:506
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
用于获取估计的加密大小的回调函数。
IFX_FileRead
文件读取接口。
Definition: fx_stream.h:587
foxit::pdf::RMSEncryptData::publish_license
String publish_license
从服务器发放给内容发布者的编码发布许可证，采用ASCII编码。不应为空字符串。
Definition: fs_security.h:1004
foxit::pdf::StdSecurityHandler::ModifyFlag
ModifyFlag
（仅适用于AES-256）修改标志的枚举，用于决定在加密过程中哪些安全数据或密码将被修改
Definition: fs_security.h:276
foxit::pdf::CertificateSecurityHandler::CertificateSecurityHandler
CertificateSecurityHandler()
构造函数。
foxit::pdf::PDFDoc::e_EncryptCustom
加密类型：自定义加密。
Definition: fs_pdfdoc.h:803
CFX_WideString
宽字符串类
Definition: fx_string.h:1457
foxit::pdf::RMSEncryptData::operator !=
bool operator !=(const RMSEncryptData &other) const
不等于操作符。
Definition: fs_security.h:960
foxit::pdf::DRMSecurityHandler::GetDRMValue
WString GetDRMValue(const char *key)
获取指定参数的DRM值。
foxit::pdf::CustomSecurityCallback::CreateContext
virtual void * CreateContext(const char *filter, const char *sub_filter, const char *encrypt_info)=0
用于创建加密和解密上下文的回调函数。
foxit::pdf::DRMEncryptData::is_owner
bool is_owner
决定当前用户是否为所有者的布尔值。true 表示当前用户是所有者，false 表示当前用户不是所有者。
Definition: fs_security.h:672
foxit::pdf::CertificateSecurityCallback::GetDecryptionKey
virtual String GetDecryptionKey(const void *envelope_buffer, uint32 envelope_length)=0
用于获取解密证书保护的PDF文档的密钥的回调函数。
foxit::pdf::RMSEncryptData::operator=
RMSEncryptData & operator=(const RMSEncryptData &other)
赋值操作符。
Definition: fs_security.h:925
foxit::pdf::PDFDoc
Definition: fs_pdfdoc.h:768
foxit::pdf::SecurityHandler::IsEmpty
bool IsEmpty() const
检查当前对象是否为空。
foxit::pdf::DRMEncryptData
Definition: fs_security.h:542
foxit::pdf::SecurityHandler::e_CipherNone
不使用加密算法。
Definition: fs_security.h:65
foxit::pdf::RMSSecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
获取安全回调的加密类型。
Definition: fs_security.h:1413
foxit::pdf::CustomSecurityCallback::GetUserPermissions
virtual uint32 GetUserPermissions(const void *context, uint32 user_permission)=0
用于获取用户权限的回调函数。
foxit::pdf::DRMEncryptData::operator=
DRMEncryptData & operator=(const DRMEncryptData &other)
赋值操作符。
Definition: fs_security.h:594
foxit::pdf::SecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
获取安全回调的加密类型。
Definition: fs_security.h:1072
foxit::pdf::CustomEncryptData::Set
void Set(bool is_encrypt_metadata, const String &filter, const String &sub_filter)
设置值。
Definition: fs_security.h:831
foxit::pdf::CustomSecurityCallback::UseStandardCryptoMethod
virtual bool UseStandardCryptoMethod(const void *context)
用于检查是否使用标准加密方法或自定义加密方法的回调函数。
Definition: fs_security.h:1395
foxit::pdf::StdEncryptData::operator==
bool operator==(const StdEncryptData &other) const
等于操作符。
Definition: fs_security.h:200
foxit::pdf::RMSEncryptData::RMSEncryptData
RMSEncryptData(const RMSEncryptData &other)
构造函数，使用另一个RMS加密数据对象。
Definition: fs_security.h:911
foxit::pdf::RMSEncryptData
Definition: fs_security.h:879
foxit::pdf::StdEncryptData
Definition: fs_security.h:137
operator==
bool operator==(const char *str1, const CFX_ByteString &str2)
检查两个字节字符串是否相等。
Definition: fs_basictypes.h:128
foxit::pdf::CustomEncryptData::CustomEncryptData
CustomEncryptData(const CustomEncryptData &other)
构造函数，使用另一个自定义加密数据对象。
Definition: fs_security.h:780
foxit::pdf::RMSSecurityHandler::Initialize
bool Initialize(const RMSEncryptData &encrypt_data, const RMSSecurityCallback *callback)
初始化当前Microsoft RMS安全处理器。
foxit::pdf::SecurityHandler::e_CipherAES
使用AES加密算法，密钥长度为16字节（AES-128）或 32字节（AES-256，仅在PDF 2.0中支持）。
Definition: fs_security.h:72
foxit::pdf::CertificateEncryptData::envelopes
StringArray envelopes
指定证书信封数组的字符串数组。此数组应包含一个或多个信封。
Definition: fs_security.h:440
foxit::pdf::SecurityHandler::CipherType
CipherType
加密算法的枚举。
Definition: fs_security.h:63
foxit::pdf::SecurityHandler::operator=
SecurityHandler & operator=(const SecurityHandler &other)
赋值操作符。
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:554
foxit::pdf::StdSecurityHandler::e_ModifyUserPassword
如果设置，在加密过程中将修改用户密码和所有者密码。
Definition: fs_security.h:280
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:646
foxit::pdf::CertificateEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
决定是否加密元数据的布尔值。true 表示加密元数据，false 表示不加密元数据。
Definition: fs_security.h:432
foxit::pdf::CustomSecurityCallback::IsOwner
virtual bool IsOwner(const void *context)=0
用于检查当前用户是否是PDF文档所有者的回调函数。
foxit::pdf::DRMSecurityCallback::IsOwner
virtual bool IsOwner(const PDFDoc &document, const char *sub_filter)=0
用于检查当前用户是否是PDF文档所有者的回调函数。
foxit::pdf::StdSecurityHandler::Initialize
bool Initialize(const StdEncryptData &encrypt_data, const String &user_password, const String &owner_password)
（不支持AES-256）初始化当前标准安全处理器。
foxit::pdf::CustomSecurityCallback::StartDecryptor
virtual void * StartDecryptor(const void *context, int obj_num, int gen_num)=0
用于开始解密的回调函数。
foxit::pdf::CertificateEncryptData::cipher
SecurityHandler::CipherType cipher
加密算法类型。请参考从 SecurityHandler::e_CipherRC4 开始的值，应该是这些值中的一个，除了 SecurityHandler::e_CipherNone。
Definition: fs_security.h:436
foxit::pdf::CustomEncryptData::CustomEncryptData
CustomEncryptData(bool is_encrypt_metadata, const String &filter, const String &sub_filter)
构造函数，带参数。
Definition: fs_security.h:763
foxit::pdf::DRMEncryptData::DRMEncryptData
DRMEncryptData(const DRMEncryptData &other)
构造函数，使用另一个DRM加密数据对象。
Definition: fs_security.h:578
CFX_ArrayTemplate
Definition: fx_basic.h:1278
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::GetUserPermissions
virtual uint32 GetUserPermissions(const PDFDoc &document, const char *sub_filter)=0
用于获取当前用户权限的回调函数。
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::uint32
FX_UINT32 uint32
无符号 32 位整数。
Definition: fs_basictypes.h:195
foxit::pdf::PDFDoc::e_EncryptCertificate
加密类型：数字证书加密。
Definition: fs_pdfdoc.h:799
foxit::FS_HANDLE
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:213
fs_common.h
通用定义和类的头文件。
foxit::pdf::DRMSecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
获取安全回调的加密类型。
Definition: fs_security.h:1129
foxit::pdf::RMSEncryptData::irm_version
float irm_version
Microsoft IRM版本。应大于1。如果输入版本小于1，Foxit PDF SDK将默认使用1作为版本。默认值：1.0。
Definition: fs_security.h:1014
foxit::pdf::StdSecurityHandler::StdSecurityHandler
StdSecurityHandler()
构造函数。
foxit::pdf::SecurityCallback::Release
virtual void Release()=0
用于释放当前回调对象自身的回调函数。
foxit::pdf::CustomSecurityCallback
Definition: fs_security.h:1214
foxit::pdf::RMSSecurityCallback
Definition: fs_security.h:1404
foxit::pdf::CertificateEncryptData::CertificateEncryptData
CertificateEncryptData(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray &envelopes)
构造函数，带参数。
Definition: fs_security.h:339
foxit::pdf::DRMEncryptData::DRMEncryptData
DRMEncryptData()
构造函数。
Definition: fs_security.h:565
foxit::pdf::CustomEncryptData
Definition: fs_security.h:754
foxit::pdf::CustomSecurityCallback::GetDecryptedSize
virtual uint32 GetDecryptedSize(const void *context, uint32 src_data_size)=0
用于获取估计的解密数据大小的回调函数。
foxit::pdf::DRMSecurityHandler::Initialize
bool Initialize(const DRMEncryptData &encrypt_data, const char *file_id, const String &initial_key)
初始化当前DRM安全处理器。
foxit::pdf::PDFDoc::e_EncryptRMS
加密类型：微软RMS加密。
Definition: fs_pdfdoc.h:805
foxit::pdf::StdEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
决定是否加密元数据的布尔值。true 表示加密元数据，false 表示不加密元数据。
Definition: fs_security.h:245
foxit::Base
Definition: fs_basictypes.h:465
foxit::StringArray
Definition: fs_basictypes.h:229
foxit::StringArray::GetSize
size_t GetSize() const
获取当前数组中元素的大小。
foxit::pdf::StdEncryptData::StdEncryptData
StdEncryptData(const StdEncryptData &other)
构造函数，使用另一个标准加密数据对象。
Definition: fs_security.h:171
foxit::pdf::SecurityCallback
Definition: fs_security.h:1058
foxit::pdf::StdEncryptData::operator !=
bool operator !=(const StdEncryptData &other) const
不等于操作符。
Definition: fs_security.h:214
foxit::pdf::CertificateEncryptData::CertificateEncryptData
CertificateEncryptData()
构造函数。
Definition: fs_security.h:346
foxit::pdf::CustomEncryptData::operator=
CustomEncryptData & operator=(const CustomEncryptData &other)
赋值操作符。
Definition: fs_security.h:792
foxit::pdf::DRMSecurityCallback::GetKeyLength
virtual uint32 GetKeyLength(const PDFDoc &document, const char *sub_filter)=0
用于获取密码密钥长度的回调函数。
foxit::pdf::CustomEncryptData::operator !=
bool operator !=(const CustomEncryptData &other) const
不等于操作符。
Definition: fs_security.h:818
foxit::pdf::DRMEncryptData::operator !=
bool operator !=(const DRMEncryptData &other) const
不等于操作符。
Definition: fs_security.h:626
foxit::pdf::RMSEncryptData::server_eul_list
StringArray server_eul_list
包含字符串对的字符串数组，用于表示编码服务器EUL的字典对象的内容。
Definition: fs_security.h:1010
foxit::pdf::CertificateEncryptData::Set
void Set(bool is_encrypt_metadata, SecurityHandler::CipherType cipher, const StringArray &envelopes)
设置值。
Definition: fs_security.h:423
foxit::pdf::CustomSecurityHandler
Definition: fs_security.h:852
foxit::pdf::SecurityHandler
Definition: fs_security.h:56
foxit::pdf::DRMSecurityHandler::VerifyEncryptionParams
bool VerifyEncryptionParams()
验证加密参数。
foxit::pdf::RMSEncryptData::RMSEncryptData
RMSEncryptData()
构造函数。
Definition: fs_security.h:901
foxit
Foxit命名空间。
Definition: fs_taggedpdf.h:27
foxit::pdf::RMSSecurityHandler
Definition: fs_security.h:1024
foxit::pdf::SecurityHandler::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
获取当前安全处理器的加密类型。
CFX_ByteString
字节字符串类
Definition: fx_string.h:317
foxit::pdf::PDFDoc::e_EncryptUnknown
未知加密类型。
Definition: fs_pdfdoc.h:793
foxit::pdf::PDFDoc::EncryptType
EncryptType
加密类型的枚举。
Definition: fs_pdfdoc.h:791
foxit::pdf::CustomSecurityCallback::GetSecurityType
virtual PDFDoc::EncryptType GetSecurityType()
获取安全回调的加密类型。
Definition: fs_security.h:1223
foxit::pdf::CustomSecurityCallback::DecryptData
virtual String DecryptData(const void *decryptor, const void *encrypted_data, uint32 encrypted_data_len)=0
用于解密加密数据的回调函数。
foxit::pdf::RMSEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
决定是否加密元数据的布尔值。true 表示加密元数据，false 表示不加密元数据。
Definition: fs_security.h:998
foxit::pdf::DRMEncryptData::user_permissions
uint32 user_permissions
用户权限。请参考从 PDFDoc::e_PermPrint 开始的值，可以是这些值中的一个或多个的组合。
Definition: fs_security.h:676
foxit::pdf::CustomSecurityCallback::FinishDecryptor
virtual String FinishDecryptor(void *decryptor)=0
用于完成解密的回调函数。
operator!=
bool operator!=(const char *str1, const CFX_ByteString &str2)
检查两个字节字符串是否不相等。
Definition: fs_basictypes.h:140
foxit::pdf::DRMEncryptData::key_length
int key_length
密钥长度，以字节为单位。 对于 SecurityHandler::e_CipherRC4 加密算法，此值应该在5到16之间。 对于 SecurityHandler::e_CipherAES 加密算法，此...
Definition: fs_security.h:668
foxit::pdf::StdEncryptData::user_permissions
uint32 user_permissions
用户权限。请参考从 PDFDoc::e_PermPrint 开始的值，应该是这些值中的一个或多个的组合。
Definition: fs_security.h:249
foxit::pdf::PDFDoc::e_EncryptFoxitDRM
加密类型：福昕DRM加密。
Definition: fs_pdfdoc.h:801
foxit::pdf::DRMSecurityCallback::GetCipherType
virtual SecurityHandler::CipherType GetCipherType(const PDFDoc &document, const char *sub_filter)=0
用于获取加密算法的密码类型的回调函数。
foxit::pdf::StdEncryptData::operator=
StdEncryptData & operator=(const StdEncryptData &other)
赋值操作符。
Definition: fs_security.h:185
foxit::pdf::DRMEncryptData::operator==
bool operator==(const DRMEncryptData &other) const
等于操作符。
Definition: fs_security.h:611
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:984
foxit::pdf::CertificateEncryptData::operator=
CertificateEncryptData & operator=(const CertificateEncryptData &other)
赋值操作符。
Definition: fs_security.h:368
foxit::pdf::StdSecurityHandler
Definition: fs_security.h:269
foxit::pdf::CustomSecurityHandler::CustomSecurityHandler
CustomSecurityHandler()
构造函数。
foxit::pdf::DRMEncryptData::is_encrypt_metadata
bool is_encrypt_metadata
决定是否加密元数据的布尔值。true 表示加密元数据，false 表示不加密元数据。
Definition: fs_security.h:659
foxit::pdf::CertificateEncryptData
Definition: fs_security.h:330
foxit::pdf::DRMSecurityCallback::GetFileID
virtual String GetFileID(const PDFDoc &document, const char *sub_filter)=0
用于获取文件标识字符串的回调函数。
foxit::pdf::CustomEncryptData::operator==
bool operator==(const CustomEncryptData &other) const
等于操作符。
Definition: fs_security.h:806
foxit::pdf::SecurityHandler::operator==
bool operator==(const SecurityHandler &other)
等于操作符。
foxit::pdf::SecurityHandler::e_CipherRC4
使用RC4加密算法，密钥长度在5字节到16字节之间。
Definition: fs_security.h:67
foxit::pdf::CustomEncryptData::CustomEncryptData
CustomEncryptData()
构造函数。
Definition: fs_security.h:770
foxit::pdf::CertificateEncryptData::operator==
bool operator==(const CertificateEncryptData &other) const
等于操作符。
Definition: fs_security.h:382
foxit::pdf::DRMEncryptData::sub_filter
String sub_filter
指定加密字典内容语法的子过滤器名称。
Definition: fs_security.h:661