Class StandardHandlerUsingAes256
java.lang.Object
com.itextpdf.kernel.crypto.securityhandler.SecurityHandler
com.itextpdf.kernel.crypto.securityhandler.StandardSecurityHandler
com.itextpdf.kernel.crypto.securityhandler.StandardHandlerUsingAes256
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
private boolean
private static final int
private static final int
private static final int
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
ConstructorsConstructorDescriptionStandardHandlerUsingAes256
(PdfDictionary encryptionDictionary, byte[] password) StandardHandlerUsingAes256
(PdfDictionary encryptionDictionary, byte[] userPassword, byte[] ownerPassword, int permissions, boolean encryptMetadata, boolean embeddedFilesOnly, PdfVersion version) -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
compareArray
(byte[] a, byte[] b, int len) private byte[]
computeHash
(byte[] password, byte[] salt, int saltOffset, int saltLen) private byte[]
computeHash
(byte[] password, byte[] salt, int saltOffset, int saltLen, byte[] userKey) private void
initKeyAndFillDictionary
(PdfDictionary encryptionDictionary, byte[] userPassword, byte[] ownerPassword, int permissions, boolean encryptMetadata, boolean embeddedFilesOnly) private void
initKeyAndReadDictionary
(PdfDictionary encryptionDictionary, byte[] password) boolean
private void
setAES256DicEntries
(PdfDictionary encryptionDictionary, byte[] oeKey, byte[] ueKey, byte[] aes256Perms, boolean encryptMetadata, boolean embeddedFilesOnly) void
setHashKeyForNextObject
(int objNumber, int objGeneration) Note: For most of the supported security handlers algorithm to calculate encryption key for particular object is the same.private byte[]
truncateArray
(byte[] array) Methods inherited from class com.itextpdf.kernel.crypto.securityhandler.StandardSecurityHandler
equalsArray, generateOwnerPasswordIfNullOrEmpty, getIsoBytes, getPermissions, isUsedOwnerPassword, setStandardHandlerDicEntries
-
Field Details
-
VALIDATION_SALT_OFFSET
private static final int VALIDATION_SALT_OFFSET- See Also:
-
KEY_SALT_OFFSET
private static final int KEY_SALT_OFFSET- See Also:
-
SALT_LENGTH
private static final int SALT_LENGTH- See Also:
-
isPdf2
private boolean isPdf2 -
encryptMetadata
protected boolean encryptMetadata
-
-
Constructor Details
-
StandardHandlerUsingAes256
public StandardHandlerUsingAes256(PdfDictionary encryptionDictionary, byte[] userPassword, byte[] ownerPassword, int permissions, boolean encryptMetadata, boolean embeddedFilesOnly, PdfVersion version) -
StandardHandlerUsingAes256
-
-
Method Details
-
isEncryptMetadata
public boolean isEncryptMetadata() -
setHashKeyForNextObject
public void setHashKeyForNextObject(int objNumber, int objGeneration) Description copied from class:SecurityHandler
Note: For most of the supported security handlers algorithm to calculate encryption key for particular object is the same.- Overrides:
setHashKeyForNextObject
in classSecurityHandler
- Parameters:
objNumber
- number of particular object for encryptionobjGeneration
- generation of particular object for encryption
-
getEncryptionStream
- Specified by:
getEncryptionStream
in classSecurityHandler
-
getDecryptor
- Specified by:
getDecryptor
in classSecurityHandler
-
initKeyAndFillDictionary
private void initKeyAndFillDictionary(PdfDictionary encryptionDictionary, byte[] userPassword, byte[] ownerPassword, int permissions, boolean encryptMetadata, boolean embeddedFilesOnly) -
setAES256DicEntries
private void setAES256DicEntries(PdfDictionary encryptionDictionary, byte[] oeKey, byte[] ueKey, byte[] aes256Perms, boolean encryptMetadata, boolean embeddedFilesOnly) -
initKeyAndReadDictionary
-
computeHash
private byte[] computeHash(byte[] password, byte[] salt, int saltOffset, int saltLen) throws NoSuchAlgorithmException - Throws:
NoSuchAlgorithmException
-
computeHash
private byte[] computeHash(byte[] password, byte[] salt, int saltOffset, int saltLen, byte[] userKey) throws NoSuchAlgorithmException - Throws:
NoSuchAlgorithmException
-
compareArray
private static boolean compareArray(byte[] a, byte[] b, int len) -
truncateArray
private byte[] truncateArray(byte[] array)
-