Java Doc for PDFEncryption.java in  » PDF » PDFBox-0.7.3 » org » pdfbox » encryption » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » PDF » PDFBox 0.7.3 » org.pdfbox.encryption 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.pdfbox.encryption.PDFEncryption

PDFEncryption
final public class PDFEncryption (Code)
This class will deal with PDF encryption algorithms.
author:
   Ben Litchfield
version:
   $Revision: 1.15 $
See Also:   org.pdfbox.pdmodel.encryption.StandardSecurityHandler


Field Summary
final public static  byte[]ENCRYPT_PADDING
     The encryption padding defined in the PDF 1.4 Spec algorithm 3.2.


Method Summary
final public  byte[]computeEncryptedKey(byte[] password, byte[] o, int permissions, byte[] id, int revision, int length)
     This will compute the encrypted key.
Parameters:
  password - The password used to compute the encrypted key.
Parameters:
  o - The owner password hash.
Parameters:
  permissions - The permissions for the document.
Parameters:
  id - The document id.
Parameters:
  revision - The security revision.
Parameters:
  length - The length of the encryption key.
final public  byte[]computeOwnerPassword(byte[] ownerPassword, byte[] userPassword, int revision, int length)
     This algorithm is taked from PDF Reference 1.4 Algorithm 3.3 Page 79.
Parameters:
  ownerPassword - The plain owner password.
Parameters:
  userPassword - The plain user password.
Parameters:
  revision - The version of the security.
Parameters:
  length - The length of the document.
final public  byte[]computeUserPassword(byte[] password, byte[] o, int permissions, byte[] id, int revision, int length)
     This will compute the user password hash.
Parameters:
  password - The plain text password.
Parameters:
  o - The owner password hash.
Parameters:
  permissions - The document permissions.
Parameters:
  id - The document id.
Parameters:
  revision - The revision of the encryption.
Parameters:
  length - The length of the encryption key.
final public  voidencryptData(long objectNumber, long genNumber, byte[] key, InputStream data, OutputStream output)
     This will encrypt a piece of data.
final public  byte[]getUserPassword(byte[] ownerPassword, byte[] o, int revision, long length)
     This will get the user password from the owner password and the documents o value.
Parameters:
  ownerPassword - The plaintext owner password.
Parameters:
  o - The document's o entry.
Parameters:
  revision - The document revision number.
Parameters:
  length - The length of the encryption.
final public  booleanisOwnerPassword(byte[] ownerPassword, byte[] u, byte[] o, int permissions, byte[] id, int revision, int length)
     This will tell if this is the owner password or not.
Parameters:
  ownerPassword - The plaintext owner password.
Parameters:
  u - The U value from the PDF Document.
Parameters:
  o - The owner password hash.
Parameters:
  permissions - The document permissions.
Parameters:
  id - The document id.
Parameters:
  revision - The revision of the encryption.
Parameters:
  length - The length of the encryption key.
final public  booleanisUserPassword(byte[] password, byte[] u, byte[] o, int permissions, byte[] id, int revision, int length)
     This will tell if this is a valid user password. Algorithm 3.6 pg 80
Parameters:
  password - The password to test.
Parameters:
  u - The U value from the PDF Document.
Parameters:
  o - The owner password hash.
Parameters:
  permissions - The document permissions.
Parameters:
  id - The document id.
Parameters:
  revision - The revision of the encryption.
Parameters:
  length - The length of the encryption key.

Field Detail
ENCRYPT_PADDING
final public static byte[] ENCRYPT_PADDING(Code)
The encryption padding defined in the PDF 1.4 Spec algorithm 3.2.





Method Detail
computeEncryptedKey
final public byte[] computeEncryptedKey(byte[] password, byte[] o, int permissions, byte[] id, int revision, int length) throws CryptographyException(Code)
This will compute the encrypted key.
Parameters:
  password - The password used to compute the encrypted key.
Parameters:
  o - The owner password hash.
