PoDoFo 1.1.0
Loading...
Searching...
No Matches
PdfEncrypt.h
1// SPDX-FileCopyrightText: 2006 Dominik Seichter <domseichter@web.de>
2// SPDX-FileCopyrightText: 2020 Francesco Pretto <ceztko@gmail.com>
3// SPDX-License-Identifier: LGPL-2.0-or-later OR MPL-2.0
4
5#ifndef PDF_ENCRYPT_H
6#define PDF_ENCRYPT_H
7
8#include "PdfString.h"
9#include "PdfReference.h"
10
11// Define an opaque type for the internal PoDoFo encryption context
12#ifndef PODOFO_CRYPT_CTX
13#define PODOFO_CRYPT_CTX void
14#endif // PODOFO_CRYPT_CTX
15
16namespace PoDoFo
17{
18
19class PdfDictionary;
20class InputStream;
21class PdfObject;
22class OutputStream;
23
24/* Class representing PDF encryption methods. (For internal use only)
25 * Based on code from Ulrich Telle: http://wxcode.sourceforge.net/components/wxpdfdoc/
26 * Original Copyright header:
27 * Name: pdfencrypt.h
28 * Purpose:
29 * Author: Ulrich Telle
30 * Modified by:
31 * Created: 2005-08-16
32 * Copyright: (c) Ulrich Telle
33 * Licence: wxWindows licence
34 */
35
39{
40 Unknown = 0,
41 L40 = 40,
42 L48 = 48,
43 L56 = 56,
44 L64 = 64,
45 L72 = 72,
46 L80 = 80,
47 L88 = 88,
48 L96 = 96,
49 L104 = 104,
50 L112 = 112,
51 L120 = 120,
52 L128 = 128,
53 L256 = 256
54};
55
58// ISO 32000-2:2020 7.6.4.2 "Standard encryption dictionary":
59// "The value of the P entry shall be interpreted as an unsigned
60// 32-bit quantity containing a set of flags."
62{
63 None = 0,
64 Print = 0x00000004,
65 Edit = 0x00000008,
66 Copy = 0x00000010,
67 EditNotes = 0x00000020,
68 FillAndSign = 0x00000100,
69 Accessible = 0x00000200,
70 DocAssembly = 0x00000400,
71 HighPrint = 0x00000800,
72 Default = Print
73 | Edit
74 | Copy
75 | EditNotes
79 | HighPrint
80};
81
86{
87 None = 0,
88 RC4V1 = 1,
89 RC4V2 = 2,
90 AESV2 = 4,
91 AESV3R5 = 8,
92 AESV3R6 = 16,
93};
94
96{
97 Unkwnon = 0,
98 Failed,
99 User,
100 Owner,
101};
102
103class PdfEncryptContext;
104
115class PODOFO_API PdfEncrypt
116{
117 friend class PdfEncryptMD5Base;
118 friend class PdfEncryptAESV3;
119 PODOFO_PRIVATE_FRIEND(class PdfEncryptSession);
120
121public:
122 virtual ~PdfEncrypt();
123
138 static std::unique_ptr<PdfEncrypt> Create(const std::string_view& userPassword,
139 const std::string_view& ownerPassword,
140 PdfPermissions protection = PdfPermissions::Default,
141 PdfEncryptionAlgorithm algorithm = PdfEncryptionAlgorithm::AESV3R6,
142 PdfKeyLength keyLength = PdfKeyLength::Unknown);
143
155 static std::unique_ptr<PdfEncrypt> CreateFromObject(const PdfObject& obj);
156
168 static PdfEncryptionAlgorithm GetEnabledEncryptionAlgorithms();
169
177 static bool IsEncryptionEnabled(PdfEncryptionAlgorithm algorithm);
178
183 void EnsureEncryptionInitialized(const PdfString& documentId, PdfEncryptContext& context);
184
193 void Authenticate(const std::string_view& password, const PdfString& documentId, PdfEncryptContext& context) const;
194
203
214 virtual std::unique_ptr<InputStream> CreateEncryptionInputStream(InputStream& inputStream, size_t inputLen,
215 PdfEncryptContext& context, const PdfReference& objref) const = 0;
216
227 virtual std::unique_ptr<OutputStream> CreateEncryptionOutputStream(OutputStream& outputStream,
228 PdfEncryptContext& context, const PdfReference& objref) const = 0;
229
233 inline PdfEncryptionAlgorithm GetEncryptAlgorithm() const { return m_Algorithm; }
234
244 bool IsOwnerPasswordSet() const;
245
253 bool IsPrintAllowed() const;
254
262 bool IsEditAllowed() const;
263
271 bool IsCopyAllowed() const;
272
280 bool IsEditNotesAllowed() const;
281
289 bool IsFillAndSignAllowed() const;
290
298 bool IsAccessibilityAllowed() const;
299
307 bool IsDocAssemblyAllowed() const;
308
316 bool IsHighPrintAllowed() const;
317
320 void EncryptTo(charbuff& out, const bufferview& view, PdfEncryptContext& context, const PdfReference& objref) const;
321
324 void DecryptTo(charbuff& out, const bufferview& view, PdfEncryptContext& context, const PdfReference& objref) const;
325
328 virtual size_t CalculateStreamLength(size_t length) const = 0;
329
332 virtual size_t CalculateStreamOffset() const = 0;
333
337 unsigned GetKeyLengthBytes() const;
338
341 bufferview GetUValue() const;
342
345 bufferview GetOValue() const;
346
347public:
350 PdfKeyLength GetKeyLength() const { return m_KeyLength; }
351
354 inline PdfPermissions GetPValue() const { return m_pValue; }
355
358 inline unsigned GetRevision() const { return m_rValue; }
359
360 inline bool IsMetadataEncrypted() const { return m_EncryptMetadata; }
361
362 inline bool IsParsed() const { return m_IsParsed; }
363
364protected:
365 inline const unsigned char* GetUValueRaw() const { return m_uValue; }
366
367 inline const unsigned char* GetOValueRaw() const { return m_oValue; }
368
369 inline const std::string& GetUserPassword() const { return m_userPass; }
370
371 inline const std::string& GetOwnerPassword() const { return m_ownerPass; }
372
373 int64_t GetPValueForSerialization() const;
374
375protected:
379 void InitFromValues(PdfEncryptionAlgorithm algorithm, PdfKeyLength keyLength, unsigned char revision,
380 PdfPermissions pValue, const bufferview& uValue, const bufferview& oValue,
381 bool encryptedMetadata);
382
387 void InitFromScratch(const std::string_view& userPassword, const std::string_view& ownerPassword,
388 PdfEncryptionAlgorithm algorithm, PdfKeyLength keyLength, unsigned char revision,
389 PdfPermissions pValue, bool encryptedMetadata);
390
391 virtual void Decrypt(const char* inStr, size_t inLen, PdfEncryptContext& context,
392 const PdfReference& objref, char* outStr, size_t& outLen) const = 0;
393
394 virtual void Encrypt(const char* inStr, size_t inLen, PdfEncryptContext& context,
395 const PdfReference& objref, char* outStr, size_t outLen) const = 0;
396
397 virtual PdfAuthResult Authenticate(const std::string_view& password, const std::string_view& documentId,
398 PODOFO_CRYPT_CTX* ctx, unsigned char encryptionKey[32]) const = 0;
399
400 virtual void GenerateEncryptionKey(
401 const std::string_view& documentId, PdfAuthResult authResult, PODOFO_CRYPT_CTX* ctx,
402 unsigned char uValue[48], unsigned char oValue[48], unsigned char encryptionKey[32]) = 0;
403
404 // Check two keys for equality
405 bool CheckKey(const unsigned char key1[32], const unsigned char key2[32]) const;
406
407 enum class PdfRC4Revision : uint8_t
408 {
409 R2 = 2,
410 R3 = 3,
411 };
412
413 enum class PdfAESV3Revision : uint8_t
414 {
415 R5 = 5,
416 R6 = 6,
417 };
418
419private:
420 PdfEncrypt();
421
422 PdfEncrypt(const PdfEncrypt& rhs) = default;
423
424 PdfEncrypt& operator=(PdfEncrypt& rhs) = delete;
425
426private:
427 static std::unique_ptr<PdfEncrypt> CreateFromEncrypt(const PdfEncrypt& rhs);
428
429 void clearSensitiveInfo();
430
431private:
432 PdfEncryptionAlgorithm m_Algorithm; // The used encryption algorithm
433 unsigned char m_rValue; // Revision
434 PdfKeyLength m_KeyLength; // The encryption key length, as enum value
435 PdfPermissions m_pValue; // P entry in pdf document
436 unsigned char m_uValue[48]; // U entry in pdf document
437 unsigned char m_oValue[48]; // O entry in pdf document
438 unsigned char m_uValueSize;
439 unsigned char m_oValueSize;
440 bool m_EncryptMetadata; // Is metadata encrypted
441 bool m_IsParsed; // True if the object is created from parsed values
442 bool m_initialized; // True if the object O/U values were filled
443 std::string m_userPass; // User password
444 std::string m_ownerPass; // Owner password
445
446};
447
448class PODOFO_API PdfEncryptContext final
449{
450 friend class PdfEncrypt;
451 friend class PdfEncryptRC4;
452 friend class PdfEncryptAESV2;
453 friend class PdfEncryptAESV3;
454
455public:
456 PdfEncryptContext();
457
458 ~PdfEncryptContext();
459
460 PdfEncryptContext(const PdfEncryptContext&);
461
462 PdfEncryptContext& operator=(const PdfEncryptContext&);
463
464public:
465 inline PdfAuthResult GetAuthResult() { return m_AuthResult; }
466
467 inline const std::string GetDocumentId() { return m_documentId; }
468
469 bool IsAuthenticated() const;
470
471private:
472 inline const unsigned char* GetEncryptionKey() const { return m_encryptionKey; }
473
474 PODOFO_CRYPT_CTX* GetCryptCtx();
475
476 template <typename T>
477 T& GetCustomCtx()
478 {
479 if (m_customCtx == nullptr)
480 {
481 m_customCtx = ::operator new(sizeof(T));
482 m_customCtxSize = sizeof(T);
483 }
484
485 return *(T*)m_customCtx;
486 }
487
488private:
489 unsigned char m_encryptionKey[32]; // Encryption key
490 std::string m_documentId; // DocumentID of the current document
491 PdfAuthResult m_AuthResult;
492 PODOFO_CRYPT_CTX* m_cryptCtx;
493 void* m_customCtx;
494 size_t m_customCtxSize;
495};
496
497
506{
507 friend class PdfEncryptRC4;
508 friend class PdfEncryptAESV2;
509
510private:
512
514
515public:
517
518 // NOTE: We must declare again without body otherwise the other Authenticate overload hides it
519 PdfAuthResult Authenticate(const std::string_view& password, const std::string_view& documentId,
520 PODOFO_CRYPT_CTX* ctx, unsigned char encryptionKey[32]) const override = 0;
521
522protected:
523 // Compute owner key
524 static void ComputeOwnerKey(const unsigned char userPad[32], const unsigned char ownerPad[32],
525 unsigned keylength, unsigned revision, bool authenticate, PODOFO_CRYPT_CTX* ctx, unsigned char ownerKey[32]);
526
527 // Pad a password to 32 characters
528 static void PadPassword(const std::string_view& password, unsigned char pswd[32]);
529
530 // Compute encryption key and user key
531 static void ComputeEncryptionKey(const std::string_view& documentID,
532 const unsigned char userPad[32], const unsigned char ownerKey[32],
533 PdfPermissions pValue, unsigned keyLength, unsigned revision,
534 bool encryptMetadata, PODOFO_CRYPT_CTX* ctx,
535 unsigned char userKey[32], unsigned char encryptionKey[32]);
536
542 void CreateObjKey(unsigned char objkey[16], unsigned& pnKeyLen,
543 const unsigned char m_encryptionKey[32], const PdfReference& objref) const;
544};
545
553{
554 friend class PdfEncrypt;
555
556private:
558 PdfEncryptAESV2(const std::string_view& userPassword, const std::string_view& ownerPassword,
561
562public:
563 std::unique_ptr<InputStream> CreateEncryptionInputStream(InputStream& inputStream, size_t inputLen,
564 PdfEncryptContext& context, const PdfReference& objref) const override;
565 std::unique_ptr<OutputStream> CreateEncryptionOutputStream(OutputStream& outputStream,
566 PdfEncryptContext& context, const PdfReference& objref) const override;
567
568 size_t CalculateStreamOffset() const override;
569
570 size_t CalculateStreamLength(size_t length) const override;
571
572protected:
573 void Encrypt(const char* inStr, size_t inLen, PdfEncryptContext& context,
574 const PdfReference& objref, char* outStr, size_t outLen) const override;
575 void Decrypt(const char* inStr, size_t inLen, PdfEncryptContext& context,
576 const PdfReference& objref, char* outStr, size_t& outLen) const override;
577
578 void GenerateEncryptionKey(const std::string_view& documentId, PdfAuthResult authResult, PODOFO_CRYPT_CTX* ctx,
579 unsigned char uValue[48], unsigned char oValue[48], unsigned char encryptionKey[32]) override;
580
581 PdfAuthResult Authenticate(const std::string_view& password, const std::string_view& documentId,
582 PODOFO_CRYPT_CTX* ctx, unsigned char encryptionKey[32]) const override;
583
584private:
585 void generateInitialVector(const std::string_view& documentId, unsigned char iv[]) const;
586};
587
595{
596 friend class PdfEncrypt;
597
598private:
600 PdfPermissions pValue, PdfString permsValue, PdfAESV3Revision rev);
601 PdfEncryptAESV3(const std::string_view& userPassword, const std::string_view& ownerPassword,
602 PdfAESV3Revision rev, PdfPermissions protection);
604
605public:
606 std::unique_ptr<InputStream> CreateEncryptionInputStream(InputStream& inputStream, size_t inputLen,
607 PdfEncryptContext& context, const PdfReference& objref) const override;
608 std::unique_ptr<OutputStream> CreateEncryptionOutputStream(OutputStream& outputStream,
609 PdfEncryptContext& context, const PdfReference& objref) const override;
610
611 size_t CalculateStreamOffset() const override;
612
613 size_t CalculateStreamLength(size_t length) const override;
614
616
617 // Get the UE object value (user)
618 bufferview GetUEValue() const;
619
620 // Get the OE object value (owner)
621 bufferview GetOEValue() const;
622
623 // Get the Perms object value (encrypted protection)
624 bufferview GetPermsValue() const;
625
626protected:
627 // Encrypt a character string
628 void Encrypt(const char* inStr, size_t inLen, PdfEncryptContext& context,
629 const PdfReference& objref, char* outStr, size_t outLen) const override;
630 void Decrypt(const char* inStr, size_t inLen, PdfEncryptContext& context,
631 const PdfReference& objref, char* outStr, size_t& outLen) const override;
632
633 PdfAuthResult Authenticate(const std::string_view& password, const std::string_view& documentId,
634 PODOFO_CRYPT_CTX* ctx, unsigned char encryptionKey[32]) const override;
635
636 void GenerateEncryptionKey(const std::string_view& documentId, PdfAuthResult authResult, PODOFO_CRYPT_CTX* ctx,
637 unsigned char uValue[48], unsigned char oValue[48], unsigned char encryptionKey[32]) override;
638
639private:
640 // Generate initial vector
641 static void generateInitialVector(unsigned char iv[]);
642
643 // Preprocess password for use in EAS-256 Algorithm
644 // outBuf needs to be at least 127 bytes long
645 static void preprocessPassword(const std::string_view& password, unsigned char* outBuf, unsigned& len);
646
647 // Compute encryption key to be used with AES-256
648 static void computeEncryptionKey(unsigned keyLength, unsigned char encryptionKey[32]);
649
650 // Compute hash for password and salt with optional uValue
651 static void computeHash(const unsigned char* pswd, unsigned pswdLen, unsigned revision,
652 const unsigned char salt[8], const unsigned char uValue[48], unsigned char hashValue[32]);
653
654 // Generate the U and UE entries
655 static void computeUserKey(const unsigned char* userpswd, unsigned len, unsigned revision,
656 unsigned keyLength, const unsigned char encryptionKey[32],
657 unsigned char uValue[48], unsigned char ueValue[32]);
658
659 // Generate the O and OE entries
660 static void computeOwnerKey(const unsigned char* userpswd, unsigned len, unsigned revision,
661 unsigned keyLength, const unsigned char encryptionKey[32], const unsigned char uValue[48],
662 unsigned char oValue[48], unsigned char oeValue[32]);
663
664private:
665 unsigned char m_ueValue[32]; // UE entry in pdf document
666 unsigned char m_oeValue[32]; // OE entry in pdf document
667 unsigned char m_permsValue[16]; // Perms entry in pdf document
668};
669
677{
678 friend class PdfEncrypt;
679
680private:
683 unsigned keyLength, bool encryptMetadata);
684 PdfEncryptRC4(const std::string_view& userPassword, const std::string_view& ownerPassword,
688 PdfEncryptRC4(const PdfEncryptRC4& rhs) = default;
689
690public:
691 std::unique_ptr<InputStream> CreateEncryptionInputStream(InputStream& inputStream, size_t inputLen,
692 PdfEncryptContext& context, const PdfReference& objref) const override;
693
694 std::unique_ptr<OutputStream> CreateEncryptionOutputStream(OutputStream& outputStream,
695 PdfEncryptContext& context, const PdfReference& objref) const override;
696
697 size_t CalculateStreamOffset() const override;
698
699 size_t CalculateStreamLength(size_t length) const override;
700
701protected:
702 void Encrypt(const char* inStr, size_t inLen, PdfEncryptContext& context,
703 const PdfReference& objref, char* outStr, size_t outLen) const override;
704
705 void Decrypt(const char* inStr, size_t inLen, PdfEncryptContext& context,
706 const PdfReference& objref, char* outStr, size_t& outLen) const override;
707
708 void GenerateEncryptionKey(const std::string_view& documentId, PdfAuthResult authResult, PODOFO_CRYPT_CTX* ctx,
709 unsigned char uValue[48], unsigned char oValue[48], unsigned char encryptionKey[32]) override;
710
711 PdfAuthResult Authenticate(const std::string_view& password, const std::string_view& documentId,
712 PODOFO_CRYPT_CTX* ctx, unsigned char encryptionKey[32]) const override;
713
714private:
715 static unsigned normalizeKeyLength(unsigned keyLength);
716};
717
718}
719ENABLE_BITMASK_OPERATORS(PoDoFo::PdfPermissions);
720ENABLE_BITMASK_OPERATORS(PoDoFo::PdfEncryptionAlgorithm);
721
722#endif // PDF_ENCRYPT_H
An interface for reading blocks of data from a data source.
Definition InputStream.h:18
An interface for writing blocks of data to a data source.
Definition OutputStream.h:16
The PDF dictionary data type of PoDoFo (inherits from PdfDataContainer, the base class for such repre...
Definition PdfDictionary.h:80
A class that is used to encrypt a PDF file (AES-128)
Definition PdfEncrypt.h:553
size_t CalculateStreamLength(size_t length) const override
Calculate stream size.
Definition PdfEncrypt.cpp:1385
std::unique_ptr< OutputStream > CreateEncryptionOutputStream(OutputStream &outputStream, PdfEncryptContext &context, const PdfReference &objref) const override
Create an OutputStream that encrypts all data written to it using the current settings of the PdfEncr...
Definition PdfEncrypt.cpp:1403
std::unique_ptr< InputStream > CreateEncryptionInputStream(InputStream &inputStream, size_t inputLen, PdfEncryptContext &context, const PdfReference &objref) const override
Create an InputStream that decrypts all data read from it using the current settings of the PdfEncryp...
Definition PdfEncrypt.cpp:1394
size_t CalculateStreamOffset() const override
Calculate stream offset.
Definition PdfEncrypt.cpp:1326
A class that is used to encrypt a PDF file (AES-256)
Definition PdfEncrypt.h:595
std::unique_ptr< InputStream > CreateEncryptionInputStream(InputStream &inputStream, size_t inputLen, PdfEncryptContext &context, const PdfReference &objref) const override
Create an InputStream that decrypts all data read from it using the current settings of the PdfEncryp...
Definition PdfEncrypt.cpp:1925
size_t CalculateStreamLength(size_t length) const override
Calculate stream size.
Definition PdfEncrypt.cpp:1916
void CreateEncryptionDictionary(PdfDictionary &dictionary) const override
Fill all keys into a encryption dictionary.
Definition PdfEncrypt.cpp:1630
std::unique_ptr< OutputStream > CreateEncryptionOutputStream(OutputStream &outputStream, PdfEncryptContext &context, const PdfReference &objref) const override
Create an OutputStream that encrypts all data written to it using the current settings of the PdfEncr...
Definition PdfEncrypt.cpp:1932
size_t CalculateStreamOffset() const override
Calculate stream offset.
Definition PdfEncrypt.cpp:1836
A pure virtual class that is used to encrypt a PDF file (RC4, AES-128) This class is the base for cla...
Definition PdfEncrypt.h:506
void CreateObjKey(unsigned char objkey[16], unsigned &pnKeyLen, const unsigned char m_encryptionKey[32], const PdfReference &objref) const
Create the encryption key for the current object.
Definition PdfEncrypt.cpp:894
void CreateEncryptionDictionary(PdfDictionary &dictionary) const override
Fill all keys into a encryption dictionary.
Definition PdfEncrypt.cpp:965
A class that is used to encrypt a PDF file (RC4 40-bit and 128-bit)
Definition PdfEncrypt.h:677
size_t CalculateStreamOffset() const override
Calculate stream offset.
Definition PdfEncrypt.cpp:1080
std::unique_ptr< OutputStream > CreateEncryptionOutputStream(OutputStream &outputStream, PdfEncryptContext &context, const PdfReference &objref) const override
Create an OutputStream that encrypts all data written to it using the current settings of the PdfEncr...
Definition PdfEncrypt.cpp:1196
std::unique_ptr< InputStream > CreateEncryptionInputStream(InputStream &inputStream, size_t inputLen, PdfEncryptContext &context, const PdfReference &objref) const override
Create an InputStream that decrypts all data read from it using the current settings of the PdfEncryp...
Definition PdfEncrypt.cpp:1106
size_t CalculateStreamLength(size_t length) const override
Calculate stream size.
Definition PdfEncrypt.cpp:1085
A bundle of the encrypt object together a context.
Definition PdfEncryptSession.h:15
A class that is used to encrypt a PDF file and set document permissions on the PDF file.
Definition PdfEncrypt.h:116
virtual size_t CalculateStreamLength(size_t length) const =0
Calculate stream size.
unsigned GetRevision() const
Get the revision number of the encryption method.
Definition PdfEncrypt.h:358
virtual size_t CalculateStreamOffset() const =0
Calculate stream offset.
virtual std::unique_ptr< OutputStream > CreateEncryptionOutputStream(OutputStream &outputStream, PdfEncryptContext &context, const PdfReference &objref) const =0
Create an OutputStream that encrypts all data written to it using the current settings of the PdfEncr...
void Authenticate(const std::string_view &password, const PdfString &documentId, PdfEncryptContext &context) const
Tries to authenticate a user using either the user or owner password.
virtual std::unique_ptr< InputStream > CreateEncryptionInputStream(InputStream &inputStream, size_t inputLen, PdfEncryptContext &context, const PdfReference &objref) const =0
Create an InputStream that decrypts all data read from it using the current settings of the PdfEncryp...
PdfPermissions GetPValue() const
Get the P object value (protection)
Definition PdfEncrypt.h:354
virtual void CreateEncryptionDictionary(PdfDictionary &dictionary) const =0
Fill all keys into a encryption dictionary.
PdfKeyLength GetKeyLength() const
Get the length of the encryption key in bits.
Definition PdfEncrypt.h:350
PdfEncryptionAlgorithm GetEncryptAlgorithm() const
Get the encryption algorithm of this object.
Definition PdfEncrypt.h:233
This class represents a PDF indirect Object in memory.
Definition PdfObject.h:33
A reference is a pointer to a object in the PDF file of the form "4 0 R", where 4 is the object numbe...
Definition PdfReference.h:22
A string that can be written to a PDF document.
Definition PdfString.h:22
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition basetypes.h:35
All classes, functions, types and enums of PoDoFo are members of these namespace.
Definition basetypes.h:13
PdfEncryptionAlgorithm
The encryption algorithm.
Definition PdfEncrypt.h:86
@ AESV3R5
AES encryption with a 256 bit key (PDF1.7 extension 3, deprecated in PDF 2.0)
@ AESV3R6
AES encryption with a 256 bit key, Revision 6 (PDF1.7 extension 8, PDF 2.0)
@ AESV2
AES encryption with a 128 bit key (PDF1.6)
@ RC4V1
RC4 Version 1 encryption using a 40bit key.
@ RC4V2
RC4 Version 2 encryption using a key with 40-128bit.
@ None
Do not add a default appearrance.
@ Create
Create a new file or truncate existing one for writing/reading.
cspan< char > bufferview
Convenient read-only char buffer span.
Definition basetypes.h:16
PdfPermissions
Set user permissions/restrictions on a document.
Definition PdfEncrypt.h:62
@ FillAndSign
Fill in existing form or signature fields.
@ HighPrint
Print a high resolution version of the document.
@ Copy
Allow text and graphic extraction.
@ DocAssembly
Assemble the document: insert, create, rotate delete pages or add bookmarks.
@ Edit
Allow modifying the document besides annotations, form fields or changing pages.
@ EditNotes
Add or modify text annotations or form fields (if PdfPermissions::Edit is set also allow to create in...
@ Accessible
Extract text and graphics to support user with disabilities.
PdfKeyLength
A enum specifying a valid keylength for a PDF encryption key.
Definition PdfEncrypt.h:39
PdfAuthResult
Definition PdfEncrypt.h:96
@ User
Success authenticating a user for this PDF.
@ Owner
Success authenticating the owner for this PDF.
@ Failed
Failed to authenticate to this PDF.