QPDFJob: convert encryption handlers

This commit is contained in:
Jay Berkenbilt 2022-01-26 13:17:57 -05:00
parent b5d41b16b8
commit 700dfa40d3
10 changed files with 305 additions and 250 deletions

View File

@ -70,6 +70,7 @@ class Main:
with open('job.yml', 'r') as f:
data = yaml.safe_load(f.read())
self.config_decls = {}
self.declared_configs = set()
for o in data['options']:
table = o['table']
config = o.get('config', None)
@ -311,14 +312,17 @@ class Main:
self.init.append(f'this->ap.addChoices("{i}", '
f'[this](char *x){{{cfg}->{identifier}(x);}}'
f', false, {v}_choices);')
# Generate declarations for config methods separately by
# config object.
config_class = prefix + 'Config'
arg = ''
if decl_arg:
arg = 'char const* parameter'
self.config_decls[cfg].append(
f'QPDF_DLL {config_class}& {identifier}({arg});')
fn = f'{config_class}& {identifier}({arg})'
if fn not in self.declared_configs:
self.declared_configs.add(fn)
self.config_decls[cfg].append(f'QPDF_DLL {fn};')
def handle_flag(self, i, identifier, kind, v):
if kind == 'bare':
@ -393,7 +397,6 @@ class Main:
config = o.get('config', None)
table_prefix = o.get('prefix', '')
arg_prefix = 'arg' + table_prefix
jdata_prefix = table_prefix or table
if table == 'main':
self.init.append('this->ap.selectMainOptionTable();')
elif table == 'help':
@ -428,29 +431,13 @@ class Main:
self.handle_flag(i, identifier, kind, v)
else:
identifier = self.to_identifier(i, '', False)
prefix = o.get('config_class', table_prefix)
self.handle_trivial(
i, identifier, config, table_prefix, kind, v)
i, identifier, config, prefix, kind, v)
if table not in ('main', 'help'):
identifier = self.to_identifier(table, 'argEnd', False)
self.decls.append(f'void {identifier}();')
for o in data['options']:
table = o['table']
jdata_prefix = o.get('prefix', table)
if 'from_table' not in o:
continue
if table == 'main':
self.init.append('this->ap.selectMainOptionTable();')
elif table == 'help':
self.init.append('this->ap.selectHelpOptionTable();')
else:
self.init.append(f'this->ap.selectOptionTable("{table}");')
ft = o['from_table']
other_table = ft['table']
for j in ft['options']:
self.init.append('this->ap.copyFromOtherTable'
f'("{j}", "{other_table}");')
add_jdata(j, jdata_prefix or table)
def generate_schema(self, data):
# XXX check data['json'] against what we know from jdata.
@ -537,9 +524,10 @@ class Main:
['choices', 'options', 'no-json', 'json']))
for o in data['options']:
self.check_keys('top', o, set(
['table', 'prefix', 'config', 'manual', 'bare', 'positional',
['table', 'prefix', 'config', 'config_class',
'manual', 'bare', 'positional',
'optional_parameter', 'required_parameter',
'required_choices', 'optional_choices', 'from_table']))
'required_choices', 'optional_choices']))
def to_identifier(self, label, prefix, const):
identifier = re.sub(r'[^a-zA-Z0-9]', '_', label)

View File

