hexapdf 0.27.0 → 0.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +100 -11
  3. data/examples/019-acro_form.rb +14 -3
  4. data/examples/023-images.rb +30 -0
  5. data/examples/024-digital-signatures.rb +23 -0
  6. data/lib/hexapdf/cli/info.rb +5 -1
  7. data/lib/hexapdf/cli/inspect.rb +2 -2
  8. data/lib/hexapdf/cli/split.rb +2 -2
  9. data/lib/hexapdf/configuration.rb +13 -14
  10. data/lib/hexapdf/content/canvas.rb +8 -3
  11. data/lib/hexapdf/dictionary.rb +1 -5
  12. data/lib/hexapdf/dictionary_fields.rb +6 -2
  13. data/lib/hexapdf/digital_signature/cms_handler.rb +137 -0
  14. data/lib/hexapdf/digital_signature/handler.rb +138 -0
  15. data/lib/hexapdf/digital_signature/pkcs1_handler.rb +96 -0
  16. data/lib/hexapdf/{type → digital_signature}/signature.rb +3 -8
  17. data/lib/hexapdf/digital_signature/signatures.rb +210 -0
  18. data/lib/hexapdf/digital_signature/signing/default_handler.rb +317 -0
  19. data/lib/hexapdf/digital_signature/signing/signed_data_creator.rb +308 -0
  20. data/lib/hexapdf/digital_signature/signing/timestamp_handler.rb +148 -0
  21. data/lib/hexapdf/digital_signature/signing.rb +101 -0
  22. data/lib/hexapdf/{type/signature → digital_signature}/verification_result.rb +37 -41
  23. data/lib/hexapdf/digital_signature.rb +56 -0
  24. data/lib/hexapdf/document.rb +27 -24
  25. data/lib/hexapdf/encryption/standard_security_handler.rb +2 -1
  26. data/lib/hexapdf/filter/ascii85_decode.rb +1 -1
  27. data/lib/hexapdf/importer.rb +32 -27
  28. data/lib/hexapdf/layout/list_box.rb +1 -5
  29. data/lib/hexapdf/object.rb +5 -0
  30. data/lib/hexapdf/parser.rb +13 -0
  31. data/lib/hexapdf/revision.rb +15 -12
  32. data/lib/hexapdf/revisions.rb +4 -0
  33. data/lib/hexapdf/tokenizer.rb +14 -8
  34. data/lib/hexapdf/type/acro_form/appearance_generator.rb +174 -128
  35. data/lib/hexapdf/type/acro_form/button_field.rb +5 -3
  36. data/lib/hexapdf/type/acro_form/choice_field.rb +2 -0
  37. data/lib/hexapdf/type/acro_form/field.rb +11 -5
  38. data/lib/hexapdf/type/acro_form/form.rb +33 -7
  39. data/lib/hexapdf/type/acro_form/signature_field.rb +2 -0
  40. data/lib/hexapdf/type/acro_form/text_field.rb +12 -2
  41. data/lib/hexapdf/type/annotations/widget.rb +3 -0
  42. data/lib/hexapdf/type/font_true_type.rb +14 -0
  43. data/lib/hexapdf/type/object_stream.rb +2 -2
  44. data/lib/hexapdf/type/outline.rb +1 -1
  45. data/lib/hexapdf/type/page.rb +56 -46
  46. data/lib/hexapdf/type.rb +0 -1
  47. data/lib/hexapdf/version.rb +1 -1
  48. data/lib/hexapdf/writer.rb +2 -3
  49. data/test/hexapdf/content/test_canvas.rb +5 -0
  50. data/test/hexapdf/{type/signature → digital_signature}/common.rb +34 -4
  51. data/test/hexapdf/digital_signature/signing/test_default_handler.rb +162 -0
  52. data/test/hexapdf/digital_signature/signing/test_signed_data_creator.rb +225 -0
  53. data/test/hexapdf/digital_signature/signing/test_timestamp_handler.rb +88 -0
  54. data/test/hexapdf/{type/signature/test_adbe_pkcs7_detached.rb → digital_signature/test_cms_handler.rb} +7 -7
  55. data/test/hexapdf/{type/signature → digital_signature}/test_handler.rb +4 -4
  56. data/test/hexapdf/{type/signature/test_adbe_x509_rsa_sha1.rb → digital_signature/test_pkcs1_handler.rb} +3 -3
  57. data/test/hexapdf/{type → digital_signature}/test_signature.rb +7 -7
  58. data/test/hexapdf/digital_signature/test_signatures.rb +137 -0
  59. data/test/hexapdf/digital_signature/test_signing.rb +53 -0
  60. data/test/hexapdf/{type/signature → digital_signature}/test_verification_result.rb +7 -7
  61. data/test/hexapdf/document/test_pages.rb +2 -2
  62. data/test/hexapdf/encryption/test_aes.rb +1 -1
  63. data/test/hexapdf/filter/test_predictor.rb +0 -1
  64. data/test/hexapdf/layout/test_box.rb +2 -1
  65. data/test/hexapdf/layout/test_column_box.rb +1 -1
  66. data/test/hexapdf/layout/test_list_box.rb +1 -1
  67. data/test/hexapdf/test_dictionary_fields.rb +2 -1
  68. data/test/hexapdf/test_document.rb +3 -9
  69. data/test/hexapdf/test_importer.rb +13 -6
  70. data/test/hexapdf/test_parser.rb +17 -0
  71. data/test/hexapdf/test_revision.rb +15 -14
  72. data/test/hexapdf/test_revisions.rb +43 -0
  73. data/test/hexapdf/test_stream.rb +1 -1
  74. data/test/hexapdf/test_tokenizer.rb +3 -4
  75. data/test/hexapdf/test_writer.rb +3 -3
  76. data/test/hexapdf/type/acro_form/test_appearance_generator.rb +135 -56
  77. data/test/hexapdf/type/acro_form/test_button_field.rb +6 -1
  78. data/test/hexapdf/type/acro_form/test_choice_field.rb +4 -0
  79. data/test/hexapdf/type/acro_form/test_field.rb +4 -4
  80. data/test/hexapdf/type/acro_form/test_form.rb +18 -0
  81. data/test/hexapdf/type/acro_form/test_signature_field.rb +4 -0
  82. data/test/hexapdf/type/acro_form/test_text_field.rb +13 -0
  83. data/test/hexapdf/type/test_font_true_type.rb +20 -0
  84. data/test/hexapdf/type/test_object_stream.rb +2 -1
  85. data/test/hexapdf/type/test_outline.rb +3 -0
  86. data/test/hexapdf/type/test_page.rb +67 -30
  87. data/test/hexapdf/type/test_page_tree_node.rb +4 -2
  88. metadata +69 -16
  89. data/lib/hexapdf/document/signatures.rb +0 -546
  90. data/lib/hexapdf/type/signature/adbe_pkcs7_detached.rb +0 -135
  91. data/lib/hexapdf/type/signature/adbe_x509_rsa_sha1.rb +0 -95
  92. data/lib/hexapdf/type/signature/handler.rb +0 -140
  93. data/test/hexapdf/document/test_signatures.rb +0 -352
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hexapdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Leitner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-18 00:00:00.000000000 Z
11
+ date: 2023-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cmdparse
@@ -114,6 +114,48 @@ dependencies:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
116
  version: '1.0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: webrick
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ - !ruby/object:Gem::Dependency
132
+ name: rake
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ - !ruby/object:Gem::Dependency
146
+ name: simplecov
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
117
159
  description: |
