2021-10-05 03:13:01 +02:00
|
|
|
|
//
|
2021-10-09 16:49:22 +02:00
|
|
|
|
// Cryptographic support functions for PDFio.
|
2021-10-05 03:13:01 +02:00
|
|
|
|
//
|
|
|
|
|
// Copyright © 2021 by Michael R Sweet.
|
|
|
|
|
//
|
|
|
|
|
// Licensed under Apache License v2.0. See the file "LICENSE" for more
|
|
|
|
|
// information.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Include necessary headers...
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include "pdfio-private.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
2021-10-09 16:49:22 +02:00
|
|
|
|
// '_pdfioCryptoMakeReader()' - Setup a cryptographic context and callback for reading.
|
2021-10-05 03:13:01 +02:00
|
|
|
|
//
|
|
|
|
|
|
2021-10-09 16:49:22 +02:00
|
|
|
|
_pdfio_crypto_cb_t // O - Decryption callback or `NULL` for none
|
|
|
|
|
_pdfioCryptoMakeReader(
|
|
|
|
|
pdfio_file_t *pdf, // I - PDF file
|
|
|
|
|
pdfio_obj_t *obj, // I - PDF object
|
|
|
|
|
_pdfio_crypto_ctx_t *ctx, // I - Pointer to crypto context
|
|
|
|
|
uint8_t *iv, // I - Buffer for initialization vector
|
|
|
|
|
size_t *ivlen) // IO - Size of initialization vector
|
2021-10-05 03:13:01 +02:00
|
|
|
|
{
|
2021-10-09 16:49:22 +02:00
|
|
|
|
(void)pdf;
|
|
|
|
|
(void)obj;
|
|
|
|
|
(void)ctx;
|
|
|
|
|
(void)iv;
|
2021-10-05 03:13:01 +02:00
|
|
|
|
|
|
|
|
|
|
2021-10-09 16:49:22 +02:00
|
|
|
|
// No decryption...
|
|
|
|
|
*ivlen = 0;
|
2021-10-05 03:13:01 +02:00
|
|
|
|
|
2021-10-09 16:49:22 +02:00
|
|
|
|
return (NULL);
|
2021-10-05 03:13:01 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
2021-10-09 16:49:22 +02:00
|
|
|
|
// '_pdfioCryptoMakeWriter()' - Setup a cryptographic context and callback for writing.
|
2021-10-05 03:13:01 +02:00
|
|
|
|
//
|
|
|
|
|
|
2021-10-09 16:49:22 +02:00
|
|
|
|
_pdfio_crypto_cb_t // O - Encryption callback or `NULL` for none
|
|
|
|
|
_pdfioCryptoMakeWriter(
|
|
|
|
|
pdfio_file_t *pdf, // I - PDF file
|
|
|
|
|
pdfio_obj_t *obj, // I - PDF object
|
|
|
|
|
_pdfio_crypto_ctx_t *ctx, // I - Pointer to crypto context
|
|
|
|
|
uint8_t *iv, // I - Buffer for initialization vector
|
|
|
|
|
size_t *ivlen) // IO - Size of initialization vector
|
2021-10-05 03:13:01 +02:00
|
|
|
|
{
|
2021-10-09 16:49:22 +02:00
|
|
|
|
(void)pdf;
|
|
|
|
|
(void)obj;
|
|
|
|
|
(void)ctx;
|
|
|
|
|
(void)iv;
|
2021-10-05 03:13:01 +02:00
|
|
|
|
|
|
|
|
|
|
2021-10-09 16:49:22 +02:00
|
|
|
|
// No encryption...
|
|
|
|
|
*ivlen = 0;
|
2021-10-05 03:13:01 +02:00
|
|
|
|
|
2021-10-09 16:49:22 +02:00
|
|
|
|
return (NULL);
|
2021-10-05 03:13:01 +02:00
|
|
|
|
}
|