@ -217,6 +217,22 @@ class QPDFJob
Config& config;
};
class EncConfig
{
friend class QPDFJob;
friend class Config;
public:
QPDF_DLL EncConfig& path(char const* parameter);
# include <qpdf/auto_job_c_enc.hh>
private:
EncConfig(Config&);
EncConfig(PagesConfig const&) = delete;
Config& config;
};
// Configuration is performed by calling methods XXX QXXXQ document
class Config
{
@ -228,6 +244,10 @@ class QPDFJob
std::shared_ptr<PagesConfig> pages();
std::shared_ptr<UOConfig> overlay();
std::shared_ptr<UOConfig> underlay();
std::shared_ptr<EncConfig> encrypt(
int keylen,
std::string const& user_password,
std::string const& owner_password);
# include <qpdf/auto_job_c_main.hh>

View File

@ -0,0 +1,19 @@
//
// This file is automatically generated by generate_auto_job.
// Edits will be automatically overwritten if the build is
// run in maintainer mode.
//
QPDF_DLL Config& end();
QPDF_DLL EncConfig& extract(char const* parameter);
QPDF_DLL EncConfig& annotate(char const* parameter);
QPDF_DLL EncConfig& print(char const* parameter);
QPDF_DLL EncConfig& modify(char const* parameter);
QPDF_DLL EncConfig& cleartextMetadata();
QPDF_DLL EncConfig& forceV4();
QPDF_DLL EncConfig& accessibility(char const* parameter);
QPDF_DLL EncConfig& assemble(char const* parameter);
QPDF_DLL EncConfig& form(char const* parameter);
QPDF_DLL EncConfig& modifyOther(char const* parameter);
QPDF_DLL EncConfig& useAes(char const* parameter);
QPDF_DLL EncConfig& forceR5();
QPDF_DLL EncConfig& allowInsecure();

View File

@ -1,14 +1,15 @@
# Generated by generate_auto_job
generate_auto_job 7a539a822d332e33e08495a82a3fb86ceed2da2bb92ca492dd7ed888d226ab6a
generate_auto_job 0eaf9d7724199a2a0a57732ea100f2eb55aaa8a1eccea99196190ff4b79fd6e5
include/qpdf/auto_job_c_att.hh ecc3f8f711b486b491e811176362a90c022eb225ff12157df3a10ca021be87b1
include/qpdf/auto_job_c_copy_att.hh caffae3d1faf2cd92a07ba77da638cce31da3e074a047918834195c0f3ed508a
include/qpdf/auto_job_c_enc.hh e2e1a163a7ffebbf8af169dc4a28ab00df3b8d229864bca7d203dde8b56f0864
include/qpdf/auto_job_c_main.hh 7f7c0a4d8e640a2d24908af348f7b658ca81d3d8aa5346cf4327f6c1d4021119
include/qpdf/auto_job_c_pages.hh 79ee6e52a36fedfd0e6ca60bd926bc25a3e975ab6fa984a7e798a48791e8ba86
include/qpdf/auto_job_c_uo.hh 80404376f19fe57d67421ad0c5fb1755811758c73870df96f081f032b196deff
job.yml 1f508cb7108c55885fbe98537676573bbfddf7b476b2023fd10a975d47afc037
libqpdf/qpdf/auto_job_decl.hh dc9232ed6961d709abacbbf71eb7d19c5e6951894aec6f480afcd3b6ba463206
job.yml c5dbc36d984cdb325b2baf1bd7a788fea58c7054e1da94b107283094da3d102c
libqpdf/qpdf/auto_job_decl.hh 12b96d3201681d9805bc04767ed34f9cd2243e7a5f8930da968518aa22388f36
libqpdf/qpdf/auto_job_help.hh 383eea80e2c185ef5295fc126246457a7ceeffea759fdb90bb2e6727532ea538
libqpdf/qpdf/auto_job_init.hh 25a93a4ded91e1faa2d6a9d2bb85d811b5b49ae54c9fbdccad65b94538365418
libqpdf/qpdf/auto_job_schema.hh 6e6d72e99dacd02c22d9ac70f4dc78a935f879d2a16c89f07f2bdfa936cc2ae3
libqpdf/qpdf/auto_job_init.hh c9f3c31d7c52f1a5159807763becbf15f039f9aa06e41a14f578ee407462ba94
libqpdf/qpdf/auto_job_schema.hh c33c5953b589993334d49f71f0b6ce4b3a12af6e14a7a925be257de04c05f7d6
manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d
manual/cli.rst 68122ff8179c10df3fe6d577adde4973c346f7866ba9a511bab5a6e6f292a6f1

30
job.yml
View File

@ -166,6 +166,8 @@ options:
prefix: Enc
positional: true
- table: 40-bit encryption
config: c_enc
config_class: Enc
prefix: Enc40
required_choices:
extract: yn
@ -173,6 +175,8 @@ options:
print: yn
modify: yn
- table: 128-bit encryption
config: c_enc
config_class: Enc
prefix: Enc128
bare:
- cleartext-metadata
@ -188,22 +192,22 @@ options:
modify: modify128
use-aes: yn
- table: 256-bit encryption
config: c_enc
config_class: Enc
prefix: Enc256
from_table:
table: 128-bit encryption
options:
- cleartext-metadata
- accessibility
- extract
- print
- assemble
- annotate
- form
- modify-other
- modify
bare:
- cleartext-metadata
- force-R5
- allow-insecure
required_choices:
accessibility: yn
extract: yn
print: print128
assemble: yn
annotate: yn
form: yn
modify-other: yn
modify: modify128
- table: underlay/overlay
config: c_uo
prefix: UO
@ -277,9 +281,9 @@ json:
force-version:
progress:
encrypt:
key-length: "key length: 48, 128, 256"
user-password: "user password"
owner-password: "owner password"
key-length: "key length: 48, 128, 256"
_40-bit:
Enc40.annotate:
Enc40.extract:

View File

@ -44,6 +44,7 @@ namespace
std::shared_ptr<QPDFJob::AttConfig> c_att;
std::shared_ptr<QPDFJob::PagesConfig> c_pages;
std::shared_ptr<QPDFJob::UOConfig> c_uo;
std::shared_ptr<QPDFJob::EncConfig> c_enc;
std::vector<char*> accumulated_args; // points to member in ap
char* pages_password;
};
@ -217,35 +218,30 @@ ArgParser::argEncPositional(char* arg)
}
return;
}
o.user_password = this->accumulated_args.at(0);
o.owner_password = this->accumulated_args.at(1);
std::string user_password = this->accumulated_args.at(0);
std::string owner_password = this->accumulated_args.at(1);
std::string len_str = this->accumulated_args.at(2);
int keylen = 0;
if (len_str == "40")
{
o.keylen = 40;
keylen = 40;
this->ap.selectOptionTable(O_40_BIT_ENCRYPTION);
}
else if (len_str == "128")
{
o.keylen = 128;
keylen = 128;
this->ap.selectOptionTable(O_128_BIT_ENCRYPTION);
}
else if (len_str == "256")
{
o.keylen = 256;
o.use_aes = true;
keylen = 256;
this->ap.selectOptionTable(O_256_BIT_ENCRYPTION);
}
else
{
usage("encryption key length must be 40, 128, or 256");
}
}
void
ArgParser::argEnc256AllowInsecure()
{
o.allow_insecure = true;
this->c_enc = c_main->encrypt(keylen, user_password, owner_password);
}
void
@ -394,161 +390,11 @@ ArgParser::argCopyAttachmentsFrom()
this->ap.selectOptionTable(O_COPY_ATTACHMENT);
}
void
ArgParser::argEnc40Print(char* parameter)
{
o.r2_print = (strcmp(parameter, "y") == 0);
}
void
ArgParser::argEnc40Modify(char* parameter)
{
o.r2_modify = (strcmp(parameter, "y") == 0);
}
void
ArgParser::argEnc40Extract(char* parameter)
{
o.r2_extract = (strcmp(parameter, "y") == 0);
}
void
ArgParser::argEnc40Annotate(char* parameter)
{
o.r2_annotate = (strcmp(parameter, "y") == 0);
}
void
ArgParser::argEnc128Accessibility(char* parameter)
{
o.r3_accessibility = (strcmp(parameter, "y") == 0);
}
void
ArgParser::argEnc128Extract(char* parameter)
{
o.r3_extract = (strcmp(parameter, "y") == 0);
}
void
ArgParser::argEnc128Print(char* parameter)
{
if (strcmp(parameter, "full") == 0)
{
o.r3_print = qpdf_r3p_full;
}
else if (strcmp(parameter, "low") == 0)
{
o.r3_print = qpdf_r3p_low;
}
else if (strcmp(parameter, "none") == 0)
{
o.r3_print = qpdf_r3p_none;
}
else
{
usage("invalid print option");
}
}
void
ArgParser::argEnc128Modify(char* parameter)
{
if (strcmp(parameter, "all") == 0)
{
o.r3_assemble = true;
o.r3_annotate_and_form = true;
o.r3_form_filling = true;
o.r3_modify_other = true;
}
else if (strcmp(parameter, "annotate") == 0)
{
o.r3_assemble = true;
o.r3_annotate_and_form = true;
o.r3_form_filling = true;
o.r3_modify_other = false;
}
else if (strcmp(parameter, "form") == 0)
{
o.r3_assemble = true;
o.r3_annotate_and_form = false;
o.r3_form_filling = true;
o.r3_modify_other = false;
}
else if (strcmp(parameter, "assembly") == 0)
{
o.r3_assemble = true;
o.r3_annotate_and_form = false;
o.r3_form_filling = false;
o.r3_modify_other = false;
}
else if (strcmp(parameter, "none") == 0)
{
o.r3_assemble = false;
o.r3_annotate_and_form = false;
o.r3_form_filling = false;
o.r3_modify_other = false;
}
else
{
usage("invalid modify option");
}
}
void
ArgParser::argEnc128CleartextMetadata()
{
o.cleartext_metadata = true;
}
void
ArgParser::argEnc128Assemble(char* parameter)
{
o.r3_assemble = (strcmp(parameter, "y") == 0);
}
void
ArgParser::argEnc128Annotate(char* parameter)
{
o.r3_annotate_and_form = (strcmp(parameter, "y") == 0);
}
void
ArgParser::argEnc128Form(char* parameter)
{
o.r3_form_filling = (strcmp(parameter, "y") == 0);
}
void
ArgParser::argEnc128ModifyOther(char* parameter)
{
o.r3_modify_other = (strcmp(parameter, "y") == 0);
}
void
ArgParser::argEnc128UseAes(char* parameter)
{
o.use_aes = (strcmp(parameter, "y") == 0);
}
void
ArgParser::argEnc128ForceV4()
{
o.force_V4 = true;
}
void
ArgParser::argEnc256ForceR5()
{
o.force_R5 = true;
}
void
ArgParser::argEndEncryption()
{
o.encrypt = true;
o.decrypt = false;
o.copy_encryption = false;
c_enc->end();
c_enc = nullptr;
}
void

