Interface EnableEncryption
-
public interface EnableEncryption
Provides the interface to the internal implementation of encryption and security in PDF Java Toolkit.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
authenticateSecurity(SecurityHandler handler, DecryptedState decryptedState)
Authenticates all security handlers specified by the encryption parameters associated with the stored security managerboolean
authenticateSecurity(java.util.Map params, byte[] docID, SecurityHandler handler, DecryptedState decryptedState)
Authenticates specified security handlervoid
decryptStream(java.lang.String cryptFilter, InputByteStream src, OutputByteStream dest, byte[] addKey)
Decrypts CosStream's contentbyte[]
decryptString(byte[] content, byte[] addKey)
Decrypts CosString's contentvoid
encryptStream(java.lang.String cryptFilter, InputByteStream src, OutputByteStream dest, byte[] addKey)
Encrypts CosStream's contentbyte[]
encryptString(byte[] content, byte[] addKey)
Encrypts CosString's contentjava.util.Map
getDecryptionParameters()
SecurityManager
getDecryptionSecurityManager()
java.util.Map
getEncryptionParameters()
SecurityManager
getEncryptionSecurityManager()
SecurityHandler
getSecurityHandler()
Returns SecurityHandler which has been used to authenticate security.EncryptionHandler
getStreamDecryptionHandler(java.lang.String name)
EncryptionHandler
getStreamEncryptionHandler(java.lang.String name)
EncryptionHandler
getStringDecryptionHandler()
EncryptionHandler
getStringEncryptionHandler()
void
resetDecryptionSecurityManager()
void
resetEncryptionSecurityManager()
void
setDecryptionSecurityManager(SecurityManager securityMgr, java.util.Map encryptParams, byte[] id)
Sets the Security Manager used for encryption-related actionsvoid
setEncryptionSecurityManager(SecurityManager securityMgr, java.util.Map encryptParams, byte[] id)
-
-
-
Method Detail
-
setDecryptionSecurityManager
void setDecryptionSecurityManager(SecurityManager securityMgr, java.util.Map encryptParams, byte[] id) throws PDFSecurityException
Sets the Security Manager used for encryption-related actions- Parameters:
securityMgr
- - Security ManagerencryptParams
- - Encryption Parameters- Throws:
PDFSecurityException
-
setEncryptionSecurityManager
void setEncryptionSecurityManager(SecurityManager securityMgr, java.util.Map encryptParams, byte[] id)
-
resetEncryptionSecurityManager
void resetEncryptionSecurityManager()
-
resetDecryptionSecurityManager
void resetDecryptionSecurityManager()
-
getEncryptionSecurityManager
SecurityManager getEncryptionSecurityManager()
-
getDecryptionSecurityManager
SecurityManager getDecryptionSecurityManager()
-
getEncryptionParameters
java.util.Map getEncryptionParameters() throws PDFSecurityAuthorizationException
-
getDecryptionParameters
java.util.Map getDecryptionParameters() throws PDFSecurityAuthorizationException
-
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
-SecurityHandler
to authenticatedecryptedState
- Set null if password or credentials are used for decryption, else set a valid decryption state.- Throws:
PDFSecurityAuthorizationException
PDFSecurityConfigurationException
-
authenticateSecurity
boolean authenticateSecurity(java.util.Map params, byte[] docID, SecurityHandler handler, DecryptedState decryptedState) throws PDFSecurityAuthorizationException, PDFSecurityConfigurationException
Authenticates specified security handler- Parameters:
params
-docID
-handler
-decryptedState
-- Returns:
- boolean
- Throws:
PDFSecurityAuthorizationException
PDFSecurityConfigurationException
-
encryptString
byte[] encryptString(byte[] content, byte[] addKey) throws PDFSecurityException
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
byte[] decryptString(byte[] content, byte[] addKey) throws PDFSecurityException
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(java.lang.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:
PDFIOException
PDFSecurityException
-
encryptStream
void encryptStream(java.lang.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:
PDFSecurityException
PDFIOException
-
getStreamEncryptionHandler
EncryptionHandler getStreamEncryptionHandler(java.lang.String name) throws PDFSecurityConfigurationException, PDFSecurityAuthorizationException
- Parameters:
name
-- Returns:
- Encryption Handler for stream encryption with the specified name
- Throws:
PDFSecurityConfigurationException
PDFSecurityAuthorizationException
-
getStringEncryptionHandler
EncryptionHandler getStringEncryptionHandler() throws PDFSecurityConfigurationException, PDFSecurityAuthorizationException
- Returns:
- Encryption Handler for string encryption with the specified name
- Throws:
PDFSecurityConfigurationException
PDFSecurityAuthorizationException
-
getStreamDecryptionHandler
EncryptionHandler getStreamDecryptionHandler(java.lang.String name) throws PDFSecurityConfigurationException, PDFSecurityAuthorizationException
- Parameters:
name
-- Returns:
- Encryption Handler for stream decryption with the specified name
- Throws:
PDFSecurityConfigurationException
PDFSecurityAuthorizationException
-
getStringDecryptionHandler
EncryptionHandler getStringDecryptionHandler() throws PDFSecurityConfigurationException, PDFSecurityAuthorizationException
- Returns:
- Encryption Handler for string decryption with the specified name
- Throws:
PDFSecurityConfigurationException
PDFSecurityAuthorizationException
-
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
-
-