public class PdfEncryption extends PdfObjectWrapper<PdfDictionary>
| Constructor and Description |
|---|
PdfEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionType, byte[] documentId)
Creates the encryption.
|
PdfEncryption(Certificate[] certs, int[] permissions, int encryptionType)
Creates the certificate encryption.
|
PdfEncryption(PdfDictionary pdfDict, byte[] password, byte[] documentId) |
PdfEncryption(PdfDictionary pdfDict, Key certificateKey, Certificate certificate, String certificateKeyProvider, IExternalDecryptionProcess externalDecryptionProcess) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
computeUserPassword(byte[] ownerPassword)
Computes user password if standard encryption handler is used with Standard40, Standard128 or AES128 algorithm.
|
static PdfObject |
createInfoId(byte[] id, boolean modified) |
byte[] |
decryptByteArray(byte[] b) |
byte[] |
encryptByteArray(byte[] b) |
static byte[] |
generateNewDocumentId() |
int |
getCryptoMode() |
byte[] |
getDocumentId() |
OutputStreamEncryption |
getEncryptionStream(OutputStream os) |
Long |
getPermissions() |
boolean |
isEmbeddedFilesOnly() |
boolean |
isMetadataEncrypted() |
boolean |
isOpenedWithFullPermission() |
protected boolean |
isWrappedObjectMustBeIndirect()
Defines if the object behind this wrapper must be an indirect object in the resultant document.
|
void |
setHashKeyForNextObject(int objNumber, int objGeneration) |
ensureObjectIsAddedToDocument, flush, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidReleasepublic PdfEncryption(byte[] userPassword,
byte[] ownerPassword,
int permissions,
int encryptionType,
byte[] documentId)
userPassword - the user password. Can be null or empty
ownerPassword - the owner password. Can be null or empty
permissions - the user permissions
encryptionType - the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128. Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext
PdfException - if the document is already open
public PdfEncryption(Certificate[] certs, int[] permissions, int encryptionType)
certs - the public certificates to be used for the encryption
permissions - the user permissions for each of the certificates
encryptionType - the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
PdfException - if the document is already open
public PdfEncryption(PdfDictionary pdfDict, byte[] password, byte[] documentId)
public PdfEncryption(PdfDictionary pdfDict, Key certificateKey, Certificate certificate, String certificateKeyProvider, IExternalDecryptionProcess externalDecryptionProcess)
public static byte[] generateNewDocumentId()
public static PdfObject createInfoId(byte[] id, boolean modified)
public Long getPermissions()
public int getCryptoMode()
public boolean isMetadataEncrypted()
public boolean isEmbeddedFilesOnly()
public byte[] getDocumentId()
public void setHashKeyForNextObject(int objNumber,
int objGeneration) public OutputStreamEncryption getEncryptionStream(OutputStream os)
public byte[] encryptByteArray(byte[] b)
public byte[] decryptByteArray(byte[] b)
public boolean isOpenedWithFullPermission()
public byte[] computeUserPassword(byte[] ownerPassword)
ownerPassword - owner password of the encrypted document.
protected boolean isWrappedObjectMustBeIndirect()
PdfObjectWrapper
isWrappedObjectMustBeIndirect in class PdfObjectWrapper<PdfDictionary>
Copyright © 1998–2016 iText Group NV. All rights reserved.