OLD | NEW |
1 #ifndef __DEFINED__SkPdfStandardSecurityHandlerDictionary | 1 #ifndef __DEFINED__SkPdfStandardSecurityHandlerDictionary |
2 #define __DEFINED__SkPdfStandardSecurityHandlerDictionary | 2 #define __DEFINED__SkPdfStandardSecurityHandlerDictionary |
3 | 3 |
4 #include "SkPdfEnums_autogen.h" | 4 #include "SkPdfEnums_autogen.h" |
5 #include "SkPdfArray_autogen.h" | 5 #include "SkPdfArray_autogen.h" |
6 #include "SkPdfDictionary_autogen.h" | 6 #include "SkPdfDictionary_autogen.h" |
7 | 7 |
| 8 // Additional encryption dictionary entries for the standard security handler |
8 class SkPdfStandardSecurityHandlerDictionary : public SkPdfDictionary { | 9 class SkPdfStandardSecurityHandlerDictionary : public SkPdfDictionary { |
9 public: | 10 public: |
10 virtual SkPdfObjectType getType() const { return kStandardSecurityHandlerDicti
onary_SkPdfObjectType;} | 11 virtual SkPdfObjectType getType() const { return kStandardSecurityHandlerDicti
onary_SkPdfObjectType;} |
11 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kStandar
dSecurityHandlerDictionary_SkPdfObjectType + 1);} | 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kStandar
dSecurityHandlerDictionary_SkPdfObjectType + 1);} |
12 public: | 13 public: |
13 virtual SkPdfStandardSecurityHandlerDictionary* asStandardSecurityHandlerDicti
onary() {return this;} | 14 virtual SkPdfStandardSecurityHandlerDictionary* asStandardSecurityHandlerDicti
onary() {return this;} |
14 virtual const SkPdfStandardSecurityHandlerDictionary* asStandardSecurityHandle
rDictionary() const {return this;} | 15 virtual const SkPdfStandardSecurityHandlerDictionary* asStandardSecurityHandle
rDictionary() const {return this;} |
15 | 16 |
16 private: | 17 private: |
17 virtual SkPdfALinkAnnotationDictionary* asALinkAnnotationDictionary() {return
NULL;} | 18 virtual SkPdfALinkAnnotationDictionary* asALinkAnnotationDictionary() {return
NULL;} |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 | 515 |
515 public: | 516 public: |
516 private: | 517 private: |
517 public: | 518 public: |
518 SkPdfStandardSecurityHandlerDictionary(const PdfMemDocument* podofoDoc = NULL,
const PdfObject* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} | 519 SkPdfStandardSecurityHandlerDictionary(const PdfMemDocument* podofoDoc = NULL,
const PdfObject* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} |
519 | 520 |
520 virtual bool valid() const {return true;} | 521 virtual bool valid() const {return true;} |
521 | 522 |
522 SkPdfStandardSecurityHandlerDictionary& operator=(const SkPdfStandardSecurityH
andlerDictionary& from) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj =
from.fPodofoObj; return *this;} | 523 SkPdfStandardSecurityHandlerDictionary& operator=(const SkPdfStandardSecurityH
andlerDictionary& from) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj =
from.fPodofoObj; return *this;} |
523 | 524 |
| 525 /** (Required) A number specifying which revision of the standard security handl
er should |
| 526 * be used to interpret this dictionary. The revision number should be 2 if the
document is |
| 527 * encrypted with a V value less than 2 (see Table 3.13) and does not have any
of the access |
| 528 * permissions set (via the P entry, below) that are designated "Revision 3" in
Table 3.15; |
| 529 * otherwise (that is, if the document is encrypted with a V value greater than
2 or has any |
| 530 * "Revision 3" access permissions set), this value should be 3. |
| 531 **/ |
| 532 bool has_R() const { |
| 533 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "R", "
", NULL)); |
| 534 } |
| 535 |
524 double R() const { | 536 double R() const { |
525 double ret; | 537 double ret; |
526 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "R", "", &
ret)) return ret; | 538 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "R", "", &
ret)) return ret; |
527 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 539 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
528 return 0; | 540 return 0; |
529 } | 541 } |
530 | 542 |
| 543 /** (Required) A 32-byte string, based on both the owner and user passwords, tha
t is used in |
| 544 * computing the encryption key and in determining whether a valid owner passwo
rd was |
| 545 * entered. For more information, see "Encryption Key Algorithm" on page 78 and
"Pass- |
| 546 * word Algorithms" on page 79. |
| 547 **/ |
| 548 bool has_O() const { |
| 549 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "O", "
", NULL)); |
| 550 } |
| 551 |
531 std::string O() const { | 552 std::string O() const { |
532 std::string ret; | 553 std::string ret; |
533 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "O", "", &
ret)) return ret; | 554 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "O", "", &
ret)) return ret; |
534 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 555 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
535 return ""; | 556 return ""; |
536 } | 557 } |
537 | 558 |
| 559 /** (Required) A 32-byte string, based on the user password, that is used in det
ermining |
| 560 * whether to prompt the user for a password and, if so, whether a valid user o
r owner pass- |
| 561 * word was entered. For more information, see "Password Algorithms" on page 79
. |
| 562 **/ |
| 563 bool has_U() const { |
| 564 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "U", "
", NULL)); |
| 565 } |
| 566 |
538 std::string U() const { | 567 std::string U() const { |
539 std::string ret; | 568 std::string ret; |
540 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "U", "", &
ret)) return ret; | 569 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "U", "", &
ret)) return ret; |
541 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 570 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
542 return ""; | 571 return ""; |
543 } | 572 } |
544 | 573 |
| 574 /** (Required) A set of flags specifying which operations are permitted when the
document is |
| 575 * opened with user access (see Table 3.15). |
| 576 **/ |
| 577 bool has_P() const { |
| 578 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "P", "
", NULL)); |
| 579 } |
| 580 |
545 long P() const { | 581 long P() const { |
546 long ret; | 582 long ret; |
547 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "P", "", &re
t)) return ret; | 583 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "P", "", &re
t)) return ret; |
548 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 584 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
549 return 0; | 585 return 0; |
550 } | 586 } |
551 | 587 |
552 }; | 588 }; |
553 | 589 |
554 #endif // __DEFINED__SkPdfStandardSecurityHandlerDictionary | 590 #endif // __DEFINED__SkPdfStandardSecurityHandlerDictionary |
OLD | NEW |