Top Description Fields Constructors Methods
org.apache.pdfbox.tools

public final Class Encrypt

extends Object
implements Callable<Integer>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.Callable
Annotations
@Command
name:encrypt
header:Encrypts a PDF document
description:${COMMAND-NAME} will read an unencrypted document and encrypt it either using a password or a certificate.%n, While encrypting the document permissions can be set which will allow/disallow certain functionality
versionProvider:Version
mixinStandardHelpOptions:true
Imports
java.io.File, .FileInputStream, .IOException, .InputStream, .PrintStream, java.security.cert.CertificateException, .CertificateFactory, .X509Certificate, java.util.ArrayList, .List, java.util.concurrent.Callable, org.apache.pdfbox.Loader, org.apache.pdfbox.pdmodel.PDDocument, org.apache.pdfbox.pdmodel.encryption.AccessPermission, .PublicKeyProtectionPolicy, .PublicKeyRecipient, .StandardProtectionPolicy, picocli.CommandLine, .CommandLine.Command, .CommandLine.Option

This will read a document from the filesystem, encrypt it and and then write the results to the filesystem.
Author
Ben Litchfield

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private boolean
private List<File>
private File
private int
private File
private String
private final PrintStream
private String

Constructor Summary

AccessConstructor and Description
public
Encrypt()

Constructor.

Method Summary

Modifier and TypeMethod and Description
public Integer
call()

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

public static void
main(String[]
The command-line arguments.
args
)

This is the entry point for the application.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

canAssembleDocumentback to summary
private boolean canAssembleDocument
Annotations
@Option
names:-canAssemble
description:set the assemble permission (default: ${DEFAULT-VALUE})
canExtractContentback to summary
private boolean canExtractContent
Annotations
@Option
names:-canExtractContent
description:set the extraction permission (default: ${DEFAULT-VALUE})
canExtractForAccessibilityback to summary
private boolean canExtractForAccessibility
Annotations
@Option
names:-canExtractForAccessibility
description:set the extraction permission (default: ${DEFAULT-VALUE})
canFillInFormback to summary
private boolean canFillInForm
Annotations
@Option
names:-canFillInForm
description:set the form fill in permission (default: ${DEFAULT-VALUE})
canModifyback to summary
private boolean canModify
Annotations
@Option
names:-canModify
description:set the modify permission (default: ${DEFAULT-VALUE})
canModifyAnnotationsback to summary
private boolean canModifyAnnotations
Annotations
@Option
names:-canModifyAnnotations
description:set the modify annots permission (default: ${DEFAULT-VALUE})
canPrintback to summary
private boolean canPrint
Annotations
@Option
names:-canPrint
description:set the print permission (default: ${DEFAULT-VALUE})
canPrintFaithfulback to summary
private boolean canPrintFaithful
Annotations
@Option
names:-canPrintFaithful
description:set the print faithful permission (default: ${DEFAULT-VALUE})
certFileListback to summary
private List<File> certFileList
Annotations
@Option
names:-certFile
paramLabel:certFile
description:Path to X.509 certificate (repeat both if needed)
infileback to summary
private File infile
Annotations
@Option
names:-i, --input
description:the PDF file to encrypt
required:true
keyLengthback to summary
private int keyLength
Annotations
@Option
names:-keyLength
description:Key length in bits (valid values: 40, 128 or 256) (default: ${DEFAULT-VALUE})
outfileback to summary
private File outfile
Annotations
@Option
names:-o, --output
description:the encrypted PDF file. If omitted the original file is overwritten.
ownerPasswordback to summary
private String ownerPassword
Annotations
@Option
names:-O
description:set the owner password (ignored if certFile is set)
arity:0..1
interactive:true
SYSERRback to summary
private final PrintStream SYSERR
Annotations
@SuppressWarnings:squid:S106
userPasswordback to summary
private String userPassword
Annotations
@Option
names:-U
description:set the user password (ignored if certFile is set)
arity:0..1
interactive:true

Constructor Detail

Encryptback to summary
public Encrypt()

Constructor.

Method Detail

callback to summary
public Integer call()

Implements java.util.concurrent.Callable.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Returns:Integer

computed result

mainback to summary
public static void main(String[] args)

This is the entry point for the application.

Parameters
args:String[]

The command-line arguments.