GeneralSecurityManager.java
2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityConfigurationException
* com.adobe.internal.pdftoolkit.core.securityframework.SecurityHandler
* com.adobe.internal.pdftoolkit.core.securityframework.SecurityManager
*/
package com.adobe.internal.pdftoolkit.core.encryption;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityConfigurationException;
import com.adobe.internal.pdftoolkit.core.securityframework.SecurityHandler;
import com.adobe.internal.pdftoolkit.core.securityframework.SecurityManager;
import java.util.HashMap;
import java.util.Map;
public class GeneralSecurityManager
implements SecurityManager {
private HashMap secHandlers = null;
private Map requestedEncryption = null;
public SecurityHandler getSecurityHandler(String filterName, Map encryptParams) throws PDFSecurityConfigurationException {
if (this.secHandlers == null) {
throw new PDFSecurityConfigurationException("Security Handler: " + filterName + " is not registered");
}
if (filterName == null && encryptParams != null) {
filterName = (String)encryptParams.get("Filter");
}
if (filterName == null) {
throw new PDFSecurityConfigurationException("Security Handler is null");
}
SecurityHandler handler = (SecurityHandler)this.secHandlers.get(filterName);
if (handler != null) {
return handler;
}
throw new PDFSecurityConfigurationException("Security Handler: " + filterName + " is not registered");
}
public void addSecurityHandler(String name, SecurityHandler handler) {
if (this.secHandlers == null) {
this.secHandlers = new HashMap();
}
this.secHandlers.put(name, handler);
if (this.requestedEncryption == null) {
this.requestedEncryption = handler.getEncryptParameters();
}
}
public Map getEncryptParameters() {
return this.requestedEncryption;
}
}