Class PubSecHandlerUsingAesGcm
- java.lang.Object
-
- com.itextpdf.kernel.crypto.securityhandler.SecurityHandler
-
- com.itextpdf.kernel.crypto.securityhandler.PubKeySecurityHandler
-
- com.itextpdf.kernel.crypto.securityhandler.PubSecHandlerUsingAes128
-
- com.itextpdf.kernel.crypto.securityhandler.PubSecHandlerUsingAes256
-
- com.itextpdf.kernel.crypto.securityhandler.PubSecHandlerUsingAesGcm
-
public class PubSecHandlerUsingAesGcm extends PubSecHandlerUsingAes256
Public-key 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.SecurityHandler
extra, md5, mkey, nextObjectKey, nextObjectKeySize
-
-
Constructor Summary
Constructors Constructor Description PubSecHandlerUsingAesGcm(PdfDictionary encryptionDictionary, java.security.cert.Certificate[] certs, int[] permissions, boolean encryptMetadata, boolean embeddedFilesOnly)
Creates newPubSecHandlerUsingAesGcm
instance for encryption.PubSecHandlerUsingAesGcm(PdfDictionary encryptionDictionary, java.security.Key certificateKey, java.security.cert.Certificate certificate, java.lang.String certificateKeyProvider, IExternalDecryptionProcess externalDecryptionProcess, boolean encryptMetadata)
Creates newPubSecHandlerUsingAesGcm
instance for decryption.
-
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.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.protected void
setPubSecSpecificHandlerDicEntries(PdfDictionary encryptionDictionary, boolean encryptMetadata, boolean embeddedFilesOnly)
-
Methods inherited from class com.itextpdf.kernel.crypto.securityhandler.PubSecHandlerUsingAes256
getDigestAlgorithm, initKey, setEncryptionDictEntries
-
Methods inherited from class com.itextpdf.kernel.crypto.securityhandler.PubKeySecurityHandler
addAllRecipients, computeGlobalKey, computeGlobalKeyOnReading, createRecipientsArray, initKeyAndFillDictionary, initKeyAndReadDictionary
-
Methods inherited from class com.itextpdf.kernel.crypto.securityhandler.SecurityHandler
getMkey, getNextObjectKey
-
-
-
-
Constructor Detail
-
PubSecHandlerUsingAesGcm
public PubSecHandlerUsingAesGcm(PdfDictionary encryptionDictionary, java.security.cert.Certificate[] certs, int[] permissions, boolean encryptMetadata, boolean embeddedFilesOnly)
Creates newPubSecHandlerUsingAesGcm
instance for encryption.- Parameters:
encryptionDictionary
- document's encryption dictionarycerts
- recipients' X.509 public key certificatespermissions
- access permissions provided to each recipientencryptMetadata
- indicates whether the document-level metadata stream shall be encryptedembeddedFilesOnly
- indicates whether embedded files shall be encrypted in an otherwise unencrypted document
-
PubSecHandlerUsingAesGcm
public PubSecHandlerUsingAesGcm(PdfDictionary encryptionDictionary, java.security.Key certificateKey, java.security.cert.Certificate certificate, java.lang.String certificateKeyProvider, IExternalDecryptionProcess externalDecryptionProcess, boolean encryptMetadata)
Creates newPubSecHandlerUsingAesGcm
instance for decryption.- Parameters:
encryptionDictionary
- document's encryption dictionarycertificateKey
- the recipient privateKey
to the certificatecertificate
- the recipientCertificate
, serves as recipient identifiercertificateKeyProvider
- the certificate key provider id forSecurity.getProvider(String)
externalDecryptionProcess
- the external decryption process to be usedencryptMetadata
- indicates whether the document-level metadata stream shall be encrypted
-
-
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 classPubSecHandlerUsingAes256
- 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 classPubSecHandlerUsingAes128
- 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 classPubSecHandlerUsingAes128
- Returns:
IDecryptor
-
setPubSecSpecificHandlerDicEntries
protected void setPubSecSpecificHandlerDicEntries(PdfDictionary encryptionDictionary, boolean encryptMetadata, boolean embeddedFilesOnly)
- Overrides:
setPubSecSpecificHandlerDicEntries
in classPubSecHandlerUsingAes256
-
initMd5MessageDigest
protected void initMd5MessageDigest()
Init md5 message digest.- Overrides:
initMd5MessageDigest
in classPubSecHandlerUsingAes256
-
-