aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2009-09-27 05:11:29 +0200
committerJay Berkenbilt <ejb@ql.org>2009-09-27 05:11:29 +0200
commit02333ba1e9670ff1f7fe7170d3e0cc229755dc7b (patch)
tree866d753a479c27c2d078d6eb62bb8c0af613aaab /libqpdf
parent1285fa19d64ab5461c29dd9ec8a01b1a52757098 (diff)
downloadqpdf-02333ba1e9670ff1f7fe7170d3e0cc229755dc7b.tar.zst
checkpoint -- first crack at C API, minor refactoring of encryption functions
git-svn-id: svn+q:///qpdf/trunk@720 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFWriter.cc2
-rw-r--r--libqpdf/QPDF_encryption.cc18
-rw-r--r--libqpdf/build.mk3
-rw-r--r--libqpdf/qpdf-c.cc18
4 files changed, 38 insertions, 3 deletions
diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc
index 88dc9e8f..4191e906 100644
--- a/libqpdf/QPDFWriter.cc
+++ b/libqpdf/QPDFWriter.cc
@@ -277,7 +277,7 @@ QPDFWriter::copyEncryptionParameters()
encrypt.getKey("/O").getStringValue(),
encrypt.getKey("/U").getStringValue(),
this->id1, // this->id1 == the other file's id1
- pdf.getUserPassword());
+ pdf.getPaddedUserPassword());
}
}
diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc
index 00766b60..2e0e59e7 100644
--- a/libqpdf/QPDF_encryption.cc
+++ b/libqpdf/QPDF_encryption.cc
@@ -443,7 +443,23 @@ QPDF::compute_encryption_O_U(
DLL_EXPORT
std::string const&
-QPDF::getUserPassword() const
+QPDF::getPaddedUserPassword() const
{
return this->user_password;
}
+
+DLL_EXPORT
+std::string
+QPDF::getTrimmedUserPassword() const
+{
+ std::string result = this->user_password;
+ trim_user_password(result);
+ return result;
+}
+
+DLL_EXPORT
+bool
+QPDF::isEncrypted() const
+{
+ return this->encrypted;
+}
diff --git a/libqpdf/build.mk b/libqpdf/build.mk
index 6d807a6a..da87b7db 100644
--- a/libqpdf/build.mk
+++ b/libqpdf/build.mk
@@ -43,7 +43,8 @@ SRCS_libqpdf = \
libqpdf/QPDF_optimization.cc \
libqpdf/QTC.cc \
libqpdf/QUtil.cc \
- libqpdf/RC4.cc
+ libqpdf/RC4.cc \
+ libqpdf/qpdf-c.cc
# -----
diff --git a/libqpdf/qpdf-c.cc b/libqpdf/qpdf-c.cc
new file mode 100644
index 00000000..3dd7fbe7
--- /dev/null
+++ b/libqpdf/qpdf-c.cc
@@ -0,0 +1,18 @@
+#include <qpdf/qpdf-c.h>
+
+class _qpdf_data
+{
+};
+
+DLL_EXPORT
+qpdf_data qpdf_init()
+{
+ return new _qpdf_data();
+}
+
+DLL_EXPORT
+void qpdf_cleanup(qpdf_data* qpdf)
+{
+ delete *qpdf;
+ *qpdf = 0;
+}