View File

@ -963,3 +963,198 @@ QPDFJob::UOConfig::password(char const* parameter)
config.o.under_overlay->password = QUtil::make_shared_cstr(parameter);
return *this;
}
std::shared_ptr<QPDFJob::EncConfig>
QPDFJob::Config::encrypt(int keylen,
std::string const& user_password,
std::string const& owner_password)
{
o.keylen = keylen;
if (keylen == 256)
{
o.use_aes = true;
}
o.user_password = user_password;
o.owner_password = owner_password;
return std::shared_ptr<EncConfig>(new EncConfig(*this));
}
QPDFJob::EncConfig::EncConfig(Config& c) :
config(c)
{
}
QPDFJob::Config&
QPDFJob::EncConfig::end()
{
config.o.encrypt = true;
config.o.decrypt = false;
config.o.copy_encryption = false;
return this->config;
}
QPDFJob::EncConfig&
QPDFJob::EncConfig::allowInsecure()
{
config.o.allow_insecure = true;
return *this;
}
QPDFJob::EncConfig&
QPDFJob::EncConfig::accessibility(char const* parameter)
{
config.o.r3_accessibility = (strcmp(parameter, "y") == 0);
return *this;
}
QPDFJob::EncConfig&
QPDFJob::EncConfig::extract(char const* parameter)
{
if (config.o.keylen == 40)
{
config.o.r2_extract = (strcmp(parameter, "y") == 0);
}
else
{
config.o.r3_extract = (strcmp(parameter, "y") == 0);
}
return *this;
}
QPDFJob::EncConfig&
QPDFJob::EncConfig::print(char const* parameter)
{
if (config.o.keylen == 40)
{
config.o.r2_print = (strcmp(parameter, "y") == 0);
}
else if (strcmp(parameter, "full") == 0)
{
config.o.r3_print = qpdf_r3p_full;
}
else if (strcmp(parameter, "low") == 0)
{
config.o.r3_print = qpdf_r3p_low;
}
else if (strcmp(parameter, "none") == 0)
{
config.o.r3_print = qpdf_r3p_none;
}
else
{
usage("invalid print option");
}
return *this;
}
QPDFJob::EncConfig&
QPDFJob::EncConfig::modify(char const* parameter)
{
if (config.o.keylen == 40)
{
config.o.r2_modify = (strcmp(parameter, "y") == 0);
}
else if (strcmp(parameter, "all") == 0)
{
config.o.r3_assemble = true;
config.o.r3_annotate_and_form = true;
config.o.r3_form_filling = true;
config.o.r3_modify_other = true;
}
else if (strcmp(parameter, "annotate") == 0)
{
config.o.r3_assemble = true;
config.o.r3_annotate_and_form = true;
config.o.r3_form_filling = true;
config.o.r3_modify_other = false;
}
else if (strcmp(parameter, "form") == 0)
{
config.o.r3_assemble = true;
config.o.r3_annotate_and_form = false;
config.o.r3_form_filling = true;
config.o.r3_modify_other = false;
}
else if (strcmp(parameter, "assembly") == 0)
{
config.o.r3_assemble = true;
config.o.r3_annotate_and_form = false;
config.o.r3_form_filling = false;
config.o.r3_modify_other = false;
}
else if (strcmp(parameter, "none") == 0)
{
config.o.r3_assemble = false;
config.o.r3_annotate_and_form = false;
config.o.r3_form_filling = false;
config.o.r3_modify_other = false;
}
else
{
usage("invalid modify option");
}
return *this;
}
QPDFJob::EncConfig&
QPDFJob::EncConfig::cleartextMetadata()
{
config.o.cleartext_metadata = true;
return *this;
}
QPDFJob::EncConfig&
QPDFJob::EncConfig::assemble(char const* parameter)
{
config.o.r3_assemble = (strcmp(parameter, "y") == 0);
return *this;
}
QPDFJob::EncConfig&
QPDFJob::EncConfig::annotate(char const* parameter)
{
if (config.o.keylen == 40)
{
config.o.r2_annotate = (strcmp(parameter, "y") == 0);
}
else
{
config.o.r3_annotate_and_form = (strcmp(parameter, "y") == 0);
}
return *this;
}
QPDFJob::EncConfig&
QPDFJob::EncConfig::form(char const* parameter)
{
config.o.r3_form_filling = (strcmp(parameter, "y") == 0);
return *this;
}
QPDFJob::EncConfig&
QPDFJob::EncConfig::modifyOther(char const* parameter)
{
config.o.r3_modify_other = (strcmp(parameter, "y") == 0);
return *this;
}
QPDFJob::EncConfig&
QPDFJob::EncConfig::useAes(char const* parameter)
{
config.o.use_aes = (strcmp(parameter, "y") == 0);
return *this;
}
QPDFJob::EncConfig&
QPDFJob::EncConfig::forceV4()
{
config.o.force_V4 = true;
return *this;
}
QPDFJob::EncConfig&
QPDFJob::EncConfig::forceR5()
{
config.o.force_R5 = true;
return *this;
}

