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 intinObjectNonceCounterprotected 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 newStandardHandlerUsingAesGcminstance for decryption.StandardHandlerUsingAesGcm(PdfDictionary encryptionDictionary, byte[] userPassword, byte[] ownerPassword, int permissions, boolean encryptMetadata, boolean embeddedFilesOnly)Creates newStandardHandlerUsingAesGcminstance for encryption.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IDecryptorgetDecryptor()Gets decryptor object.OutputStreamEncryptiongetEncryptionStream(java.io.OutputStream os)Gets a stream wrapper, responsible for encryption.protected voidinitMd5MessageDigest()Init md5 message digest.(package private) booleanisPdf2(PdfDictionary encryptionDictionary)(package private) voidsetAES256DicEntries(PdfDictionary encryptionDictionary, byte[] oeKey, byte[] ueKey, byte[] aes256Perms, boolean encryptMetadata, boolean embeddedFilesOnly)voidsetHashKeyForNextObject(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 newStandardHandlerUsingAesGcminstance 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 newStandardHandlerUsingAesGcminstance 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:SecurityHandlerNote: For most of the supported security handlers algorithm to calculate encryption key for particular object is the same.- Overrides:
setHashKeyForNextObjectin 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:SecurityHandlerGets a stream wrapper, responsible for encryption.- Overrides:
getEncryptionStreamin classStandardHandlerUsingAes256- Parameters:
os-OutputStreamto be wrapped- Returns:
OutputStreamEncryption, responsible for encryption.
-
getDecryptor
public IDecryptor getDecryptor()
Description copied from class:SecurityHandlerGets decryptor object.- Overrides:
getDecryptorin classStandardHandlerUsingAes256- Returns:
IDecryptor
-
setAES256DicEntries
void setAES256DicEntries(PdfDictionary encryptionDictionary, byte[] oeKey, byte[] ueKey, byte[] aes256Perms, boolean encryptMetadata, boolean embeddedFilesOnly)
- Overrides:
setAES256DicEntriesin classStandardHandlerUsingAes256
-
isPdf2
boolean isPdf2(PdfDictionary encryptionDictionary)
- Overrides:
isPdf2in classStandardHandlerUsingAes256
-
initMd5MessageDigest
protected void initMd5MessageDigest()
Init md5 message digest.- Overrides:
initMd5MessageDigestin classStandardHandlerUsingAes256
-
-