StandardCipherSecurityManager.java
5.73 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.internal.pdftoolkit.core.credentials.Credentials
* com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityConfigurationException
* com.adobe.internal.pdftoolkit.core.permissionprovider.PermissionProvider
* com.adobe.internal.pdftoolkit.core.securityframework.SecurityHandler
* com.adobe.internal.pdftoolkit.core.securityframework.SecurityManager
* com.adobe.internal.pdftoolkit.core.securityframework.impl.SecurityProvidersImpl
*/
package com.adobe.internal.pdftoolkit.core.encryption;
import com.adobe.internal.pdftoolkit.core.credentials.Credentials;
import com.adobe.internal.pdftoolkit.core.encryption.GeneralSecurityManager;
import com.adobe.internal.pdftoolkit.core.encryption.PBSHStandardCipher;
import com.adobe.internal.pdftoolkit.core.encryption.PKISecurityHandler;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityConfigurationException;
import com.adobe.internal.pdftoolkit.core.permissionprovider.PermissionProvider;
import com.adobe.internal.pdftoolkit.core.securityframework.SecurityHandler;
import com.adobe.internal.pdftoolkit.core.securityframework.SecurityManager;
import com.adobe.internal.pdftoolkit.core.securityframework.impl.SecurityProvidersImpl;
import java.util.Map;
public class StandardCipherSecurityManager
extends GeneralSecurityManager
implements SecurityManager {
public static final String FILTER = "Filter";
private byte[] password;
private byte[] owner;
private byte[] user;
private SecurityHandler standardMgr = null;
public StandardCipherSecurityManager(byte[] password, SecurityProvidersImpl providers) throws PDFSecurityConfigurationException {
this.password = password;
this.owner = null;
this.user = null;
this.standardMgr = PBSHStandardCipher.newInstance(this.password, providers);
super.addSecurityHandler("Standard", this.standardMgr);
}
public StandardCipherSecurityManager(Credentials recipient, Map encryptParams, SecurityProvidersImpl providers) {
this.standardMgr = new PKISecurityHandler(recipient, providers);
String handlerName = (String)encryptParams.get("Filter");
if (handlerName == null) {
handlerName = "";
}
super.addSecurityHandler(handlerName, this.standardMgr);
}
public StandardCipherSecurityManager(Map encryptParams, SecurityProvidersImpl providers) throws PDFSecurityConfigurationException {
this.standardMgr = new PKISecurityHandler(encryptParams, providers);
String handlerName = (String)encryptParams.get("Filter");
if (handlerName == null) {
handlerName = "";
}
super.addSecurityHandler(handlerName, this.standardMgr);
}
public StandardCipherSecurityManager(byte[] owner, byte[] user, Map encrypt, PermissionProvider encryptionPermissions, SecurityProvidersImpl providers) throws PDFSecurityConfigurationException {
this.owner = owner;
this.user = user;
this.password = null;
this.standardMgr = PBSHStandardCipher.newInstance(this.owner, this.user, encrypt, encryptionPermissions, providers);
super.addSecurityHandler("Standard", this.standardMgr);
}
public static StandardCipherSecurityManager newInstance(byte[] password) throws PDFSecurityConfigurationException {
return new StandardCipherSecurityManager(password, null);
}
public static StandardCipherSecurityManager newInstance(byte[] password, SecurityProvidersImpl providers) throws PDFSecurityConfigurationException {
return new StandardCipherSecurityManager(password, providers);
}
public static StandardCipherSecurityManager newInstance(Credentials recipient, Map encryptParams) throws PDFSecurityConfigurationException {
return new StandardCipherSecurityManager(recipient, encryptParams, null);
}
public static StandardCipherSecurityManager newInstance(Credentials recipient, Map encryptParams, SecurityProvidersImpl providers) throws PDFSecurityConfigurationException {
return new StandardCipherSecurityManager(recipient, encryptParams, providers);
}
public static StandardCipherSecurityManager newInstance(Map encryptParams) throws PDFSecurityConfigurationException {
return new StandardCipherSecurityManager(encryptParams, null);
}
public static StandardCipherSecurityManager newInstance(Map encryptParams, SecurityProvidersImpl providers) throws PDFSecurityConfigurationException {
return new StandardCipherSecurityManager(encryptParams, providers);
}
public static StandardCipherSecurityManager newInstance(byte[] owner, byte[] user, Map encrypt, PermissionProvider encryptionPermissions) throws PDFSecurityConfigurationException {
return new StandardCipherSecurityManager(owner, user, encrypt, encryptionPermissions, null);
}
public static StandardCipherSecurityManager newInstance(byte[] owner, byte[] user, PermissionProvider encryptionPermissions) throws PDFSecurityConfigurationException {
return new StandardCipherSecurityManager(owner, user, null, encryptionPermissions, null);
}
public static StandardCipherSecurityManager newInstance(byte[] owner, byte[] user, Map encrypt, PermissionProvider encryptionPermissions, SecurityProvidersImpl providers) throws PDFSecurityConfigurationException {
return new StandardCipherSecurityManager(owner, user, encrypt, encryptionPermissions, providers);
}
public static StandardCipherSecurityManager newInstance(byte[] owner, byte[] user, PermissionProvider encryptionPermissions, SecurityProvidersImpl providers) throws PDFSecurityConfigurationException {
return new StandardCipherSecurityManager(owner, user, null, encryptionPermissions, providers);
}
}