Interface EnableEncryption
public interface EnableEncryption
Provides the interface to the internal implementation of encryption and security in
PDF Java Toolkit.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanauthenticateSecurity(SecurityHandler handler, DecryptedState decryptedState) Authenticates all security handlers specified by the encryption parameters associated with the stored security managerbooleanauthenticateSecurity(Map params, byte[] docID, SecurityHandler handler, DecryptedState decryptedState) Authenticates specified security handlervoiddecryptStream(String cryptFilter, InputByteStream src, OutputByteStream dest, byte[] addKey) Decrypts CosStream's contentbyte[]decryptString(byte[] content, byte[] addKey) Decrypts CosString's contentvoidencryptStream(String cryptFilter, InputByteStream src, OutputByteStream dest, byte[] addKey) Encrypts CosStream's contentbyte[]encryptString(byte[] content, byte[] addKey) Encrypts CosString's contentReturns SecurityHandler which has been used to authenticate security.voidvoidvoidsetDecryptionSecurityManager(SecurityManager securityMgr, Map encryptParams, byte[] id) Sets the Security Manager used for encryption-related actionsvoidsetEncryptionSecurityManager(SecurityManager securityMgr, Map encryptParams, byte[] id)
-
Method Details
-
setDecryptionSecurityManager
void setDecryptionSecurityManager(SecurityManager securityMgr, Map encryptParams, byte[] id) throws PDFSecurityException Sets the Security Manager used for encryption-related actions- Parameters:
securityMgr- - Security ManagerencryptParams- - Encryption Parameters- Throws:
PDFSecurityException
-
setEncryptionSecurityManager
-
resetEncryptionSecurityManager
void resetEncryptionSecurityManager() -
resetDecryptionSecurityManager
void resetDecryptionSecurityManager() -
getEncryptionSecurityManager
SecurityManager getEncryptionSecurityManager() -
getDecryptionSecurityManager
SecurityManager getDecryptionSecurityManager() -
getEncryptionParameters
-
getDecryptionParameters
-
authenticateSecurity
boolean authenticateSecurity(SecurityHandler handler, DecryptedState decryptedState) throws PDFSecurityAuthorizationException, PDFSecurityConfigurationException Authenticates all security handlers specified by the encryption parameters associated with the stored security manager- Parameters:
handler-SecurityHandlerto authenticatedecryptedState- Set null if password or credentials are used for decryption, else set a valid decryption state.- Throws:
PDFSecurityAuthorizationExceptionPDFSecurityConfigurationException
-
authenticateSecurity
boolean authenticateSecurity(Map params, byte[] docID, SecurityHandler handler, DecryptedState decryptedState) throws PDFSecurityAuthorizationException, PDFSecurityConfigurationException Authenticates specified security handler- Parameters:
params-docID-handler-decryptedState-- Returns:
- boolean
- Throws:
PDFSecurityAuthorizationExceptionPDFSecurityConfigurationException
-
encryptString
Encrypts CosString's content- Parameters:
content- byte sequence of the CosString's contentaddKey- CosString-object-specific addition to the encryption key associated with the particular security handler- Returns:
- encrypted byte sequence
- Throws:
PDFSecurityException
-
decryptString
Decrypts CosString's content- Parameters:
content- byte sequence of the CosString's contentaddKey- CosString-object-specific addition to the encryption key associated with the particular security handler- Returns:
- - decrypted byte sequence
- Throws:
PDFSecurityException
-
decryptStream
void decryptStream(String cryptFilter, InputByteStream src, OutputByteStream dest, byte[] addKey) throws PDFSecurityException, PDFIOException Decrypts CosStream's content- Parameters:
src- source stream to decryptdest- destination for the decrypted streamaddKey- CosStream-object-specific addition to the encryption key associated with the particular security handler- Throws:
PDFIOExceptionPDFSecurityException
-
encryptStream
void encryptStream(String cryptFilter, InputByteStream src, OutputByteStream dest, byte[] addKey) throws PDFSecurityException, PDFIOException Encrypts CosStream's content- Parameters:
src- source stream to encryptdest- destination for the encrypted streamaddKey- CosStream-object-specific addition to the encryption key associated with the particular security handler- Throws:
PDFSecurityExceptionPDFIOException
-
getStreamEncryptionHandler
EncryptionHandler getStreamEncryptionHandler(String name) throws PDFSecurityConfigurationException, PDFSecurityAuthorizationException - Parameters:
name-- Returns:
- Encryption Handler for stream encryption with the specified name
- Throws:
PDFSecurityConfigurationExceptionPDFSecurityAuthorizationException
-
getStringEncryptionHandler
EncryptionHandler getStringEncryptionHandler() throws PDFSecurityConfigurationException, PDFSecurityAuthorizationException- Returns:
- Encryption Handler for string encryption with the specified name
- Throws:
PDFSecurityConfigurationExceptionPDFSecurityAuthorizationException
-
getStreamDecryptionHandler
EncryptionHandler getStreamDecryptionHandler(String name) throws PDFSecurityConfigurationException, PDFSecurityAuthorizationException - Parameters:
name-- Returns:
- Encryption Handler for stream decryption with the specified name
- Throws:
PDFSecurityConfigurationExceptionPDFSecurityAuthorizationException
-
getStringDecryptionHandler
EncryptionHandler getStringDecryptionHandler() throws PDFSecurityConfigurationException, PDFSecurityAuthorizationException- Returns:
- Encryption Handler for string decryption with the specified name
- Throws:
PDFSecurityConfigurationExceptionPDFSecurityAuthorizationException
-
getSecurityHandler
SecurityHandler getSecurityHandler()Returns SecurityHandler which has been used to authenticate security. If this process is still not done, then this method returns null.- Returns:
SecurityHandler
-