|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.icepdf.core.pobjects.security.SecurityHandler
org.icepdf.core.pobjects.security.StandardSecurityHandler
public class StandardSecurityHandler
ICEpdf's standard security handler allows access permissions and up to two passwords to be specified for a document: an owner password and a user password. An application's decision to encrypt a document is based on whether the user creating the document specifies any passwords or access restrictions (for example, in a security settings dialog that the user can invoke before saving the PDF file); if so, the document is encrypted, and the permissions and information required to validate the passwords are stored in the encryption dictionary. (An application may also create an encrypted document without any user interaction, if it has some other source of information about what passwords and permissions to use.)
If a user attempts to open an encrypted document that has a user password, the viewer application should prompt for a password. Correctly supplying either password allows the user to open the document, decrypt it, and display it on the screen. If the document does not have a user password, no password is requested; the viewer application can simply open, decrypt, and display the document. Whether additional operations are allowed on a decrypted document depends on which password (if any) was supplied when the document was opened and on any access restrictions that were specified when the document was created:
Access permissions are specified in the form of flags corresponding to the various operations, and the set of operations to which they correspond, depends in turn on the security handler's revision number (also stored in the encryption dictionary). If the revision number is 2 or greater, the operations to which user access can be controlled are as follows:
If the security handler's revision number is 3 or greater, user access to the following operations can be controlled more selectively:
In addition, revision 3 enables the extraction of text and graphics (in support of accessibility to disabled users or for other purposes) to be controlled separately. Beginning with revision 4, the standard security handler supports crypt filters. The support is limited to the Identity crypt filter and crypt filters named StdCF whose dictionaries contain a CFM value of V2 and an AuthEvent value of DocOpen.
| Field Summary |
|---|
| Fields inherited from class org.icepdf.core.pobjects.security.SecurityHandler |
|---|
encryptionDictionary, handlerName, permissions |
| Constructor Summary | |
|---|---|
StandardSecurityHandler(EncryptionDictionary encryptionDictionary)
|
|
| Method Summary | |
|---|---|
byte[] |
decrypt(Reference objectReference,
byte[] encryptionKey,
byte[] data)
Decrypt the PDF data bytestream or string. |
void |
dispose()
Dispose of the security handler. |
byte[] |
encrypt(Reference objectReference,
byte[] encryptionKey,
byte[] data)
Encrypt the PDF data bytestream or string. |
byte[] |
getDecryptionKey()
Gets the encryption key used by the security handler for decryption data. |
java.io.InputStream |
getEncryptionInputStream(Reference objectReference,
byte[] encryptionKey,
java.util.Hashtable decodeParams,
java.io.InputStream input)
|
byte[] |
getEncryptionKey()
Gets the encryption key used by the security handler for encrypting data. |
java.lang.String |
getHandlerName()
Gets the name of the default security handler. |
Permissions |
getPermissions()
Gets the PDF permissions object associated with this document's security handler. |
void |
init()
Initiate the security handler |
boolean |
isAuthorized(java.lang.String password)
Determines whether the supplied password is authorized to view the PDF document. |
boolean |
isOwnerAuthorized(java.lang.String password)
Determines whether the supplied owner password is authorized to view the PDF document. |
boolean |
isUserAuthorized(java.lang.String password)
Determines whether the supplied user password is authorized to view the PDF document. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StandardSecurityHandler(EncryptionDictionary encryptionDictionary)
| Method Detail |
|---|
public boolean isAuthorized(java.lang.String password)
SecurityHandlerInterface
isAuthorized in interface SecurityHandlerInterfaceisAuthorized in class SecurityHandlerpassword - password to authorize
public boolean isOwnerAuthorized(java.lang.String password)
SecurityHandlerInterface
isOwnerAuthorized in interface SecurityHandlerInterfaceisOwnerAuthorized in class SecurityHandlerpassword - password to authorize
public boolean isUserAuthorized(java.lang.String password)
SecurityHandlerInterface
isUserAuthorized in interface SecurityHandlerInterfaceisUserAuthorized in class SecurityHandlerpassword - password to authorize
public byte[] encrypt(Reference objectReference,
byte[] encryptionKey,
byte[] data)
SecurityHandlerInterface
encrypt in interface SecurityHandlerInterfaceencrypt in class SecurityHandlerobjectReference - reference to PDF object being encrypted; this object
contains the PDF object number and revision.encryptionKey - encryption key used by encryption algorithm.data - byte data to be encrypted; either represents an object stream
or string value.
public byte[] decrypt(Reference objectReference,
byte[] encryptionKey,
byte[] data)
SecurityHandlerInterface
decrypt in interface SecurityHandlerInterfacedecrypt in class SecurityHandlerobjectReference - reference to PDF object being encrypted; this object
contains the PDF object number and revision.encryptionKey - encryption key used by decryption algorithm.data - byte data to be decrypted; either represents an object stream
or string value.
public java.io.InputStream getEncryptionInputStream(Reference objectReference,
byte[] encryptionKey,
java.util.Hashtable decodeParams,
java.io.InputStream input)
getEncryptionInputStream in interface SecurityHandlerInterfacegetEncryptionInputStream in class SecurityHandlerpublic byte[] getEncryptionKey()
SecurityHandlerInterface
getEncryptionKey in interface SecurityHandlerInterfacegetEncryptionKey in class SecurityHandlerpublic byte[] getDecryptionKey()
SecurityHandlerInterface
getDecryptionKey in interface SecurityHandlerInterfacegetDecryptionKey in class SecurityHandlerpublic Permissions getPermissions()
SecurityHandlerInterface
getPermissions in interface SecurityHandlerInterfacegetPermissions in class SecurityHandlerpublic java.lang.String getHandlerName()
SecurityHandlerInterface
getHandlerName in interface SecurityHandlerInterfacegetHandlerName in class SecurityHandlerpublic void init()
SecurityHandlerInterface
init in interface SecurityHandlerInterfaceinit in class SecurityHandlerpublic void dispose()
SecurityHandlerInterface
dispose in interface SecurityHandlerInterfacedispose in class SecurityHandler
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||