View File

@ -29,25 +29,8 @@ void argPagesPassword(char *);
void argEndPages();
void argEncPositional(char*);
void argEndEncryption();
void argEnc40Extract(char *);
void argEnc40Annotate(char *);
void argEnc40Print(char *);
void argEnc40Modify(char *);
void argEnd40BitEncryption();
void argEnc128CleartextMetadata();
void argEnc128ForceV4();
void argEnc128Accessibility(char *);
void argEnc128Extract(char *);
void argEnc128Print(char *);
void argEnc128Assemble(char *);
void argEnc128Annotate(char *);
void argEnc128Form(char *);
void argEnc128ModifyOther(char *);
void argEnc128Modify(char *);
void argEnc128UseAes(char *);
void argEnd128BitEncryption();
void argEnc256ForceR5();
void argEnc256AllowInsecure();
void argEnd256BitEncryption();
void argUOPositional(char*);
void argEndUnderlayOverlay();

View File

@ -116,25 +116,34 @@ this->ap.addRequiredParameter("password", p(&ArgParser::argPagesPassword), "pass
this->ap.registerOptionTable("encryption", b(&ArgParser::argEndEncryption));
this->ap.addPositional(p(&ArgParser::argEncPositional));
this->ap.registerOptionTable("40-bit encryption", b(&ArgParser::argEnd40BitEncryption));
this->ap.addChoices("extract", p(&ArgParser::argEnc40Extract), true, yn_choices);
this->ap.addChoices("annotate", p(&ArgParser::argEnc40Annotate), true, yn_choices);
this->ap.addChoices("print", p(&ArgParser::argEnc40Print), true, yn_choices);
this->ap.addChoices("modify", p(&ArgParser::argEnc40Modify), true, yn_choices);
this->ap.addChoices("extract", [this](char *x){c_enc->extract(x);}, true, yn_choices);
this->ap.addChoices("annotate", [this](char *x){c_enc->annotate(x);}, true, yn_choices);
this->ap.addChoices("print", [this](char *x){c_enc->print(x);}, true, yn_choices);
this->ap.addChoices("modify", [this](char *x){c_enc->modify(x);}, true, yn_choices);
this->ap.registerOptionTable("128-bit encryption", b(&ArgParser::argEnd128BitEncryption));
this->ap.addBare("cleartext-metadata", b(&ArgParser::argEnc128CleartextMetadata));
this->ap.addBare("force-V4", b(&ArgParser::argEnc128ForceV4));
this->ap.addChoices("accessibility", p(&ArgParser::argEnc128Accessibility), true, yn_choices);
this->ap.addChoices("extract", p(&ArgParser::argEnc128Extract), true, yn_choices);
this->ap.addChoices("print", p(&ArgParser::argEnc128Print), true, print128_choices);
this->ap.addChoices("assemble", p(&ArgParser::argEnc128Assemble), true, yn_choices);
this->ap.addChoices("annotate", p(&ArgParser::argEnc128Annotate), true, yn_choices);
this->ap.addChoices("form", p(&ArgParser::argEnc128Form), true, yn_choices);
this->ap.addChoices("modify-other", p(&ArgParser::argEnc128ModifyOther), true, yn_choices);
this->ap.addChoices("modify", p(&ArgParser::argEnc128Modify), true, modify128_choices);
this->ap.addChoices("use-aes", p(&ArgParser::argEnc128UseAes), true, yn_choices);
this->ap.addBare("cleartext-metadata", [this](){c_enc->cleartextMetadata();});
this->ap.addBare("force-V4", [this](){c_enc->forceV4();});
this->ap.addChoices("accessibility", [this](char *x){c_enc->accessibility(x);}, true, yn_choices);
this->ap.addChoices("extract", [this](char *x){c_enc->extract(x);}, true, yn_choices);
this->ap.addChoices("print", [this](char *x){c_enc->print(x);}, true, print128_choices);
this->ap.addChoices("assemble", [this](char *x){c_enc->assemble(x);}, true, yn_choices);
this->ap.addChoices("annotate", [this](char *x){c_enc->annotate(x);}, true, yn_choices);
this->ap.addChoices("form", [this](char *x){c_enc->form(x);}, true, yn_choices);
this->ap.addChoices("modify-other", [this](char *x){c_enc->modifyOther(x);}, true, yn_choices);
this->ap.addChoices("modify", [this](char *x){c_enc->modify(x);}, true, modify128_choices);
this->ap.addChoices("use-aes", [this](char *x){c_enc->useAes(x);}, true, yn_choices);
this->ap.registerOptionTable("256-bit encryption", b(&ArgParser::argEnd256BitEncryption));
this->ap.addBare("force-R5", b(&ArgParser::argEnc256ForceR5));
this->ap.addBare("allow-insecure", b(&ArgParser::argEnc256AllowInsecure));
this->ap.addBare("cleartext-metadata", [this](){c_enc->cleartextMetadata();});
this->ap.addBare("force-R5", [this](){c_enc->forceR5();});
this->ap.addBare("allow-insecure", [this](){c_enc->allowInsecure();});
this->ap.addChoices("accessibility", [this](char *x){c_enc->accessibility(x);}, true, yn_choices);
this->ap.addChoices("extract", [this](char *x){c_enc->extract(x);}, true, yn_choices);
this->ap.addChoices("print", [this](char *x){c_enc->print(x);}, true, print128_choices);
this->ap.addChoices("assemble", [this](char *x){c_enc->assemble(x);}, true, yn_choices);
this->ap.addChoices("annotate", [this](char *x){c_enc->annotate(x);}, true, yn_choices);
this->ap.addChoices("form", [this](char *x){c_enc->form(x);}, true, yn_choices);
this->ap.addChoices("modify-other", [this](char *x){c_enc->modifyOther(x);}, true, yn_choices);
this->ap.addChoices("modify", [this](char *x){c_enc->modify(x);}, true, modify128_choices);
this->ap.registerOptionTable("underlay/overlay", b(&ArgParser::argEndUnderlayOverlay));
this->ap.addPositional(p(&ArgParser::argUOPositional));
this->ap.addRequiredParameter("to", [this](char *x){c_uo->to(x);}, "page-range");
@ -154,13 +163,3 @@ this->ap.registerOptionTable("copy attachment", b(&ArgParser::argEndCopyAttachme
this->ap.addPositional(p(&ArgParser::argCopyAttPositional));
this->ap.addRequiredParameter("prefix", [this](char *x){c_copy_att->prefix(x);}, "prefix");
this->ap.addRequiredParameter("password", [this](char *x){c_copy_att->password(x);}, "password");
this->ap.selectOptionTable("256-bit encryption");
this->ap.copyFromOtherTable("cleartext-metadata", "128-bit encryption");
this->ap.copyFromOtherTable("accessibility", "128-bit encryption");
this->ap.copyFromOtherTable("extract", "128-bit encryption");
this->ap.copyFromOtherTable("print", "128-bit encryption");
this->ap.copyFromOtherTable("assemble", "128-bit encryption");
this->ap.copyFromOtherTable("annotate", "128-bit encryption");
this->ap.copyFromOtherTable("form", "128-bit encryption");
this->ap.copyFromOtherTable("modify-other", "128-bit encryption");
this->ap.copyFromOtherTable("modify", "128-bit encryption");

View File

@ -35,9 +35,9 @@ static constexpr char const* JOB_SCHEMA_DATA = R"({
"forceVersion": "set output PDF version",
"progress": "show progress when writing",
"encrypt": {
"keyLength": "key length: 48, 128, 256",
"userPassword": "user password",
"ownerPassword": "owner password",
"keyLength": "key length: 48, 128, 256",
"40Bit": {
"annotate": "restrict document annotation",
"extract": "restrict text/graphic extraction",