Class CosEncryption
java.lang.Object
com.adobe.internal.pdftoolkit.core.cos.CosEncryption
Performs all encryption-related operations on a Cos Document
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
authenticateDecryption
(DecryptedState decryptedState) decryptStream
(ASName cryptFilter, CosStream strObj, InputByteStream content) Get the decrypted contents of a stream.byte[]
decryptString
(CosString strObj, byte[] content) Get the decrypted bytes for a stringencryptStream
(ASName cryptFilter, CosStream strObj, InputByteStream content) Get the encrypted contents of a stream.byte[]
encryptString
(CosString strObj, byte[] content) Get the encrypted bytes for a stringReturn the default decryption handlerReturn the encryption implementationboolean
boolean
boolean
void
void
void
Sets Security Manager for decryption equal to the Security Manager for encryption.void
setDecryptionSecurityManager
(SecurityManager securityMgr) void
setEncryptionSecurityManager
(SecurityManager securityMgr, Map encryptParams) boolean
setEncryptionState
(boolean doIt) boolean
setNeedsDecryption
(boolean decrypt) void
void
Setup encryption
-
Constructor Details
-
CosEncryption
-
-
Method Details
-
setupDecryption
-
needsDecryption
public boolean needsDecryption() -
setNeedsDecryption
public boolean setNeedsDecryption(boolean decrypt) -
needsEncryption
public boolean needsEncryption() -
getEncryption
-
getDecryptionMap
-
getEncryptionMap
-
getDefaultDecryptionHandler
public SecurityHandler getDefaultDecryptionHandler() throws PDFCosParseException, PDFSecurityExceptionReturn the default decryption handler -
getEncryptionImpl
Return the encryption implementation- Throws:
PDFUnsupportedFeatureException
- if there is no encryption implementation This represents a "can't happen" situation
-
getDecryptionSecurityManager
-
authenticateDecryption
- Throws:
PDFSecurityException
-
setDecryptionSecurityManager
public void setDecryptionSecurityManager(SecurityManager securityMgr) throws PDFSecurityException, PDFCosParseException, PDFIOException -
getEncryptionSecurityManager
-
setEncryptionSecurityManager
-
setDecryptionAsEncryption
public void setDecryptionAsEncryption() throws PDFSecurityException, PDFCosParseException, PDFIOExceptionSets Security Manager for decryption equal to the Security Manager for encryption. Resets Security Manager for decryption if the Security Manager for encryption is not set. -
setupEncryption
Setup encryption -
resetEncryptionSecurityManager
public void resetEncryptionSecurityManager() -
resetDecryptionSecurityManager
public void resetDecryptionSecurityManager() -
encryptString
Get the encrypted bytes for a string- Throws:
PDFUnsupportedFeatureException
- if no encryption implementation is in placePDFSecurityException
-
decryptString
Get the decrypted bytes for a string- Throws:
PDFUnsupportedFeatureException
PDFSecurityException
PDFSecurityException
PDFUnsupportedFeatureException
- if no encryption implementation is in place
-
decryptStream
public InputByteStream decryptStream(ASName cryptFilter, CosStream strObj, InputByteStream content) throws PDFIOException, PDFSecurityException, PDFCosParseException Get the decrypted contents of a stream. This stream becomes the property of the caller and must be closed by them.- Throws:
PDFIOException
PDFSecurityException
PDFCosParseException
PDFUnsupportedFeatureException
- if no encryption implementation is in place
-
encryptStream
public InputByteStream encryptStream(ASName cryptFilter, CosStream strObj, InputByteStream content) throws PDFCosParseException, PDFIOException, PDFSecurityException Get the encrypted contents of a stream. This encrypts the entire contents of theInputByteStream
. If the caller desires to enrypt only a portion of anInputByteStream
they should slice the originalInputByteStream
. The returned encrypted stream becomes the property of the caller and must be closed by them.- Throws:
PDFCosParseException
PDFIOException
PDFSecurityException
PDFUnsupportedFeatureException
- if no encryption implementation is in place
-
setEncryptionState
public boolean setEncryptionState(boolean doIt) -
getEncryptionState
public boolean getEncryptionState()
-