hexapdf 0.19.2 → 0.20.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +67 -0
- data/data/hexapdf/cert/demo_cert.rb +22 -0
- data/data/hexapdf/cert/root-ca.crt +119 -0
- data/data/hexapdf/cert/signing.crt +125 -0
- data/data/hexapdf/cert/signing.key +52 -0
- data/data/hexapdf/cert/sub-ca.crt +125 -0
- data/data/hexapdf/encoding/glyphlist.txt +4283 -4282
- data/data/hexapdf/encoding/zapfdingbats.txt +203 -202
- data/lib/hexapdf/cli/info.rb +21 -1
- data/lib/hexapdf/configuration.rb +26 -0
- data/lib/hexapdf/content/processor.rb +1 -1
- data/lib/hexapdf/document/signatures.rb +327 -0
- data/lib/hexapdf/document.rb +26 -0
- data/lib/hexapdf/font/encoding/glyph_list.rb +5 -6
- data/lib/hexapdf/importer.rb +1 -1
- data/lib/hexapdf/object.rb +5 -3
- data/lib/hexapdf/parser.rb +14 -9
- data/lib/hexapdf/rectangle.rb +0 -6
- data/lib/hexapdf/revision.rb +13 -6
- data/lib/hexapdf/task/dereference.rb +12 -4
- data/lib/hexapdf/task/optimize.rb +3 -3
- data/lib/hexapdf/type/acro_form/appearance_generator.rb +2 -4
- data/lib/hexapdf/type/acro_form/field.rb +2 -0
- data/lib/hexapdf/type/acro_form/form.rb +9 -1
- data/lib/hexapdf/type/annotation.rb +36 -3
- data/lib/hexapdf/type/font_simple.rb +1 -1
- data/lib/hexapdf/type/object_stream.rb +3 -1
- data/lib/hexapdf/type/signature/adbe_pkcs7_detached.rb +121 -0
- data/lib/hexapdf/type/signature/adbe_x509_rsa_sha1.rb +95 -0
- data/lib/hexapdf/type/signature/handler.rb +140 -0
- data/lib/hexapdf/type/signature/verification_result.rb +92 -0
- data/lib/hexapdf/type/signature.rb +236 -0
- data/lib/hexapdf/type.rb +1 -0
- data/lib/hexapdf/version.rb +1 -1
- data/lib/hexapdf/writer.rb +16 -8
- data/test/hexapdf/content/test_processor.rb +1 -1
- data/test/hexapdf/document/test_signatures.rb +225 -0
- data/test/hexapdf/task/test_optimize.rb +4 -1
- data/test/hexapdf/test_document.rb +28 -0
- data/test/hexapdf/test_object.rb +7 -2
- data/test/hexapdf/test_parser.rb +12 -0
- data/test/hexapdf/test_rectangle.rb +0 -7
- data/test/hexapdf/test_revision.rb +44 -14
- data/test/hexapdf/test_writer.rb +4 -3
- data/test/hexapdf/type/acro_form/test_field.rb +11 -1
- data/test/hexapdf/type/acro_form/test_form.rb +5 -0
- data/test/hexapdf/type/signature/common.rb +71 -0
- data/test/hexapdf/type/signature/test_adbe_pkcs7_detached.rb +99 -0
- data/test/hexapdf/type/signature/test_adbe_x509_rsa_sha1.rb +66 -0
- data/test/hexapdf/type/signature/test_handler.rb +102 -0
- data/test/hexapdf/type/signature/test_verification_result.rb +47 -0
- data/test/hexapdf/type/test_annotation.rb +40 -2
- data/test/hexapdf/type/test_font_simple.rb +5 -5
- data/test/hexapdf/type/test_object_stream.rb +9 -0
- data/test/hexapdf/type/test_signature.rb +131 -0
- metadata +21 -3
@@ -12,6 +12,8 @@
|
|
12
12
|
# implied. See the License for the specific language governing
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
# -----------------------------------------------------------
|
15
|
+
# Modified for use with HexaPDF
|
16
|
+
# -----------------------------------------------------------
|
15
17
|
# Name: ITC Zapf Dingbats Glyph List
|
16
18
|
# Table version: 2.0
|
17
19
|
# Date: September 20, 2002
|
@@ -21,205 +23,204 @@
|
|
21
23
|
# (1) glyph name--upper/lowercase letters and digits
|
22
24
|
# (2) Unicode scalar value--four uppercase hexadecimal digits
|
23
25
|
#
|
24
|
-
a100
|
25
|
-
a101
|
26
|
-
a102
|
27
|
-
a103
|
28
|
-
a104
|
29
|
-
a105
|
30
|
-
a106
|
31
|
-
a107
|
32
|
-
a108
|
33
|
-
a109
|
34
|
-
a10
|
35
|
-
a110
|
36
|
-
a111
|
37
|
-
a112
|
38
|
-
a117
|
39
|
-
a118
|
40
|
-
a119
|
41
|
-
a11
|
42
|
-
a120
|
43
|
-
a121
|
44
|
-
a122
|
45
|
-
a123
|
46
|
-
a124
|
47
|
-
a125
|
48
|
-
a126
|
49
|
-
a127
|
50
|
-
a128
|
51
|
-
a129
|
52
|
-
a12
|
53
|
-
a130
|
54
|
-
a131
|
55
|
-
a132
|
56
|
-
a133
|
57
|
-
a134
|
58
|
-
a135
|
59
|
-
a136
|
60
|
-
a137
|
61
|
-
a138
|
62
|
-
a139
|
63
|
-
a13
|
64
|
-
a140
|
65
|
-
a141
|
66
|
-
a142
|
67
|
-
a143
|
68
|
-
a144
|
69
|
-
a145
|
70
|
-
a146
|
71
|
-
a147
|
72
|
-
a148
|
73
|
-
a149
|
74
|
-
a14
|
75
|
-
a150
|
76
|
-
a151
|
77
|
-
a152
|
78
|
-
a153
|
79
|
-
a154
|
80
|
-
a155
|
81
|
-
a156
|
82
|
-
a157
|
83
|
-
a158
|
84
|
-
a159
|
85
|
-
a15
|
86
|
-
a160
|
87
|
-
a161
|
88
|
-
a162
|
89
|
-
a163
|
90
|
-
a164
|
91
|
-
a165
|
92
|
-
a166
|
93
|
-
a167
|
94
|
-
a168
|
95
|
-
a169
|
96
|
-
a16
|
97
|
-
a170
|
98
|
-
a171
|
99
|
-
a172
|
100
|
-
a173
|
101
|
-
a174
|
102
|
-
a175
|
103
|
-
a176
|
104
|
-
a177
|
105
|
-
a178
|
106
|
-
a179
|
107
|
-
a17
|
108
|
-
a180
|
109
|
-
a181
|
110
|
-
a182
|
111
|
-
a183
|
112
|
-
a184
|
113
|
-
a185
|
114
|
-
a186
|
115
|
-
a187
|
116
|
-
a188
|
117
|
-
a189
|
118
|
-
a18
|
119
|
-
a190
|
120
|
-
a191
|
121
|
-
a192
|
122
|
-
a193
|
123
|
-
a194
|
124
|
-
a195
|
125
|
-
a196
|
126
|
-
a197
|
127
|
-
a198
|
128
|
-
a199
|
129
|
-
a19
|
130
|
-
a1
|
131
|
-
a200
|
132
|
-
a201
|
133
|
-
a202
|
134
|
-
a203
|
135
|
-
a204
|
136
|
-
a205
|
137
|
-
a206
|
138
|
-
a20
|
139
|
-
a21
|
140
|
-
a22
|
141
|
-
a23
|
142
|
-
a24
|
143
|
-
a25
|
144
|
-
a26
|
145
|
-
a27
|
146
|
-
a28
|
147
|
-
a29
|
148
|
-
a2
|
149
|
-
a30
|
150
|
-
a31
|
151
|
-
a32
|
152
|
-
a33
|
153
|
-
a34
|
154
|
-
a35
|
155
|
-
a36
|
156
|
-
a37
|
157
|
-
a38
|
158
|
-
a39
|
159
|
-
a3
|
160
|
-
a40
|
161
|
-
a41
|
162
|
-
a42
|
163
|
-
a43
|
164
|
-
a44
|
165
|
-
a45
|
166
|
-
a46
|
167
|
-
a47
|
168
|
-
a48
|
169
|
-
a49
|
170
|
-
a4
|
171
|
-
a50
|
172
|
-
a51
|
173
|
-
a52
|
174
|
-
a53
|
175
|
-
a54
|
176
|
-
a55
|
177
|
-
a56
|
178
|
-
a57
|
179
|
-
a58
|
180
|
-
a59
|
181
|
-
a5
|
182
|
-
a60
|
183
|
-
a61
|
184
|
-
a62
|
185
|
-
a63
|
186
|
-
a64
|
187
|
-
a65
|
188
|
-
a66
|
189
|
-
a67
|
190
|
-
a68
|
191
|
-
a69
|
192
|
-
a6
|
193
|
-
a70
|
194
|
-
a71
|
195
|
-
a72
|
196
|
-
a73
|
197
|
-
a74
|
198
|
-
a75
|
199
|
-
a76
|
200
|
-
a77
|
201
|
-
a78
|
202
|
-
a79
|
203
|
-
a7
|
204
|
-
a81
|
205
|
-
a82
|
206
|
-
a83
|
207
|
-
a84
|
208
|
-
a85
|
209
|
-
a86
|
210
|
-
a87
|
211
|
-
a88
|
212
|
-
a89
|
213
|
-
a8
|
214
|
-
a90
|
215
|
-
a91
|
216
|
-
a92
|
217
|
-
a93
|
218
|
-
a94
|
219
|
-
a95
|
220
|
-
a96
|
221
|
-
a97
|
222
|
-
a98
|
223
|
-
a99
|
224
|
-
a9
|
225
|
-
#END
|
26
|
+
a100;❞
|
27
|
+
a101;❡
|
28
|
+
a102;❢
|
29
|
+
a103;❣
|
30
|
+
a104;❤
|
31
|
+
a105;✐
|
32
|
+
a106;❥
|
33
|
+
a107;❦
|
34
|
+
a108;❧
|
35
|
+
a109;♠
|
36
|
+
a10;✡
|
37
|
+
a110;♥
|
38
|
+
a111;♦
|
39
|
+
a112;♣
|
40
|
+
a117;✉
|
41
|
+
a118;✈
|
42
|
+
a119;✇
|
43
|
+
a11;☛
|
44
|
+
a120;①
|
45
|
+
a121;②
|
46
|
+
a122;③
|
47
|
+
a123;④
|
48
|
+
a124;⑤
|
49
|
+
a125;⑥
|
50
|
+
a126;⑦
|
51
|
+
a127;⑧
|
52
|
+
a128;⑨
|
53
|
+
a129;⑩
|
54
|
+
a12;☞
|
55
|
+
a130;❶
|
56
|
+
a131;❷
|
57
|
+
a132;❸
|
58
|
+
a133;❹
|
59
|
+
a134;❺
|
60
|
+
a135;❻
|
61
|
+
a136;❼
|
62
|
+
a137;❽
|
63
|
+
a138;❾
|
64
|
+
a139;❿
|
65
|
+
a13;✌
|
66
|
+
a140;➀
|
67
|
+
a141;➁
|
68
|
+
a142;➂
|
69
|
+
a143;➃
|
70
|
+
a144;➄
|
71
|
+
a145;➅
|
72
|
+
a146;➆
|
73
|
+
a147;➇
|
74
|
+
a148;➈
|
75
|
+
a149;➉
|
76
|
+
a14;✍
|
77
|
+
a150;➊
|
78
|
+
a151;➋
|
79
|
+
a152;➌
|
80
|
+
a153;➍
|
81
|
+
a154;➎
|
82
|
+
a155;➏
|
83
|
+
a156;➐
|
84
|
+
a157;➑
|
85
|
+
a158;➒
|
86
|
+
a159;➓
|
87
|
+
a15;✎
|
88
|
+
a160;➔
|
89
|
+
a161;→
|
90
|
+
a162;➣
|
91
|
+
a163;↔
|
92
|
+
a164;↕
|
93
|
+
a165;➙
|
94
|
+
a166;➛
|
95
|
+
a167;➜
|
96
|
+
a168;➝
|
97
|
+
a169;➞
|
98
|
+
a16;✏
|
99
|
+
a170;➟
|
100
|
+
a171;➠
|
101
|
+
a172;➡
|
102
|
+
a173;➢
|
103
|
+
a174;➤
|
104
|
+
a175;➥
|
105
|
+
a176;➦
|
106
|
+
a177;➧
|
107
|
+
a178;➨
|
108
|
+
a179;➩
|
109
|
+
a17;✑
|
110
|
+
a180;➫
|
111
|
+
a181;➭
|
112
|
+
a182;➯
|
113
|
+
a183;➲
|
114
|
+
a184;➳
|
115
|
+
a185;➵
|
116
|
+
a186;➸
|
117
|
+
a187;➺
|
118
|
+
a188;➻
|
119
|
+
a189;➼
|
120
|
+
a18;✒
|
121
|
+
a190;➽
|
122
|
+
a191;➾
|
123
|
+
a192;➚
|
124
|
+
a193;➪
|
125
|
+
a194;➶
|
126
|
+
a195;➹
|
127
|
+
a196;➘
|
128
|
+
a197;➴
|
129
|
+
a198;➷
|
130
|
+
a199;➬
|
131
|
+
a19;✓
|
132
|
+
a1;✁
|
133
|
+
a200;➮
|
134
|
+
a201;➱
|
135
|
+
a202;✃
|
136
|
+
a203;❐
|
137
|
+
a204;❒
|
138
|
+
a205;❮
|
139
|
+
a206;❰
|
140
|
+
a20;✔
|
141
|
+
a21;✕
|
142
|
+
a22;✖
|
143
|
+
a23;✗
|
144
|
+
a24;✘
|
145
|
+
a25;✙
|
146
|
+
a26;✚
|
147
|
+
a27;✛
|
148
|
+
a28;✜
|
149
|
+
a29;✢
|
150
|
+
a2;✂
|
151
|
+
a30;✣
|
152
|
+
a31;✤
|
153
|
+
a32;✥
|
154
|
+
a33;✦
|
155
|
+
a34;✧
|
156
|
+
a35;★
|
157
|
+
a36;✩
|
158
|
+
a37;✪
|
159
|
+
a38;✫
|
160
|
+
a39;✬
|
161
|
+
a3;✄
|
162
|
+
a40;✭
|
163
|
+
a41;✮
|
164
|
+
a42;✯
|
165
|
+
a43;✰
|
166
|
+
a44;✱
|
167
|
+
a45;✲
|
168
|
+
a46;✳
|
169
|
+
a47;✴
|
170
|
+
a48;✵
|
171
|
+
a49;✶
|
172
|
+
a4;☎
|
173
|
+
a50;✷
|
174
|
+
a51;✸
|
175
|
+
a52;✹
|
176
|
+
a53;✺
|
177
|
+
a54;✻
|
178
|
+
a55;✼
|
179
|
+
a56;✽
|
180
|
+
a57;✾
|
181
|
+
a58;✿
|
182
|
+
a59;❀
|
183
|
+
a5;✆
|
184
|
+
a60;❁
|
185
|
+
a61;❂
|
186
|
+
a62;❃
|
187
|
+
a63;❄
|
188
|
+
a64;❅
|
189
|
+
a65;❆
|
190
|
+
a66;❇
|
191
|
+
a67;❈
|
192
|
+
a68;❉
|
193
|
+
a69;❊
|
194
|
+
a6;✝
|
195
|
+
a70;❋
|
196
|
+
a71;●
|
197
|
+
a72;❍
|
198
|
+
a73;■
|
199
|
+
a74;❏
|
200
|
+
a75;❑
|
201
|
+
a76;▲
|
202
|
+
a77;▼
|
203
|
+
a78;◆
|
204
|
+
a79;❖
|
205
|
+
a7;✞
|
206
|
+
a81;◗
|
207
|
+
a82;❘
|
208
|
+
a83;❙
|
209
|
+
a84;❚
|
210
|
+
a85;❯
|
211
|
+
a86;❱
|
212
|
+
a87;❲
|
213
|
+
a88;❳
|
214
|
+
a89;❨
|
215
|
+
a8;✟
|
216
|
+
a90;❩
|
217
|
+
a91;❬
|
218
|
+
a92;❭
|
219
|
+
a93;❪
|
220
|
+
a94;❫
|
221
|
+
a95;❴
|
222
|
+
a96;❵
|
223
|
+
a97;❛
|
224
|
+
a98;❜
|
225
|
+
a99;❝
|
226
|
+
a9;✠
|
data/lib/hexapdf/cli/info.rb
CHANGED
@@ -130,6 +130,26 @@ module HexaPDF
|
|
130
130
|
output_line("Encrypted", "yes (no or wrong password given)")
|
131
131
|
end
|
132
132
|
|
133
|
+
signatures = doc.signatures.to_a
|
134
|
+
unless signatures.empty?
|
135
|
+
nr_sigs = signatures.count
|
136
|
+
output_line("Document signed", "yes - #{nr_sigs} signature#{nr_sigs > 1 ? 's' : ''}")
|
137
|
+
signatures.each do |signature|
|
138
|
+
output_line(" Signer", signature.signer_name)
|
139
|
+
output_line(" Signing time", signature.signing_time)
|
140
|
+
if (reason = signature.signing_reason)
|
141
|
+
output_line(" Reason", reason)
|
142
|
+
end
|
143
|
+
if (location = signature.signing_location)
|
144
|
+
output_line(" Location", location)
|
145
|
+
end
|
146
|
+
output_line(" Signature type", signature.signature_type)
|
147
|
+
signature.verify(allow_self_signed: true).messages.sort.each do |msg|
|
148
|
+
output_line(" #{msg.type.capitalize}", msg.content)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
133
153
|
output_line("Pages", doc.pages.count.to_s)
|
134
154
|
output_line("Version", doc.version)
|
135
155
|
end
|
@@ -162,7 +182,7 @@ module HexaPDF
|
|
162
182
|
end
|
163
183
|
|
164
184
|
def output_line(header, text) #:nodoc:
|
165
|
-
puts(("#{header}:").ljust(COLUMN_WIDTH) << text)
|
185
|
+
puts(("#{header}:").ljust(COLUMN_WIDTH) << text.to_s)
|
166
186
|
end
|
167
187
|
|
168
188
|
end
|
@@ -373,6 +373,20 @@ module HexaPDF
|
|
373
373
|
#
|
374
374
|
# See HexaPDF::Layout::Style::Layers for more information.
|
375
375
|
#
|
376
|
+
# signature.signing_handler::
|
377
|
+
# A mapping from a Symbol to a signing handler class (see
|
378
|
+
# HexaPDF::Document::Signatures::DefaultHandler). If the value is a String, it should contain
|
379
|
+
# the name of a constant to such a class.
|
380
|
+
#
|
381
|
+
# signature.sub_filter_map::
|
382
|
+
# A mapping from a PDF name (a Symbol) to a signature handler class (see
|
383
|
+
# HexaPDF::Type::Signature::Handler). If the value is a String, it should contain the name of a
|
384
|
+
# constant to such a class.
|
385
|
+
#
|
386
|
+
# The sub filter map is used for mapping specific signature algorithms to handler classes. The
|
387
|
+
# filter value of a signature dictionary is ignored since we only support the standard
|
388
|
+
# signature algorithms.
|
389
|
+
#
|
376
390
|
# task.map::
|
377
391
|
# A mapping from task names to callable task objects. See HexaPDF::Task for more information.
|
378
392
|
DefaultDocumentConfiguration =
|
@@ -451,6 +465,14 @@ module HexaPDF
|
|
451
465
|
'style.layers_map' => {
|
452
466
|
link: 'HexaPDF::Layout::Style::LinkLayer',
|
453
467
|
},
|
468
|
+
'signature.signing_handler' => {
|
469
|
+
default: 'HexaPDF::Document::Signatures::DefaultHandler',
|
470
|
+
},
|
471
|
+
'signature.sub_filter_map' => {
|
472
|
+
'adbe.x509.rsa_sha1': 'HexaPDF::Type::Signature::AdbeX509RsaSha1',
|
473
|
+
'adbe.pkcs7.detached': 'HexaPDF::Type::Signature::AdbePkcs7Detached',
|
474
|
+
'ETSI.CAdES.detached': 'HexaPDF::Type::Signature::AdbePkcs7Detached',
|
475
|
+
},
|
454
476
|
'task.map' => {
|
455
477
|
optimize: 'HexaPDF::Task::Optimize',
|
456
478
|
dereference: 'HexaPDF::Task::Dereference',
|
@@ -539,6 +561,10 @@ module HexaPDF
|
|
539
561
|
SigFieldLock: 'HexaPDF::Type::AcroForm::SignatureField::LockDictionary',
|
540
562
|
SV: 'HexaPDF::Type::AcroForm::SignatureField::SeedValueDictionary',
|
541
563
|
SVCert: 'HexaPDF::Type::AcroForm::SignatureField::CertificateSeedValueDictionary',
|
564
|
+
Sig: 'HexaPDF::Type::Signature',
|
565
|
+
DocTimeStamp: 'HexaPDF::Type::Signature',
|
566
|
+
SigRef: 'HexaPDF::Type::Signature::SignatureReference',
|
567
|
+
TransformParams: 'HexaPDF::Type::Signature::TransformParams',
|
542
568
|
},
|
543
569
|
'object.subtype_map' => {
|
544
570
|
nil => {
|
@@ -455,7 +455,7 @@ module HexaPDF
|
|
455
455
|
# Decodes the given array containing text and positioning information while assuming that the
|
456
456
|
# writing direction is vertical.
|
457
457
|
def decode_vertical_text(_data)
|
458
|
-
raise
|
458
|
+
raise "Not yet implemented"
|
459
459
|
end
|
460
460
|
|
461
461
|
end
|