Class StandardHandlerUsingStandard40
- java.lang.Object
-
- com.itextpdf.kernel.crypto.securityhandler.SecurityHandler
-
- com.itextpdf.kernel.crypto.securityhandler.StandardSecurityHandler
-
- com.itextpdf.kernel.crypto.securityhandler.StandardHandlerUsingStandard40
-
- Direct Known Subclasses:
StandardHandlerUsingStandard128
public class StandardHandlerUsingStandard40 extends StandardSecurityHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected ARCFOUREncryptionarcfourprivate static intDEFAULT_KEY_LENGTHprotected byte[]documentIdprotected intkeyLengthprotected static byte[]metadataPadprotected static byte[]pad-
Fields inherited from class com.itextpdf.kernel.crypto.securityhandler.StandardSecurityHandler
permissions, PERMS_MASK_1_FOR_REVISION_2, PERMS_MASK_1_FOR_REVISION_3_OR_GREATER, PERMS_MASK_2, usedOwnerPassword
-
Fields inherited from class com.itextpdf.kernel.crypto.securityhandler.SecurityHandler
extra, md5, mkey, nextObjectKey, nextObjectKeySize
-
-
Constructor Summary
Constructors Constructor Description StandardHandlerUsingStandard40(PdfDictionary encryptionDictionary, byte[] password, byte[] documentId, boolean encryptMetadata)StandardHandlerUsingStandard40(PdfDictionary encryptionDictionary, byte[] userPassword, byte[] ownerPassword, int permissions, boolean encryptMetadata, boolean embeddedFilesOnly, byte[] documentId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcalculatePermissions(int permissions)private voidcheckPassword(boolean encryptMetadata, byte[] uValue, byte[] oValue, byte[] paddedPassword)protected voidcomputeGlobalEncryptionKey(byte[] userPad, byte[] ownerKey, boolean encryptMetadata)protected byte[]computeOwnerKey(byte[] userPad, byte[] ownerPad)protected byte[]computeUserKey()byte[]computeUserPassword(byte[] ownerPassword, PdfDictionary encryptionDictionary)IDecryptorgetDecryptor()Gets decryptor object.OutputStreamEncryptiongetEncryptionStream(java.io.OutputStream os)Gets a stream wrapper, responsible for encryption.private intgetKeyLength(PdfDictionary encryptionDict)private voidinitKeyAndFillDictionary(PdfDictionary encryptionDictionary, byte[] userPassword, byte[] ownerPassword, int permissions, boolean encryptMetadata, boolean embeddedFilesOnly, byte[] documentId)private voidinitKeyAndReadDictionary(PdfDictionary encryptionDictionary, byte[] password, byte[] documentId, boolean encryptMetadata)protected booleanisValidPassword(byte[] uValue, byte[] userKey)private byte[]padPassword(byte[] password)protected voidsetSpecificHandlerDicEntries(PdfDictionary encryptionDictionary, boolean encryptMetadata, boolean embeddedFilesOnly)-
Methods inherited from class com.itextpdf.kernel.crypto.securityhandler.StandardSecurityHandler
equalsArray, generateOwnerPasswordIfNullOrEmpty, getIsoBytes, getPermissions, isUsedOwnerPassword, setPermissions, setStandardHandlerDicEntries
-
Methods inherited from class com.itextpdf.kernel.crypto.securityhandler.SecurityHandler
getMkey, getNextObjectKey, initMd5MessageDigest, setHashKeyForNextObject
-
-
-
-
Field Detail
-
pad
protected static final byte[] pad
-
metadataPad
protected static final byte[] metadataPad
-
documentId
protected byte[] documentId
-
keyLength
protected int keyLength
-
arcfour
protected ARCFOUREncryption arcfour
-
DEFAULT_KEY_LENGTH
private static final int DEFAULT_KEY_LENGTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StandardHandlerUsingStandard40
public StandardHandlerUsingStandard40(PdfDictionary encryptionDictionary, byte[] userPassword, byte[] ownerPassword, int permissions, boolean encryptMetadata, boolean embeddedFilesOnly, byte[] documentId)
-
StandardHandlerUsingStandard40
public StandardHandlerUsingStandard40(PdfDictionary encryptionDictionary, byte[] password, byte[] documentId, boolean encryptMetadata)
-
-
Method Detail
-
getEncryptionStream
public OutputStreamEncryption getEncryptionStream(java.io.OutputStream os)
Description copied from class:SecurityHandlerGets a stream wrapper, responsible for encryption.- Specified by:
getEncryptionStreamin classSecurityHandler- Parameters:
os-OutputStreamto be wrapped- Returns:
OutputStreamEncryption, responsible for encryption.
-
getDecryptor
public IDecryptor getDecryptor()
Description copied from class:SecurityHandlerGets decryptor object.- Specified by:
getDecryptorin classSecurityHandler- Returns:
IDecryptor
-
computeUserPassword
public byte[] computeUserPassword(byte[] ownerPassword, PdfDictionary encryptionDictionary)
-
calculatePermissions
protected void calculatePermissions(int permissions)
-
computeOwnerKey
protected byte[] computeOwnerKey(byte[] userPad, byte[] ownerPad)
-
computeGlobalEncryptionKey
protected void computeGlobalEncryptionKey(byte[] userPad, byte[] ownerKey, boolean encryptMetadata)
-
computeUserKey
protected byte[] computeUserKey()
-
setSpecificHandlerDicEntries
protected void setSpecificHandlerDicEntries(PdfDictionary encryptionDictionary, boolean encryptMetadata, boolean embeddedFilesOnly)
-
isValidPassword
protected boolean isValidPassword(byte[] uValue, byte[] userKey)
-
initKeyAndFillDictionary
private void initKeyAndFillDictionary(PdfDictionary encryptionDictionary, byte[] userPassword, byte[] ownerPassword, int permissions, boolean encryptMetadata, boolean embeddedFilesOnly, byte[] documentId)
-
initKeyAndReadDictionary
private void initKeyAndReadDictionary(PdfDictionary encryptionDictionary, byte[] password, byte[] documentId, boolean encryptMetadata)
-
checkPassword
private void checkPassword(boolean encryptMetadata, byte[] uValue, byte[] oValue, byte[] paddedPassword)
-
padPassword
private byte[] padPassword(byte[] password)
-
getKeyLength
private int getKeyLength(PdfDictionary encryptionDict)
-
-