Refactor crypto callback to have separate input/output pointers. Add initial writing support.

This commit is contained in:
Michael R Sweet
2021-10-12 09:13:30 -04:00
parent 0caea44f32
commit c24243a2bc
7 changed files with 151 additions and 28 deletions

View File

@ -1159,7 +1159,7 @@ pdfioFileSetPermissions(
encrypt_key[j] = (uint8_t)(digest[j] ^ i);
_pdfioCryptoRC4Init(&rc4, encrypt_key, sizeof(encrypt_key));
_pdfioCryptoRC4Crypt(&rc4, pdf->owner_key, sizeof(pdf->owner_key));
_pdfioCryptoRC4Crypt(&rc4, pdf->owner_key, pdf->owner_key, sizeof(pdf->owner_key));
}
// Generate the encryption key
@ -1204,7 +1204,7 @@ pdfioFileSetPermissions(
digest[j] = (uint8_t)(pdf->encryption_key[j] ^ i);
_pdfioCryptoRC4Init(&rc4, digest, 16);
_pdfioCryptoRC4Crypt(&rc4, pdf->user_key, sizeof(pdf->user_key));
_pdfioCryptoRC4Crypt(&rc4, pdf->user_key, pdf->user_key, sizeof(pdf->user_key));
}
// Save everything in the dictionary...