From 8ccd3a8a89d95ae0613679ba7b394a4f87699e12 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 30 Apr 2022 16:05:28 -0400 Subject: Mark weak encryption with API changes (fixes #576) --- libqpdf/QPDFJob.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'libqpdf/QPDFJob.cc') 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, -- cgit v1.2.3-70-g09d2