Commit ce19471f180d764bbcf5990dea5f60d4cd217dc7
1 parent
c365a26e
Add comments around non-security-related uses of MD5
Showing
2 changed files
with
7 additions
and
3 deletions
include/qpdf/QPDFEFStreamObjectHelper.hh
| @@ -57,9 +57,11 @@ class QPDFEFStreamObjectHelper: public QPDFObjectHelper | @@ -57,9 +57,11 @@ class QPDFEFStreamObjectHelper: public QPDFObjectHelper | ||
| 57 | // Subtype is a mime type such as "text/plain" | 57 | // Subtype is a mime type such as "text/plain" |
| 58 | QPDF_DLL | 58 | QPDF_DLL |
| 59 | std::string getSubtype(); | 59 | std::string getSubtype(); |
| 60 | - // Return the MD5 checksum as stored in the object as a binary | ||
| 61 | - // string. This does not check consistency with the data. If not | ||
| 62 | - // present, return an empty string. | 60 | + // Return the checksum as stored in the object as a binary string. |
| 61 | + // This does not check consistency with the data. If not present, | ||
| 62 | + // return an empty string. The PDF spec specifies this as an MD5 | ||
| 63 | + // checksum and notes that it is not to be used for security | ||
| 64 | + // purposes since MD5 is known not to be secure. | ||
| 63 | QPDF_DLL | 65 | QPDF_DLL |
| 64 | std::string getChecksum(); | 66 | std::string getChecksum(); |
| 65 | 67 |
libqpdf/QPDFEFStreamObjectHelper.cc
| @@ -139,6 +139,8 @@ QPDFEFStreamObjectHelper::newFromStream(QPDFObjectHandle stream) | @@ -139,6 +139,8 @@ QPDFEFStreamObjectHelper::newFromStream(QPDFObjectHandle stream) | ||
| 139 | stream.getDict().replaceKey( | 139 | stream.getDict().replaceKey( |
| 140 | "/Type", QPDFObjectHandle::newName("/EmbeddedFile")); | 140 | "/Type", QPDFObjectHandle::newName("/EmbeddedFile")); |
| 141 | Pl_Discard discard; | 141 | Pl_Discard discard; |
| 142 | + // The PDF spec specifies use of MD5 here and notes that it is not | ||
| 143 | + // to be used for security. MD5 is known to be insecure. | ||
| 142 | Pl_MD5 md5("EF md5", &discard); | 144 | Pl_MD5 md5("EF md5", &discard); |
| 143 | Pl_Count count("EF size", &md5); | 145 | Pl_Count count("EF size", &md5); |
| 144 | if (!stream.pipeStreamData(&count, nullptr, 0, qpdf_dl_all)) { | 146 | if (!stream.pipeStreamData(&count, nullptr, 0, qpdf_dl_all)) { |