Class StandardHandlerUsingAesGcm
- java.lang.Object
-
- com.itextpdf.kernel.crypto.securityhandler.SecurityHandler
-
- com.itextpdf.kernel.crypto.securityhandler.StandardSecurityHandler
-
- com.itextpdf.kernel.crypto.securityhandler.StandardHandlerUsingAes256
-
- com.itextpdf.kernel.crypto.securityhandler.StandardHandlerUsingAesGcm
-
public class StandardHandlerUsingAesGcm extends StandardHandlerUsingAes256
Standard security handler with Advanced Encryption Standard-Galois/Counter Mode (AES-GCM) encryption algorithm.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
inObjectNonceCounter
protected byte[]
noncePart
-
Fields inherited from class com.itextpdf.kernel.crypto.securityhandler.StandardHandlerUsingAes256
encryptMetadata
-
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 StandardHandlerUsingAesGcm(PdfDictionary encryptionDictionary, byte[] password)
Creates newStandardHandlerUsingAesGcm
instance for decryption.StandardHandlerUsingAesGcm(PdfDictionary encryptionDictionary, byte[] userPassword, byte[] ownerPassword, int permissions, boolean encryptMetadata, boolean embeddedFilesOnly)
Creates newStandardHandlerUsingAesGcm
instance for encryption.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IDecryptor
getDecryptor()
Gets decryptor object.OutputStreamEncryption
getEncryptionStream(java.io.OutputStream os)
Gets a stream wrapper, responsible for encryption.protected void
initMd5MessageDigest()
Init md5 message digest.(package private) boolean
isPdf2(PdfDictionary encryptionDictionary)
(package 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.-
Methods inherited from class com.itextpdf.kernel.crypto.securityhandler.StandardHandlerUsingAes256
isEncryptMetadata, setEncryptionDictionaryEntries, setPermissions
-
Methods inherited from class com.itextpdf.kernel.crypto.securityhandler.StandardSecurityHandler
equalsArray, generateOwnerPasswordIfNullOrEmpty, getIsoBytes, getPermissions, isUsedOwnerPassword, setStandardHandlerDicEntries
-
Methods inherited from class com.itextpdf.kernel.crypto.securityhandler.SecurityHandler
getMkey, getNextObjectKey
-
-
-
-
Constructor Detail
-
StandardHandlerUsingAesGcm
public StandardHandlerUsingAesGcm(PdfDictionary encryptionDictionary, byte[] userPassword, byte[] ownerPassword, int permissions, boolean encryptMetadata, boolean embeddedFilesOnly)
Creates newStandardHandlerUsingAesGcm
instance for encryption.- Parameters:
encryptionDictionary
- document's encryption dictionaryuserPassword
- user passwordownerPassword
- owner passwordpermissions
- access permissionsencryptMetadata
- indicates whether the document-level metadata stream shall be encryptedembeddedFilesOnly
- indicates whether embedded files shall be encrypted in an otherwise unencrypted document
-
StandardHandlerUsingAesGcm
public StandardHandlerUsingAesGcm(PdfDictionary encryptionDictionary, byte[] password)
Creates newStandardHandlerUsingAesGcm
instance for decryption.- Parameters:
encryptionDictionary
- document's encryption dictionarypassword
- owner or user password to decrypt the document
-
-
Method Detail
-
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 classStandardHandlerUsingAes256
- Parameters:
objNumber
- number of particular object for encryptionobjGeneration
- generation of particular object for encryption
-
getEncryptionStream
public OutputStreamEncryption getEncryptionStream(java.io.OutputStream os)
Description copied from class:SecurityHandler
Gets a stream wrapper, responsible for encryption.- Overrides:
getEncryptionStream
in classStandardHandlerUsingAes256
- Parameters:
os
-OutputStream
to be wrapped- Returns:
OutputStreamEncryption
, responsible for encryption.
-
getDecryptor
public IDecryptor getDecryptor()
Description copied from class:SecurityHandler
Gets decryptor object.- Overrides:
getDecryptor
in classStandardHandlerUsingAes256
- Returns:
IDecryptor
-
setAES256DicEntries
void setAES256DicEntries(PdfDictionary encryptionDictionary, byte[] oeKey, byte[] ueKey, byte[] aes256Perms, boolean encryptMetadata, boolean embeddedFilesOnly)
- Overrides:
setAES256DicEntries
in classStandardHandlerUsingAes256
-
isPdf2
boolean isPdf2(PdfDictionary encryptionDictionary)
- Overrides:
isPdf2
in classStandardHandlerUsingAes256
-
initMd5MessageDigest
protected void initMd5MessageDigest()
Init md5 message digest.- Overrides:
initMd5MessageDigest
in classStandardHandlerUsingAes256
-
-