49 final class JceSecurityManager extends SecurityManager {
50
51 private static final CryptoPermissions defaultPolicy;
52 private static final CryptoPermissions exemptPolicy;
53 private static final CryptoAllPermission allPerm;
54 private static final Vector<Class<?>> TrustedCallersCache =
55 new Vector<>(2);
56 private static final ConcurrentMap<URL,CryptoPermissions> exemptCache =
57 new ConcurrentHashMap<>();
58 private static final CryptoPermissions CACHE_NULL_MARK =
59 new CryptoPermissions();
60
61 // singleton instance
62 static final JceSecurityManager INSTANCE;
63
64 static {
65 defaultPolicy = JceSecurity.getDefaultPolicy();
66 exemptPolicy = JceSecurity.getExemptPolicy();
67 allPerm = CryptoAllPermission.INSTANCE;
68 INSTANCE = AccessController.doPrivileged(
69 new PrivilegedAction<JceSecurityManager>() {
70 public JceSecurityManager run() {
71 return new JceSecurityManager();
72 }
73 });
74 }
75
76 private JceSecurityManager() {
77 // empty
78 }
79
80 /**
81 * Returns the maximum allowable crypto strength for the given
82 * applet/application, for the given algorithm.
83 */
84 CryptoPermission getCryptoPermission(String alg) {
85 // Need to convert to uppercase since the crypto perm
86 // lookup is case sensitive.
87 alg = alg.toUpperCase(Locale.ENGLISH);
88
89 // If CryptoAllPermission is granted by default, we return that.
|
49 final class JceSecurityManager extends SecurityManager {
50
51 private static final CryptoPermissions defaultPolicy;
52 private static final CryptoPermissions exemptPolicy;
53 private static final CryptoAllPermission allPerm;
54 private static final Vector<Class<?>> TrustedCallersCache =
55 new Vector<>(2);
56 private static final ConcurrentMap<URL,CryptoPermissions> exemptCache =
57 new ConcurrentHashMap<>();
58 private static final CryptoPermissions CACHE_NULL_MARK =
59 new CryptoPermissions();
60
61 // singleton instance
62 static final JceSecurityManager INSTANCE;
63
64 static {
65 defaultPolicy = JceSecurity.getDefaultPolicy();
66 exemptPolicy = JceSecurity.getExemptPolicy();
67 allPerm = CryptoAllPermission.INSTANCE;
68 INSTANCE = AccessController.doPrivileged(
69 new PrivilegedAction<>() {
70 public JceSecurityManager run() {
71 return new JceSecurityManager();
72 }
73 });
74 }
75
76 private JceSecurityManager() {
77 // empty
78 }
79
80 /**
81 * Returns the maximum allowable crypto strength for the given
82 * applet/application, for the given algorithm.
83 */
84 CryptoPermission getCryptoPermission(String alg) {
85 // Need to convert to uppercase since the crypto perm
86 // lookup is case sensitive.
87 alg = alg.toUpperCase(Locale.ENGLISH);
88
89 // If CryptoAllPermission is granted by default, we return that.
|