Class CosEncryption
- java.lang.Object
-
- com.adobe.internal.pdftoolkit.core.cos.CosEncryption
-
public class CosEncryption extends java.lang.ObjectPerforms all encryption-related operations on a Cos Document
-
-
Constructor Summary
Constructors Constructor Description CosEncryption(CosDocument doc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanauthenticateDecryption(DecryptedState decryptedState)InputByteStreamdecryptStream(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 stringInputByteStreamencryptStream(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 stringjava.util.MapgetDecryptionMap()SecurityManagergetDecryptionSecurityManager()SecurityHandlergetDefaultDecryptionHandler()Return the default decryption handlerCosDictionarygetEncryption()EnableEncryptiongetEncryptionImpl()Return the encryption implementationjava.util.MapgetEncryptionMap()SecurityManagergetEncryptionSecurityManager()booleangetEncryptionState()booleanneedsDecryption()booleanneedsEncryption()voidresetDecryptionSecurityManager()voidresetEncryptionSecurityManager()voidsetDecryptionAsEncryption()Sets Security Manager for decryption equal to the Security Manager for encryption.voidsetDecryptionSecurityManager(SecurityManager securityMgr)voidsetEncryptionSecurityManager(SecurityManager securityMgr, java.util.Map encryptParams)booleansetEncryptionState(boolean doIt)booleansetNeedsDecryption(boolean decrypt)voidsetupDecryption()voidsetupEncryption()Setup encryption
-
-
-
Constructor Detail
-
CosEncryption
public CosEncryption(CosDocument doc)
-
-
Method Detail
-
setupDecryption
public void setupDecryption() throws PDFCosParseException, PDFIOException, PDFSecurityException
-
needsDecryption
public boolean needsDecryption()
-
setNeedsDecryption
public boolean setNeedsDecryption(boolean decrypt)
-
needsEncryption
public boolean needsEncryption()
-
getEncryption
public CosDictionary getEncryption()
-
getDecryptionMap
public java.util.Map getDecryptionMap() throws PDFCosParseException, PDFIOException, PDFSecurityException
-
getEncryptionMap
public java.util.Map getEncryptionMap() throws PDFSecurityAuthorizationException
-
getDefaultDecryptionHandler
public SecurityHandler getDefaultDecryptionHandler() throws PDFCosParseException, PDFSecurityException
Return the default decryption handler
-
getEncryptionImpl
public EnableEncryption getEncryptionImpl() throws PDFUnsupportedFeatureException
Return the encryption implementation- Throws:
PDFUnsupportedFeatureException- if there is no encryption implementation This represents a "can't happen" situation
-
getDecryptionSecurityManager
public SecurityManager getDecryptionSecurityManager()
-
authenticateDecryption
public boolean authenticateDecryption(DecryptedState decryptedState) throws PDFSecurityException
- Throws:
PDFSecurityException
-
setDecryptionSecurityManager
public void setDecryptionSecurityManager(SecurityManager securityMgr) throws PDFSecurityException, PDFCosParseException, PDFIOException
-
getEncryptionSecurityManager
public SecurityManager getEncryptionSecurityManager()
-
setEncryptionSecurityManager
public void setEncryptionSecurityManager(SecurityManager securityMgr, java.util.Map encryptParams)
-
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
public void setupEncryption() throws PDFCosParseException, PDFIOException, PDFSecurityExceptionSetup encryption
-
resetEncryptionSecurityManager
public void resetEncryptionSecurityManager()
-
resetDecryptionSecurityManager
public void resetDecryptionSecurityManager()
-
encryptString
public byte[] encryptString(CosString strObj, byte[] content) throws PDFSecurityException
Get the encrypted bytes for a string- Throws:
PDFUnsupportedFeatureException- if no encryption implementation is in placePDFSecurityException
-
decryptString
public byte[] decryptString(CosString strObj, byte[] content) throws PDFSecurityException
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()
-
-