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 TypeMethodDescriptionbooleanauthenticateDecryption(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 implementationbooleanbooleanbooleanvoidvoidvoidSets Security Manager for decryption equal to the Security Manager for encryption.voidsetDecryptionSecurityManager(SecurityManager securityMgr) voidsetEncryptionSecurityManager(SecurityManager securityMgr, Map encryptParams) booleansetEncryptionState(boolean doIt) booleansetNeedsDecryption(boolean decrypt) voidvoidSetup 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:
PDFUnsupportedFeatureExceptionPDFSecurityExceptionPDFSecurityExceptionPDFUnsupportedFeatureException- 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:
PDFIOExceptionPDFSecurityExceptionPDFCosParseExceptionPDFUnsupportedFeatureException- 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 anInputByteStreamthey should slice the originalInputByteStream. The returned encrypted stream becomes the property of the caller and must be closed by them.- Throws:
PDFCosParseExceptionPDFIOExceptionPDFSecurityExceptionPDFUnsupportedFeatureException- if no encryption implementation is in place
-
setEncryptionState
public boolean setEncryptionState(boolean doIt) -
getEncryptionState
public boolean getEncryptionState()
-