aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/qpdf-c.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-11-10 23:57:12 +0100
committerJay Berkenbilt <ejb@ql.org>2021-11-11 18:24:15 +0100
commit750aca5b94351f730fa768b07caa3fc26c8d27c0 (patch)
tree2f95b4770973da7f1fb530cb1b5c8dd7e25401e7 /libqpdf/qpdf-c.cc
parent37916f392568c84570ae0a6afb33a62d8c9e3a10 (diff)
downloadqpdf-750aca5b94351f730fa768b07caa3fc26c8d27c0.tar.zst
First increment of improving handling of weak crypto (fixes #358)
Diffstat (limited to 'libqpdf/qpdf-c.cc')
-rw-r--r--libqpdf/qpdf-c.cc40
1 files changed, 40 insertions, 0 deletions
diff --git a/libqpdf/qpdf-c.cc b/libqpdf/qpdf-c.cc
index 0d37f732..ea3782ce 100644
--- a/libqpdf/qpdf-c.cc
+++ b/libqpdf/qpdf-c.cc
@@ -702,10 +702,20 @@ void qpdf_set_r3_encryption_parameters(
QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract,
qpdf_r3_print_e print, qpdf_r3_modify_e modify)
{
+#ifdef _MSC_VER
+# pragma warning (disable: 4996)
+#endif
+#if (defined(__GNUC__) || defined(__clang__))
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
qpdf->qpdf_writer->setR3EncryptionParameters(
user_password, owner_password,
allow_accessibility != QPDF_FALSE, allow_extract != QPDF_FALSE,
print, modify);
+#if (defined(__GNUC__) || defined(__clang__))
+# pragma GCC diagnostic pop
+#endif
}
void qpdf_set_r4_encryption_parameters(
@@ -714,11 +724,21 @@ void qpdf_set_r4_encryption_parameters(
qpdf_r3_print_e print, qpdf_r3_modify_e modify,
QPDF_BOOL encrypt_metadata, QPDF_BOOL use_aes)
{
+#ifdef _MSC_VER
+# pragma warning (disable: 4996)
+#endif
+#if (defined(__GNUC__) || defined(__clang__))
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
qpdf->qpdf_writer->setR4EncryptionParameters(
user_password, owner_password,
allow_accessibility != QPDF_FALSE, allow_extract != QPDF_FALSE,
print, modify,
encrypt_metadata != QPDF_FALSE, use_aes != QPDF_FALSE);
+#if (defined(__GNUC__) || defined(__clang__))
+# pragma GCC diagnostic pop
+#endif
}
void qpdf_set_r5_encryption_parameters(
@@ -727,11 +747,21 @@ void qpdf_set_r5_encryption_parameters(
qpdf_r3_print_e print, qpdf_r3_modify_e modify,
QPDF_BOOL encrypt_metadata)
{
+#ifdef _MSC_VER
+# pragma warning (disable: 4996)
+#endif
+#if (defined(__GNUC__) || defined(__clang__))
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
qpdf->qpdf_writer->setR5EncryptionParameters(
user_password, owner_password,
allow_accessibility != QPDF_FALSE, allow_extract != QPDF_FALSE,
print, modify,
encrypt_metadata != QPDF_FALSE);
+#if (defined(__GNUC__) || defined(__clang__))
+# pragma GCC diagnostic pop
+#endif
}
void qpdf_set_r6_encryption_parameters(
@@ -740,10 +770,20 @@ void qpdf_set_r6_encryption_parameters(
qpdf_r3_print_e print, qpdf_r3_modify_e modify,
QPDF_BOOL encrypt_metadata)
{
+#ifdef _MSC_VER
+# pragma warning (disable: 4996)
+#endif
+#if (defined(__GNUC__) || defined(__clang__))
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
qpdf->qpdf_writer->setR6EncryptionParameters(
user_password, owner_password,
allow_accessibility != QPDF_FALSE, allow_extract != QPDF_FALSE,
print, modify, encrypt_metadata != QPDF_FALSE);
+#if (defined(__GNUC__) || defined(__clang__))
+# pragma GCC diagnostic pop
+#endif
}
void qpdf_set_linearization(qpdf_data qpdf, QPDF_BOOL value)