aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFJob.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-04-30 21:41:14 +0200
committerJay Berkenbilt <ejb@ql.org>2022-04-30 23:23:58 +0200
commitcff26040d8e4019e2c9db950d7986f6422c6711b (patch)
treee6729cdf3678e5322922a4cc7e3ab29b922d930e /libqpdf/QPDFJob.cc
parentce19471f180d764bbcf5990dea5f60d4cd217dc7 (diff)
downloadqpdf-cff26040d8e4019e2c9db950d7986f6422c6711b.tar.zst
Using insecure crytpo from the CLI is now an error by default
Diffstat (limited to 'libqpdf/QPDFJob.cc')
-rw-r--r--libqpdf/QPDFJob.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc
index 4d136223..2459394f 100644
--- a/libqpdf/QPDFJob.cc
+++ b/libqpdf/QPDFJob.cc
@@ -2812,18 +2812,17 @@ QPDFJob::setEncryptionOptions(QPDF& pdf, QPDFWriter& w)
maybeFixWritePassword(R, m->owner_password);
if ((R < 4) || ((R == 4) && (!m->use_aes))) {
if (!m->allow_weak_crypto) {
- // Do not set warnings = true for this case as this does
- // not reflect a potential problem with the input file.
- QTC::TC("qpdf", "QPDFJob weak crypto warning");
+ QTC::TC("qpdf", "QPDFJob weak crypto error");
*(this->m->cerr)
<< this->m->message_prefix
- << ": writing 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 suppress this warning."
+ << "Pass --allow-weak-crypto to enable writing insecure files."
<< std::endl
- << "This will become an error in a future version of qpdf."
+ << "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");
}
}
switch (R) {