Package com.sun.pdfview.decrypt
Class IdentityDecrypter
- java.lang.Object
-
- com.sun.pdfview.decrypt.IdentityDecrypter
-
- All Implemented Interfaces:
PDFDecrypter
public class IdentityDecrypter extends java.lang.Object implements PDFDecrypter
Performs identity decryption; that is, inputs aren't encrypted and are returned right back.
-
-
Field Summary
Fields Modifier and Type Field Description private static IdentityDecrypter
INSTANCE
-
Constructor Summary
Constructors Constructor Description IdentityDecrypter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.ByteBuffer
decryptBuffer(java.lang.String cryptFilterName, PDFObject streamObj, java.nio.ByteBuffer streamBuf)
Decrypt a buffer of datajava.lang.String
decryptString(int objNum, int objGen, java.lang.String inputBasicString)
Decrypt abasic string
.static IdentityDecrypter
getInstance()
boolean
isEncryptionPresent()
Determine whether this actually applies a decryption other than identity decryption.boolean
isOwnerAuthorised()
Determine whether the password known by the decrypter indicates that the user is the owner of the document.
-
-
-
Field Detail
-
INSTANCE
private static IdentityDecrypter INSTANCE
-
-
Method Detail
-
decryptBuffer
public java.nio.ByteBuffer decryptBuffer(java.lang.String cryptFilterName, PDFObject streamObj, java.nio.ByteBuffer streamBuf) throws PDFParseException
Description copied from interface:PDFDecrypter
Decrypt a buffer of data- Specified by:
decryptBuffer
in interfacePDFDecrypter
- Parameters:
cryptFilterName
- the name of the crypt filter, if V4 encryption is being used, where individual crypt filters may be specified for individual streams. If encryption is not using V4 encryption (indicated by V=4 in the Encrypt dictionary) then this must be null. Null may also be specified with V4 encryption to indicate that the default filter should be used.streamObj
- the object whose stream is being decrypted. The containing object's number and generation contribute to the key used for stream encrypted with the document's default encryption, so this is typically required. Should be null only if a cryptFilterName is specified, as objects with specific stream filters use the general document key, rather than a stream-specific key.streamBuf
- the buffer to decrypt- Returns:
- a buffer containing the decrypted stream, positioned at its beginning; will only be the same buffer as streamBuf if the identity decrypter is being used
- Throws:
PDFParseException
- if the named crypt filter does not exist, or if a crypt filter is named when named crypt filters are not supported. Problems due to incorrect passwords are revealed prior to this point.
-
decryptString
public java.lang.String decryptString(int objNum, int objGen, java.lang.String inputBasicString)
Description copied from interface:PDFDecrypter
Decrypt abasic string
.- Specified by:
decryptString
in interfacePDFDecrypter
- Parameters:
objNum
- the object number of the containing objectobjGen
- the generation number of the containing objectinputBasicString
- the string to be decrypted- Returns:
- the decrypted string
-
getInstance
public static IdentityDecrypter getInstance()
-
isEncryptionPresent
public boolean isEncryptionPresent()
Description copied from interface:PDFDecrypter
Determine whether this actually applies a decryption other than identity decryption.- Specified by:
isEncryptionPresent
in interfacePDFDecrypter
- Returns:
- whether encryption is present
-
isOwnerAuthorised
public boolean isOwnerAuthorised()
Description copied from interface:PDFDecrypter
Determine whether the password known by the decrypter indicates that the user is the owner of the document. Can be used, in conjunction withPDFDecrypter.isEncryptionPresent()
to determine whether any permissions apply.- Specified by:
isOwnerAuthorised
in interfacePDFDecrypter
- Returns:
- whether owner authentication is being used to decrypt the document
-
-