diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-04-30 22:05:28 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-04-30 23:24:15 +0200 |
commit | 8ccd3a8a89d95ae0613679ba7b394a4f87699e12 (patch) | |
tree | 902a42a5bc972c66958ab6ce96260daf5957a78e /libqpdf/QPDFJob.cc | |
parent | 2213ed0c3dd1bcc5a62725190cca4a6ad8eb9d7f (diff) | |
download | qpdf-8ccd3a8a89d95ae0613679ba7b394a4f87699e12.tar.zst |
Mark weak encryption with API changes (fixes #576)
Diffstat (limited to 'libqpdf/QPDFJob.cc')
-rw-r--r-- | libqpdf/QPDFJob.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index 2459394f..765e0281 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -2815,19 +2815,22 @@ QPDFJob::setEncryptionOptions(QPDF& pdf, QPDFWriter& w) QTC::TC("qpdf", "QPDFJob weak crypto error"); *(this->m->cerr) << this->m->message_prefix - << ": refusing to write a file with RC4, a weak cryptographic algorithm" + << ": refusing to write a file with RC4, a weak cryptographic " + "algorithm" << std::endl << "Please use 256-bit keys for better security." << std::endl << "Pass --allow-weak-crypto to enable writing insecure files." << std::endl - << "See also https://qpdf.readthedocs.io/en/stable/weak-crypto.html" + << "See also " + "https://qpdf.readthedocs.io/en/stable/weak-crypto.html" << std::endl; - throw std::runtime_error("refusing to write a file with weak crypto"); + throw std::runtime_error( + "refusing to write a file with weak crypto"); } } switch (R) { case 2: - w.setR2EncryptionParameters( + w.setR2EncryptionParametersInsecure( m->user_password.c_str(), m->owner_password.c_str(), m->r2_print, @@ -2836,7 +2839,7 @@ QPDFJob::setEncryptionOptions(QPDF& pdf, QPDFWriter& w) m->r2_annotate); break; case 3: - w.setR3EncryptionParameters( + w.setR3EncryptionParametersInsecure( m->user_password.c_str(), m->owner_password.c_str(), m->r3_accessibility, @@ -2848,7 +2851,7 @@ QPDFJob::setEncryptionOptions(QPDF& pdf, QPDFWriter& w) m->r3_print); break; case 4: - w.setR4EncryptionParameters( + w.setR4EncryptionParametersInsecure( m->user_password.c_str(), m->owner_password.c_str(), m->r3_accessibility, |