org.apache.pdfbox.pdmodel.encryption
public class: PDEncryptionManager [javadoc |
source]
java.lang.Object
org.apache.pdfbox.pdmodel.encryption.PDEncryptionManager
Deprecated! Made
- deprecated by the new security layer of PDFBox. Use SecurityHandlers instead.
This class will handle loading of the different security handlers.
See PDF Reference 1.4 section "3.5 Encryption"
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.apache.pdfbox.pdmodel.encryption.PDEncryptionManager Detail: |
public static PDEncryptionDictionary getEncryptionDictionary(COSDictionary dictionary) throws IOException {
Object retval = null;
if( dictionary != null )
{
COSName filter = (COSName)dictionary.getDictionaryObject( COSName.FILTER );
Class handlerClass = (Class)handlerMap.get( filter );
if( handlerClass == null )
{
throw new IOException( "No handler for security handler '" + filter.getName() + "'" );
}
else
{
try
{
Constructor ctor = handlerClass.getConstructor( new Class[] {
COSDictionary.class
} );
retval = ctor.newInstance( new Object[] {
dictionary
} );
}
catch( NoSuchMethodException e )
{
throw new IOException( e.getMessage() );
}
catch( InstantiationException e )
{
throw new IOException( e.getMessage() );
}
catch( IllegalAccessException e )
{
throw new IOException( e.getMessage() );
}
catch( InvocationTargetException e )
{
throw new IOException( e.getMessage() );
}
}
}
return (PDEncryptionDictionary)retval;
} Deprecated!This will get the correct security handler for the encryption dictionary. |
public static void registerSecurityHandler(String filterName,
Class handlerClass) {
handlerMap.put( COSName.getPDFName( filterName ), handlerClass );
} Deprecated!This will allow the user to register new security handlers when unencrypting a
document. |