118
160
  HexaPDF is a pure Ruby library with an accompanying application for working with PDF
119
161
  files.
@@ -248,6 +290,8 @@ files:
248
290
  - examples/020-column_box.rb
249
291
  - examples/021-list_box.rb
250
292
  - examples/022-outline.rb
293
+ - examples/023-images.rb
294
+ - examples/024-digital-signatures.rb
251
295
  - examples/emoji-smile.png
252
296
  - examples/emoji-wink.png
253
297
  - examples/machupicchu.jpg
@@ -285,6 +329,17 @@ files:
285
329
  - lib/hexapdf/data_dir.rb
286
330
  - lib/hexapdf/dictionary.rb
287
331
  - lib/hexapdf/dictionary_fields.rb
332
+ - lib/hexapdf/digital_signature.rb
333
+ - lib/hexapdf/digital_signature/cms_handler.rb
334
+ - lib/hexapdf/digital_signature/handler.rb
335
+ - lib/hexapdf/digital_signature/pkcs1_handler.rb
336
+ - lib/hexapdf/digital_signature/signature.rb
337
+ - lib/hexapdf/digital_signature/signatures.rb
338
+ - lib/hexapdf/digital_signature/signing.rb
339
+ - lib/hexapdf/digital_signature/signing/default_handler.rb
340
+ - lib/hexapdf/digital_signature/signing/signed_data_creator.rb
341
+ - lib/hexapdf/digital_signature/signing/timestamp_handler.rb
342
+ - lib/hexapdf/digital_signature/verification_result.rb
288
343
  - lib/hexapdf/document.rb
289
344
  - lib/hexapdf/document/destinations.rb
290
345
  - lib/hexapdf/document/files.rb
@@ -292,7 +347,6 @@ files:
292
347
  - lib/hexapdf/document/images.rb
293
348
  - lib/hexapdf/document/layout.rb
294
349
  - lib/hexapdf/document/pages.rb
295
- - lib/hexapdf/document/signatures.rb
296
350
  - lib/hexapdf/encryption.rb
297
351
  - lib/hexapdf/encryption/aes.rb
298
352
  - lib/hexapdf/encryption/arc4.rb
@@ -443,11 +497,6 @@ files:
443
497
  - lib/hexapdf/type/page_label.rb
444
498
  - lib/hexapdf/type/page_tree_node.rb
445
499
  - lib/hexapdf/type/resources.rb
446
- - lib/hexapdf/type/signature.rb
447
- - lib/hexapdf/type/signature/adbe_pkcs7_detached.rb
448
- - lib/hexapdf/type/signature/adbe_x509_rsa_sha1.rb
449
- - lib/hexapdf/type/signature/handler.rb
450
- - lib/hexapdf/type/signature/verification_result.rb
451
500
  - lib/hexapdf/type/trailer.rb
452
501
  - lib/hexapdf/type/viewer_preferences.rb
453
502
  - lib/hexapdf/type/xref_stream.rb
@@ -544,13 +593,23 @@ files:
544
593
  - test/hexapdf/content/test_parser.rb
545
594
  - test/hexapdf/content/test_processor.rb
546
595
  - test/hexapdf/content/test_transformation_matrix.rb
596
+ - test/hexapdf/digital_signature/common.rb
597
+ - test/hexapdf/digital_signature/signing/test_default_handler.rb
598
+ - test/hexapdf/digital_signature/signing/test_signed_data_creator.rb
599
+ - test/hexapdf/digital_signature/signing/test_timestamp_handler.rb
600
+ - test/hexapdf/digital_signature/test_cms_handler.rb
601
+ - test/hexapdf/digital_signature/test_handler.rb
602
+ - test/hexapdf/digital_signature/test_pkcs1_handler.rb
603
+ - test/hexapdf/digital_signature/test_signature.rb
604
+ - test/hexapdf/digital_signature/test_signatures.rb
605
+ - test/hexapdf/digital_signature/test_signing.rb
606
+ - test/hexapdf/digital_signature/test_verification_result.rb
547
607
  - test/hexapdf/document/test_destinations.rb
548
608
  - test/hexapdf/document/test_files.rb
549
609
  - test/hexapdf/document/test_fonts.rb
550
610
  - test/hexapdf/document/test_images.rb
551
611
  - test/hexapdf/document/test_layout.rb
552
612
  - test/hexapdf/document/test_pages.rb
553
- - test/hexapdf/document/test_signatures.rb
554
613
  - test/hexapdf/encryption/common.rb
555
614
  - test/hexapdf/encryption/test_aes.rb
556
615
  - test/hexapdf/encryption/test_arc4.rb
@@ -662,11 +721,6 @@ files:
662
721
  - test/hexapdf/type/annotations/test_markup_annotation.rb
663
722
  - test/hexapdf/type/annotations/test_text.rb
664
723
  - test/hexapdf/type/annotations/test_widget.rb
665
- - test/hexapdf/type/signature/common.rb
666
- - test/hexapdf/type/signature/test_adbe_pkcs7_detached.rb
667
- - test/hexapdf/type/signature/test_adbe_x509_rsa_sha1.rb
668
- - test/hexapdf/type/signature/test_handler.rb
669
- - test/hexapdf/type/signature/test_verification_result.rb
670
724
  - test/hexapdf/type/test_annotation.rb
671
725
  - test/hexapdf/type/test_catalog.rb
672
726
  - test/hexapdf/type/test_cid_font.rb
@@ -689,7 +743,6 @@ files:
689
743
  - test/hexapdf/type/test_page_label.rb
690
744
  - test/hexapdf/type/test_page_tree_node.rb
691
745
  - test/hexapdf/type/test_resources.rb
692
- - test/hexapdf/type/test_signature.rb
693
746
  - test/hexapdf/type/test_trailer.rb
694
747
  - test/hexapdf/type/test_xref_stream.rb
695
748
  - test/hexapdf/utils/test_bit_field.rb
@@ -720,7 +773,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
720
773
  - !ruby/object:Gem::Version
721
774
  version: '0'
722
775
  requirements: []
723
- rubygems_version: 3.2.32
776
+ rubygems_version: 3.4.1
724
777
  signing_key:
725
778
  specification_version: 4
726
779
  summary: HexaPDF - A Versatile PDF Creation and Manipulation Library For Ruby