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
Standard security handler with Advanced Encryption Standard-Galois/Counter Mode (AES-GCM) encryption algorithm.
-
Field Summary
FieldsFields inherited from class StandardHandlerUsingAes256
encryptMetadataFields inherited from class StandardSecurityHandler
permissions, PERMS_MASK_1_FOR_REVISION_2, PERMS_MASK_1_FOR_REVISION_3_OR_GREATER, PERMS_MASK_2, usedOwnerPasswordFields inherited from class SecurityHandler
extra, md5, mkey, nextObjectKey, nextObjectKeySize -
Constructor Summary
ConstructorsConstructorDescriptionStandardHandlerUsingAesGcm(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
Modifier and TypeMethodDescriptionGets decryptor object.Gets a stream wrapper, responsible for encryption.protected voidInit 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 StandardHandlerUsingAes256
isEncryptMetadata, setEncryptionDictionaryEntries, setPermissionsMethods inherited from class StandardSecurityHandler
equalsArray, generateOwnerPasswordIfNullOrEmpty, getIsoBytes, getPermissions, isUsedOwnerPassword, setStandardHandlerDicEntriesMethods inherited from class SecurityHandler
getMkey, getNextObjectKey
-
Field Details
-
noncePart
protected byte[] noncePart -
inObjectNonceCounter
protected int inObjectNonceCounter
-
-
Constructor Details
-
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
Creates newStandardHandlerUsingAesGcminstance for decryption.- Parameters:
encryptionDictionary- document's encryption dictionarypassword- owner or user password to decrypt the document
-
-
Method Details
-
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
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
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
- Overrides:
isPdf2in classStandardHandlerUsingAes256
-
initMd5MessageDigest
protected void initMd5MessageDigest()Init md5 message digest.- Overrides:
initMd5MessageDigestin classStandardHandlerUsingAes256
-