tecnickcom / TCPDF

Official clone of PHP library to generate PDF documents and barcodes
https://tcpdf.org
Other
4.18k stars 1.51k forks source link

Fix AES128 encryption if the OpenSSL extension is installed #453

Closed supervirus closed 2 years ago

supervirus commented 2 years ago

This patch fixes generating of AES128 (mode=2) encrypted PDF files, if the OpenSSL extension is available.

If OpenSSL available TCPDF used aes-256-cbc regardless if mode=2 oder mode=3 was selected - which resulted in an unusable PDF file. Now the functions _AES and _AESnopad use aes-128-cbc or aes-256-cbc depending on the key size.

codecov-commenter commented 2 years ago

Codecov Report

Merging #453 (cbb62dd) into main (172540d) will decrease coverage by 7.44%. The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #453      +/-   ##
==========================================
- Coverage   72.93%   65.49%   -7.45%     
==========================================
  Files         127      127              
  Lines       23024    22966      -58     
==========================================
- Hits        16792    15041    -1751     
- Misses       6232     7925    +1693     
Flag Coverage Δ
php-5.3-ubuntu-latest 45.06% <0.00%> (-27.35%) :arrow_down:
php-5.4-ubuntu-latest 45.07% <0.00%> (-27.34%) :arrow_down:
php-5.5-ubuntu-latest 45.07% <0.00%> (-27.34%) :arrow_down:
php-5.6-ubuntu-latest 45.12% <0.00%> (-0.02%) :arrow_down:
php-7.1-ubuntu-latest 45.93% <0.00%> (+0.25%) :arrow_up:
php-7.2-ubuntu-latest 45.89% <0.00%> (+0.26%) :arrow_up:
php-7.3-ubuntu-latest 45.88% <0.00%> (+0.26%) :arrow_up:
php-7.4-ubuntu-latest 45.87% <0.00%> (+0.25%) :arrow_up:
php-8.0-ubuntu-latest 67.24% <0.00%> (+1.89%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
include/tcpdf_static.php 48.02% <0.00%> (-5.52%) :arrow_down:
examples/example_027.php 61.53% <0.00%> (-37.96%) :arrow_down:
tcpdf_barcodes_1d.php 60.29% <0.00%> (-30.15%) :arrow_down:
examples/example_058.php 75.86% <0.00%> (-24.14%) :arrow_down:
examples/example_039.php 80.64% <0.00%> (-19.36%) :arrow_down:
tcpdf_barcodes_2d.php 62.98% <0.00%> (-12.99%) :arrow_down:
tcpdf.php 62.72% <0.00%> (-8.16%) :arrow_down:
include/tcpdf_colors.php 35.00% <0.00%> (-1.67%) :arrow_down:
include/tcpdf_fonts.php 43.75% <0.00%> (-1.03%) :arrow_down:
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 172540d...cbb62dd. Read the comment docs.

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.