|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.pdfview.decrypt.PDFPassword
public class PDFPassword
Identifies a PDF Password, expressible either as a string or a byte sequence.
In revisions up to version 1.e Expansion 3, the mapping between a string and the bytes corresponding to the password was poorly specified, meaning that the safest manner in which to specify a password was via a byte array. With 1.7 expansion 3, a still slightly problematic mapping was given for the Standard encryption algorithms through to version 4, and a very well specified mapping for the new version 5 encryption.
So, for passwords specified in versions up to and including 4, a byte[] representation is the most accurate, but not necessarily the most convenient manner to provide passwords. For version 5, allowing passwords to be specified as Strings will be the preferred mechanism. Rather than specify two interfaces whenever a password can be provided - one for byte[] and one for String - we express the password as a class. This class can also offer a best guess at a String representation for a password for encryption versions up to and including 4.
Field Summary | |
---|---|
static PDFPassword |
EMPTY_PASSWORD
The empty password |
Constructor Summary | |
---|---|
PDFPassword(byte[] passwordBytes)
Construct a byte-based password |
|
PDFPassword(java.lang.String passwordString)
Construct a string-based password |
Method Summary | |
---|---|
static PDFPassword |
nonNullPassword(PDFPassword password)
Ensure a non-null PDFPassword by substituting the empty password for a null password |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final PDFPassword EMPTY_PASSWORD
Constructor Detail |
---|
public PDFPassword(byte[] passwordBytes)
passwordBytes
- the password bytespublic PDFPassword(java.lang.String passwordString)
passwordString
- the passwordMethod Detail |
---|
public static PDFPassword nonNullPassword(PDFPassword password)
password
- the password, may be null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |