aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_encryption.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-05-04 00:09:49 +0200
committerJay Berkenbilt <ejb@ql.org>2022-05-04 00:31:23 +0200
commit21d6e3231f627470ee58b06df018f31de9eb3201 (patch)
tree2ab80c1061757eae8694ebd36bd6eef0868276d4 /libqpdf/QPDF_encryption.cc
parentf1c6bb97db659faf84e59dbe973b969e9fc1a066 (diff)
downloadqpdf-21d6e3231f627470ee58b06df018f31de9eb3201.tar.zst
Make use of the new Pipeline methods in some places
Diffstat (limited to 'libqpdf/QPDF_encryption.cc')
-rw-r--r--libqpdf/QPDF_encryption.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc
index 5fb1e808..5a7968ca 100644
--- a/libqpdf/QPDF_encryption.cc
+++ b/libqpdf/QPDF_encryption.cc
@@ -235,7 +235,7 @@ process_with_aes(
}
aes.disablePadding();
for (unsigned int i = 0; i < repetitions; ++i) {
- aes.write(QUtil::unsigned_char_pointer(data), data.length());
+ aes.writeString(data);
}
aes.finish();
auto bufp = buffer.getBufferSharedPointer();
@@ -255,9 +255,9 @@ hash_V5(
QPDF::EncryptionData const& data)
{
Pl_SHA2 hash(256);
- hash.write(QUtil::unsigned_char_pointer(password), password.length());
- hash.write(QUtil::unsigned_char_pointer(salt), salt.length());
- hash.write(QUtil::unsigned_char_pointer(udata), udata.length());
+ hash.writeString(password);
+ hash.writeString(salt);
+ hash.writeString(udata);
hash.finish();
std::string K = hash.getRawDigest();
@@ -311,7 +311,7 @@ hash_V5(
E_mod_3 %= 3;
int next_hash = ((E_mod_3 == 0) ? 256 : (E_mod_3 == 1) ? 384 : 512);
Pl_SHA2 sha2(next_hash);
- sha2.write(QUtil::unsigned_char_pointer(E), E.length());
+ sha2.writeString(E);
sha2.finish();
K = sha2.getRawDigest();
@@ -1151,7 +1151,7 @@ QPDF::decryptString(std::string& str, int objid, int generation)
false,
QUtil::unsigned_char_pointer(key),
key.length());
- pl.write(QUtil::unsigned_char_pointer(str), str.length());
+ pl.writeString(str);
pl.finish();
auto buf = bufpl.getBufferSharedPointer();
str = std::string(