Parameters:
  permissions - The permissions for the document.
Parameters:
  id - The document id.
Parameters:
  revision - The security revision.
Parameters:
  length - The length of the encryption key. The encryption key.
throws:
  CryptographyException - If there is an error computing the key.



computeOwnerPassword
final public byte[] computeOwnerPassword(byte[] ownerPassword, byte[] userPassword, int revision, int length) throws CryptographyException, IOException(Code)
This algorithm is taked from PDF Reference 1.4 Algorithm 3.3 Page 79.
Parameters:
  ownerPassword - The plain owner password.
Parameters:
  userPassword - The plain user password.
Parameters:
  revision - The version of the security.
Parameters:
  length - The length of the document. The computed owner password.
throws:
  CryptographyException - If there is an error computing O.
throws:
  IOException - If there is an error computing O.



computeUserPassword
final public byte[] computeUserPassword(byte[] password, byte[] o, int permissions, byte[] id, int revision, int length) throws CryptographyException, IOException(Code)
This will compute the user password hash.
Parameters:
  password - The plain text password.
Parameters:
  o - The owner password hash.
Parameters:
  permissions - The document permissions.
Parameters:
  id - The document id.
Parameters:
  revision - The revision of the encryption.
Parameters:
  length - The length of the encryption key. The user password.
throws:
  CryptographyException - If there is an error computing the user password.
throws:
  IOException - If there is an IO error.



encryptData
final public void encryptData(long objectNumber, long genNumber, byte[] key, InputStream data, OutputStream output) throws CryptographyException, IOException(Code)
This will encrypt a piece of data.
Parameters:
  objectNumber - The id for the object.
Parameters:
  genNumber - The generation id for the object.
Parameters:
  key - The key used to encrypt the data.
Parameters:
  data - The data to encrypt/decrypt.
Parameters:
  output - The stream to write to.
throws:
  CryptographyException - If there is an error encrypting the data.
throws:
  IOException - If there is an io error.



getUserPassword
final public byte[] getUserPassword(byte[] ownerPassword, byte[] o, int revision, long length) throws CryptographyException, IOException(Code)
This will get the user password from the owner password and the documents o value.
Parameters:
  ownerPassword - The plaintext owner password.
Parameters:
  o - The document's o entry.
Parameters:
  revision - The document revision number.
Parameters:
  length - The length of the encryption. The plaintext padded user password.
throws:
  CryptographyException - If there is an error getting the user password.
throws:
  IOException - If there is an error reading data.



isOwnerPassword
final public boolean isOwnerPassword(byte[] ownerPassword, byte[] u, byte[] o, int permissions, byte[] id, int revision, int length) throws CryptographyException, IOException(Code)
This will tell if this is the owner password or not.
Parameters:
  ownerPassword - The plaintext owner password.
Parameters:
  u - The U value from the PDF Document.
Parameters:
  o - The owner password hash.
Parameters:
  permissions - The document permissions.
Parameters:
  id - The document id.
Parameters:
  revision - The revision of the encryption.
Parameters:
  length - The length of the encryption key. true if the owner password matches the one from the document.
throws:
  CryptographyException - If there is an error while executing crypt functions.
throws:
  IOException - If there is an error while checking owner password.



isUserPassword
final public boolean isUserPassword(byte[] password, byte[] u, byte[] o, int permissions, byte[] id, int revision, int length) throws CryptographyException, IOException(Code)
This will tell if this is a valid user password. Algorithm 3.6 pg 80
Parameters:
  password - The password to test.
Parameters:
  u - The U value from the PDF Document.
Parameters:
  o - The owner password hash.
Parameters:
  permissions - The document permissions.
Parameters:
  id - The document id.
Parameters:
  revision - The revision of the encryption.
Parameters:
  length - The length of the encryption key. true If this is the correct user password.
throws:
  CryptographyException - If there is an error computing the value.
throws:
  IOException - If there is an IO error while computing the owners password.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.