Example use of encrypted files, protected with password or certificate.
#include "tools.h"
void print_decrypt_help() {
printf("Usage: decrypt -s [source file] -p [password] -k [path to PKCS#12]");
}
int process_decrypt(int argc, char *argv[]) {
for (i = 0; i < argc; ++i) {
if (strcmp(argv[i], "-p") == 0 && (i + 1 < argc)) {
password = argv[i + 1];
i++;
} else if (strcmp(argv[i], "-k") == 0 && (i + 1 < argc)) {
cert_path = argv[i + 1];
i++;
} else if (strcmp(argv[i], "-s") == 0 && (i + 1 < argc)) {
file_path = argv[i + 1];
i++;
} else {
print_decrypt_help();
return VANILLAPDF_TOOLS_ERROR_INVALID_PARAMETERS;
}
}
if (file_path == NULL) {
print_decrypt_help();
return VANILLAPDF_TOOLS_ERROR_INVALID_PARAMETERS;
}
RETURN_ERROR_IF_NOT_SUCCESS(
File_Open(file_path, &file));
if (password != NULL) {
}
if (cert_path != NULL) {
}
return VANILLAPDF_TOOLS_ERROR_SUCCESS;
}